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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/PrivateScriptRunner.cpp
diff --git a/Source/bindings/core/v8/PrivateScriptRunner.cpp b/Source/bindings/core/v8/PrivateScriptRunner.cpp
index 04ac688e9e1e0375e228fbfc013d2cfb2f17f8c2..1295dbfe00062bb7261278c57f5d951d27ad9c57 100644
--- a/Source/bindings/core/v8/PrivateScriptRunner.cpp
+++ b/Source/bindings/core/v8/PrivateScriptRunner.cpp
@@ -254,6 +254,16 @@ void PrivateScriptRunner::rethrowExceptionInPrivateScript(v8::Isolate* isolate,
return;
}
+ // Standard JS errors thrown by a private script are treated as real errors
+ // of the private script and crash the renderer, except for a stack overflow
+ // error. A stack overflow error can happen in a valid private script
+ // if user's script can create a recursion that involves the private script.
+ if (exceptionName == "RangeError" && messageString.contains("Maximum call stack size exceeded")) {
+ exceptionState.throwDOMException(V8RangeError, messageString);
+ exceptionState.throwIfNeeded();
+ return;
+ }
+
fprintf(stderr, "Private script error: %s was thrown.\n", exceptionName.utf8().data());
dumpV8Message(tryCatchMessage);
RELEASE_ASSERT_NOT_REACHED();
« 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