OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/PrivateScriptRunner.h" | 6 #include "bindings/core/v8/PrivateScriptRunner.h" |
7 | 7 |
8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 if (name.IsEmpty() || !name->IsString()) | 250 if (name.IsEmpty() || !name->IsString()) |
251 return false; | 251 return false; |
252 | 252 |
253 v8::Handle<v8::Message> tryCatchMessage = block.Message(); | 253 v8::Handle<v8::Message> tryCatchMessage = block.Message(); |
254 v8::Handle<v8::Value> message = exceptionObject->Get(v8String(isolate, "mess
age")); | 254 v8::Handle<v8::Value> message = exceptionObject->Get(v8String(isolate, "mess
age")); |
255 String messageString; | 255 String messageString; |
256 if (!message.IsEmpty() && message->IsString()) | 256 if (!message.IsEmpty() && message->IsString()) |
257 messageString = toCoreString(v8::Handle<v8::String>::Cast(message)); | 257 messageString = toCoreString(v8::Handle<v8::String>::Cast(message)); |
258 | 258 |
259 String exceptionName = toCoreString(v8::Handle<v8::String>::Cast(name)); | 259 String exceptionName = toCoreString(v8::Handle<v8::String>::Cast(name)); |
| 260 { |
| 261 // FIXME: remove this. |
| 262 // This is a temporal hack to show the error message. |
| 263 //v8::Handle<v8::Value> lineNumber = exceptionObject->Get(v8String(isola
te, "lineNumber")); |
| 264 v8::Handle<v8::Value> message = exceptionObject->Get(v8String(isolate, "
message")); |
| 265 String messageStr = toCoreString(v8::Handle<v8::String>::Cast(message)); |
| 266 |
| 267 printf("JavaScript Error!\n"); |
| 268 printf("message: %s\n", messageStr.utf8().data()); |
| 269 } |
260 if (exceptionName == "DOMExceptionInPrivateScript") { | 270 if (exceptionName == "DOMExceptionInPrivateScript") { |
261 v8::Handle<v8::Value> code = exceptionObject->Get(v8String(isolate, "cod
e")); | 271 v8::Handle<v8::Value> code = exceptionObject->Get(v8String(isolate, "cod
e")); |
262 RELEASE_ASSERT(!code.IsEmpty() && code->IsInt32()); | 272 RELEASE_ASSERT(!code.IsEmpty() && code->IsInt32()); |
263 exceptionState.throwDOMException(toInt32(code), messageString); | 273 exceptionState.throwDOMException(toInt32(code), messageString); |
264 exceptionState.throwIfNeeded(); | 274 exceptionState.throwIfNeeded(); |
265 return true; | 275 return true; |
266 } | 276 } |
267 if (exceptionName == "Error") { | 277 if (exceptionName == "Error") { |
268 exceptionState.throwDOMException(V8GeneralError, messageString); | 278 exceptionState.throwDOMException(V8GeneralError, messageString); |
269 exceptionState.throwIfNeeded(); | 279 exceptionState.throwIfNeeded(); |
(...skipping 21 matching lines...) Expand all Loading... |
291 if (exceptionName == "ReferenceError") { | 301 if (exceptionName == "ReferenceError") { |
292 exceptionState.throwDOMException(V8ReferenceError, messageString); | 302 exceptionState.throwDOMException(V8ReferenceError, messageString); |
293 exceptionState.throwIfNeeded(); | 303 exceptionState.throwIfNeeded(); |
294 dumpJSError(exceptionName, tryCatchMessage); | 304 dumpJSError(exceptionName, tryCatchMessage); |
295 return true; | 305 return true; |
296 } | 306 } |
297 return false; | 307 return false; |
298 } | 308 } |
299 | 309 |
300 } // namespace blink | 310 } // namespace blink |
OLD | NEW |