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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 String exceptionName = toCoreString(v8::Handle<v8::String>::Cast(name)); | 248 String exceptionName = toCoreString(v8::Handle<v8::String>::Cast(name)); |
249 if (exceptionName == "PrivateScriptException") { | 249 if (exceptionName == "PrivateScriptException") { |
250 v8::Handle<v8::Value> code = exceptionObject->Get(v8String(isolate, "cod
e")); | 250 v8::Handle<v8::Value> code = exceptionObject->Get(v8String(isolate, "cod
e")); |
251 RELEASE_ASSERT(!code.IsEmpty() && code->IsInt32()); | 251 RELEASE_ASSERT(!code.IsEmpty() && code->IsInt32()); |
252 exceptionState.throwDOMException(toInt32(code), messageString); | 252 exceptionState.throwDOMException(toInt32(code), messageString); |
253 exceptionState.throwIfNeeded(); | 253 exceptionState.throwIfNeeded(); |
254 return; | 254 return; |
255 } | 255 } |
256 | 256 |
| 257 // Standard JS errors thrown by a private script are treated as real errors |
| 258 // of the private script and crash the renderer, except for a stack overflow |
| 259 // error. A stack overflow error can happen in a valid private script |
| 260 // if user's script can create a recursion that involves the private script. |
| 261 if (exceptionName == "RangeError" && messageString.contains("Maximum call st
ack size exceeded")) { |
| 262 exceptionState.throwDOMException(V8RangeError, messageString); |
| 263 exceptionState.throwIfNeeded(); |
| 264 return; |
| 265 } |
| 266 |
257 fprintf(stderr, "Private script error: %s was thrown.\n", exceptionName.utf8
().data()); | 267 fprintf(stderr, "Private script error: %s was thrown.\n", exceptionName.utf8
().data()); |
258 dumpV8Message(tryCatchMessage); | 268 dumpV8Message(tryCatchMessage); |
259 RELEASE_ASSERT_NOT_REACHED(); | 269 RELEASE_ASSERT_NOT_REACHED(); |
260 } | 270 } |
261 | 271 |
262 } // namespace blink | 272 } // namespace blink |
OLD | NEW |