2008-06-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
authorcwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jun 2008 02:33:36 +0000 (02:33 +0000)
committercwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Jun 2008 02:33:36 +0000 (02:33 +0000)
        Reviewed by Sam.

        When executing a native call, check for an exception before writing the
        return value.

        JavaScriptCore:

        * VM/Machine.cpp:
        (KJS::Machine::privateExecute):

        LayoutTests:

        * fast/js/exception-sequencing-expected.txt:
        * fast/js/exception-sequencing.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34866 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/VM/Machine.cpp
LayoutTests/ChangeLog
LayoutTests/fast/js/exception-sequencing-expected.txt
LayoutTests/fast/js/exception-sequencing.html

index 9c2fa62..d195c18 100644 (file)
@@ -1,3 +1,13 @@
+2008-06-28  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Sam.
+
+        When executing a native call, check for an exception before writing the
+        return value.
+
+        * VM/Machine.cpp:
+        (KJS::Machine::privateExecute):
+
 2008-06-28  Mark Rowe  <mrowe@apple.com>
 
         Build fix.  Flag headers as private or public as is appropriate.
index 87cf714..2f89aa2 100644 (file)
@@ -2254,12 +2254,12 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
             ArgList args(reinterpret_cast<JSValue***>(&registerBase), registerOffset + firstArg + 1, argCount - 1);
 
             JSValue* returnValue = callData.native.function(exec, static_cast<JSObject*>(v), thisValue, args);
+            VM_CHECK_EXCEPTION();
 
             r[dst].u.jsValue = returnValue;
 
             if (*enabledProfilerReference)
                 (*enabledProfilerReference)->didExecute(exec, static_cast<JSObject*>(v));
-            VM_CHECK_EXCEPTION();
 
             ++vPC;
             NEXT_OPCODE;
index 7af1ff6..37866cb 100644 (file)
@@ -1,3 +1,12 @@
+2008-06-28  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Sam.
+
+        Add a test to check exception sequencing for native calls.
+
+        * fast/js/exception-sequencing-expected.txt:
+        * fast/js/exception-sequencing.html:
+
 2008-06-28  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler.
index 5877ec8..e137888 100644 (file)
@@ -159,5 +159,6 @@ PASS: nonThrowingIndexBase[throwingIndex] = valueForAssignment
 PASS: throwingIndexBase[nonThrowingIndexNoThrowProperty] = valueForAssignment
 PASS: throwingIndexBase[nonThrowingIndexThrowProperty] = valueForAssignment
 PASS: throwingIndexBase[throwingIndex] = valueForAssignment
-Passed 157 of 157 tests.
+PASS: Number.prototype.toString.call(false)
+Passed 158 of 158 tests.
 
index 492bb78..9e6f140 100644 (file)
@@ -747,6 +747,19 @@ createTestWithExecOrderTest("throwingIndexBase[nonThrowingIndexThrowProperty] =
 
 createTestWithExecOrderTest("throwingIndexBase[throwingIndex] = valueForAssignment", "throwingIndexBase, ***throw***")();
 
+testCount++;
+(function() {
+    executionOrder = "";
+    var result = true;
+    try {
+        result = Number.prototype.toString.call(false);
+    } catch (e) {
+        if (result == true)
+            pass("Number.prototype.toString.call(false)");
+        else
+            fail("Number.prototype.toString.call(false) writes to return destination before throwing an exception");
+    }
+})();
 
 log("Passed " + passCount + " of " + testCount + " tests.");
-</script>
\ No newline at end of file
+</script>