Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 553983007: Blink-in-JS: Allow a stackoverflow error thrown by private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/private_script_unittest-expected.txt ('k') | Source/core/testing/PrivateScriptTest.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698