OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void MessageHandler::ReportMessage(Isolate* isolate, | 100 void MessageHandler::ReportMessage(Isolate* isolate, |
101 MessageLocation* loc, | 101 MessageLocation* loc, |
102 Handle<Object> message) { | 102 Handle<Object> message) { |
103 // We are calling into embedder's code which can throw exceptions. | 103 // We are calling into embedder's code which can throw exceptions. |
104 // Thus we need to save current exception state, reset it to the clean one | 104 // Thus we need to save current exception state, reset it to the clean one |
105 // and ignore scheduled exceptions callbacks can throw. | 105 // and ignore scheduled exceptions callbacks can throw. |
106 | 106 |
107 // We pass the exception object into the message handler callback though. | 107 // We pass the exception object into the message handler callback though. |
108 Object* exception_object = isolate->heap()->undefined_value(); | 108 Object* exception_object = isolate->heap()->undefined_value(); |
109 if (isolate->has_pending_exception()) { | 109 if (isolate->has_pending_exception()) { |
110 isolate->pending_exception()->ToObject(&exception_object); | 110 exception_object = isolate->pending_exception(); |
111 } | 111 } |
112 Handle<Object> exception_handle(exception_object, isolate); | 112 Handle<Object> exception_handle(exception_object, isolate); |
113 | 113 |
114 Isolate::ExceptionScope exception_scope(isolate); | 114 Isolate::ExceptionScope exception_scope(isolate); |
115 isolate->clear_pending_exception(); | 115 isolate->clear_pending_exception(); |
116 isolate->set_external_caught_exception(false); | 116 isolate->set_external_caught_exception(false); |
117 | 117 |
118 v8::Local<v8::Message> api_message_obj = v8::Utils::MessageToLocal(message); | 118 v8::Local<v8::Message> api_message_obj = v8::Utils::MessageToLocal(message); |
119 v8::Local<v8::Value> api_exception_obj = v8::Utils::ToLocal(exception_handle); | 119 v8::Local<v8::Value> api_exception_obj = v8::Utils::ToLocal(exception_handle); |
120 | 120 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( | 188 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( |
189 Isolate* isolate, | 189 Isolate* isolate, |
190 Handle<Object> data) { | 190 Handle<Object> data) { |
191 HandleScope scope(isolate); | 191 HandleScope scope(isolate); |
192 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); | 192 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 } } // namespace v8::internal | 196 } } // namespace v8::internal |
OLD | NEW |