OLD | NEW |
1 | 1 |
2 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 2 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // an exception. | 101 // an exception. |
102 v8::TryCatch catcher; | 102 v8::TryCatch catcher; |
103 catcher.SetVerbose(false); | 103 catcher.SetVerbose(false); |
104 catcher.SetCaptureMessage(false); | 104 catcher.SetCaptureMessage(false); |
105 | 105 |
106 // Format the message. | 106 // Format the message. |
107 bool caught_exception = false; | 107 bool caught_exception = false; |
108 Handle<Object> message = | 108 Handle<Object> message = |
109 Execution::Call(fun, Factory::undefined_value(), argc, argv, | 109 Execution::Call(fun, Factory::undefined_value(), argc, argv, |
110 &caught_exception); | 110 &caught_exception); |
111 if (caught_exception) { | 111 |
112 // If creating the message (in JS code) resulted in an exception, we | 112 // If creating the message (in JS code) resulted in an exception, we |
113 // skip doing the callback. This usually only happens in case of | 113 // skip doing the callback. This usually only happens in case of |
114 // stack overflow exceptions being thrown by the parser when the | 114 // stack overflow exceptions being thrown by the parser when the |
115 // stack is almost full. | 115 // stack is almost full. |
116 if (caught_exception) return Handle<Object>(); | 116 if (caught_exception) return Handle<Object>(); |
117 } | |
118 | 117 |
119 return message.EscapeFrom(&scope); | 118 return message.EscapeFrom(&scope); |
120 } | 119 } |
121 | 120 |
122 | 121 |
123 void MessageHandler::ReportMessage(MessageLocation* loc, | 122 void MessageHandler::ReportMessage(MessageLocation* loc, |
124 Handle<Object> message) { | 123 Handle<Object> message) { |
125 v8::Local<v8::Message> api_message_obj = v8::Utils::MessageToLocal(message); | 124 v8::Local<v8::Message> api_message_obj = v8::Utils::MessageToLocal(message); |
126 | 125 |
127 v8::NeanderArray global_listeners(Factory::message_listeners()); | 126 v8::NeanderArray global_listeners(Factory::message_listeners()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 169 } |
171 | 170 |
172 | 171 |
173 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { | 172 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { |
174 HandleScope scope; | 173 HandleScope scope; |
175 return GetMessage(data)->ToCString(DISALLOW_NULLS); | 174 return GetMessage(data)->ToCString(DISALLOW_NULLS); |
176 } | 175 } |
177 | 176 |
178 | 177 |
179 } } // namespace v8::internal | 178 } } // namespace v8::internal |
OLD | NEW |