Exception in global setter doesn't unwind correctly
Patch by Yi Shen <max.hong.shen@gmail.com> on 2013-08-21
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154429
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-08-21 Yi Shen <max.hong.shen@gmail.com>
+
+ 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 <ap@apple.com>
http/tests/cookies/simple-cookies-expired.html sometimes fails on Lion Intel Release (Tests)
--- /dev/null
+description('Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=119900">bug 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) { }
--- /dev/null
+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
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<script src="script-tests/throw-exception-in-global-setter.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
+2013-08-21 Yi Shen <max.hong.shen@gmail.com>
+
+ 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 <mhahnenberg@apple.com>
Rename/refactor setButterfly/setStructure
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) {