Title: [154429] trunk
Revision
154429
Author
[email protected]
Date
2013-08-21 16:34:39 -0700 (Wed, 21 Aug 2013)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=119900
Exception in global setter doesn't unwind correctly

Patch by Yi Shen <[email protected]> on 2013-08-21
Reviewed by Geoffrey Garen.

Source/_javascript_Core:

Call VM_THROW_EXCEPTION_AT_END in op_put_to_scope if the setter throws exception.

* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):

LayoutTests:

Add test for calling global setter which throws exception.

* fast/js/script-tests/throw-exception-in-global-setter.js: Added.
(g):
* fast/js/throw-exception-in-global-setter-expected.txt: Added.
* fast/js/throw-exception-in-global-setter.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154428 => 154429)


--- trunk/LayoutTests/ChangeLog	2013-08-21 23:27:23 UTC (rev 154428)
+++ trunk/LayoutTests/ChangeLog	2013-08-21 23:34:39 UTC (rev 154429)
@@ -1,3 +1,17 @@
+2013-08-21  Yi Shen  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=119900
+        Exception in global setter doesn't unwind correctly
+
+        Reviewed by Geoffrey Garen.
+
+        Add test for calling global setter which throws exception.
+
+        * fast/js/script-tests/throw-exception-in-global-setter.js: Added.
+        (g):
+        * fast/js/throw-exception-in-global-setter-expected.txt: Added.
+        * fast/js/throw-exception-in-global-setter.html: Added.
+
 2013-08-21  Alexey Proskuryakov  <[email protected]>
 
         http/tests/cookies/simple-cookies-expired.html sometimes fails on Lion Intel Release (Tests)

Added: trunk/LayoutTests/fast/js/script-tests/throw-exception-in-global-setter.js (0 => 154429)


--- trunk/LayoutTests/fast/js/script-tests/throw-exception-in-global-setter.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/throw-exception-in-global-setter.js	2013-08-21 23:34:39 UTC (rev 154429)
@@ -0,0 +1,11 @@
+description('Test for <a href="" 119900</a>: Exception in global setter doesn\'t unwind correctly.');
+
+debug("Passed if no assertion failure.");
+
+this.__defineSetter__("setterThrowsException", function throwEmptyException(){ throw ""});
+
+function callSetter() {
+    setterThrowsException = 0;
+}
+
+for (var i = 0; i < 100; ++i) try { callSetter() } catch(e) { }

Added: trunk/LayoutTests/fast/js/throw-exception-in-global-setter-expected.txt (0 => 154429)


--- trunk/LayoutTests/fast/js/throw-exception-in-global-setter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/throw-exception-in-global-setter-expected.txt	2013-08-21 23:34:39 UTC (rev 154429)
@@ -0,0 +1,10 @@
+Test for bug 119900: Exception in global setter doesn't unwind correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Passed if no assertion failure.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/throw-exception-in-global-setter.html (0 => 154429)


--- trunk/LayoutTests/fast/js/throw-exception-in-global-setter.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/throw-exception-in-global-setter.html	2013-08-21 23:34:39 UTC (rev 154429)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (154428 => 154429)


--- trunk/Source/_javascript_Core/ChangeLog	2013-08-21 23:27:23 UTC (rev 154428)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-08-21 23:34:39 UTC (rev 154429)
@@ -1,3 +1,15 @@
+2013-08-21  Yi Shen  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=119900
+        Exception in global setter doesn't unwind correctly
+
+        Reviewed by Geoffrey Garen.
+
+        Call VM_THROW_EXCEPTION_AT_END in op_put_to_scope if the setter throws exception.
+
+        * jit/JITStubs.cpp:
+        (JSC::DEFINE_STUB_FUNCTION):
+
 2013-08-21  Mark Hahnenberg  <[email protected]>
 
         Rename/refactor setButterfly/setStructure

Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (154428 => 154429)


--- trunk/Source/_javascript_Core/jit/JITStubs.cpp	2013-08-21 23:27:23 UTC (rev 154428)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp	2013-08-21 23:34:39 UTC (rev 154429)
@@ -2268,6 +2268,11 @@
 
     PutPropertySlot slot(codeBlock->isStrictMode());
     scope->methodTable()->put(scope, exec, ident, value, slot);
+    
+    if (exec->vm().exception) {
+        VM_THROW_EXCEPTION_AT_END();
+        return;
+    }
 
     // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.
     if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to