Reviewed by Sam.
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Dec 2007 22:20:18 +0000 (22:20 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Dec 2007 22:20:18 +0000 (22:20 +0000)
        ASSERT in JavaScriptCore while viewing WICD test case
        http://bugs.webkit.org/show_bug.cgi?id=16626

        * kjs/nodes.cpp:
        (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place

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

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/nodes.cpp
LayoutTests/ChangeLog
LayoutTests/fast/js/for-in-exeception-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/for-in-exeception.html [new file with mode: 0644]
LayoutTests/fast/js/resources/for-in-exeception.js [new file with mode: 0644]

index ecfd40bb2ae6f08d1f3488bbfc46a935b8ba8c5c..45d7de6dcd9f81231599be5ed257fa6b4a68b95a 100644 (file)
@@ -1,3 +1,13 @@
+2007-12-27  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Sam.
+
+        ASSERT in JavaScriptCore while viewing WICD test case
+        http://bugs.webkit.org/show_bug.cgi?id=16626
+        
+        * kjs/nodes.cpp:
+        (KJS::ForInNode::execute): move KJS_CHECK_EXCEPTION to proper place
+
 2007-12-26  Jan Michael Alonzo  <jmalonzo@unpluggable.com>
 
         Reviewed by Alp Toker.
index d805155457f6e91b456fcc0f6c2651b531c9b695..d48f9e7ca363bb8433b8ccb29082dcf7c8f4377e 100644 (file)
@@ -3840,13 +3840,13 @@ JSValue* ForInNode::execute(ExecState* exec)
   }
 
   JSValue* e = expr->evaluate(exec);
+  KJS_CHECKEXCEPTION
 
   // For Null and Undefined, we want to make sure not to go through
   // the loop at all, because toObject will throw an exception.
   if (e->isUndefinedOrNull())
     return exec->setNormalCompletion();
 
-  KJS_CHECKEXCEPTION
   JSObject* v = e->toObject(exec);
   PropertyNameArray propertyNames;
   v->getPropertyNames(exec, propertyNames);
index 3abe29d0f6d73d85fba71f7a5d86dde5805c0993..a0981edebfd9563e800e4deaa5b5604328c39bb8 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-27  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Sam.
+        
+        ASSERT in JavaScriptCore while viewing WICD test case
+        http://bugs.webkit.org/show_bug.cgi?id=16626
+
+        * fast/js/for-in-exeception-expected.txt: Added.
+        * fast/js/for-in-exeception.html: Added.
+        * fast/js/resources/for-in-exception.js: Added.
+
 2007-12-27  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Alice Liu.
diff --git a/LayoutTests/fast/js/for-in-exeception-expected.txt b/LayoutTests/fast/js/for-in-exeception-expected.txt
new file mode 100644 (file)
index 0000000..6b27aed
--- /dev/null
@@ -0,0 +1,12 @@
+Test for (foo in somethingWhichThrows) to catch ASSERT
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test(throwUndefinedException) is undefined.
+PASS test(throwNullException) is undefined.
+PASS test(throwStringException) threw exception PASSED.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/for-in-exeception.html b/LayoutTests/fast/js/for-in-exeception.html
new file mode 100644 (file)
index 0000000..3629589
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/for-in-exeception.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/for-in-exeception.js b/LayoutTests/fast/js/resources/for-in-exeception.js
new file mode 100644 (file)
index 0000000..7f6ee17
--- /dev/null
@@ -0,0 +1,25 @@
+description('Test for (foo in somethingWhichThrows) to catch ASSERT');
+
+function throwNullException() {
+  throw null;
+}
+
+function throwUndefinedException() {
+  throw undefined;
+}
+
+function throwStringException() {
+  throw "PASSED"
+}
+
+function test(func) {
+  for (var foo in func()) {
+    testFailed("Shoud not be reached");
+  }
+}
+
+shouldBeUndefined("test(throwUndefinedException)");
+shouldBeUndefined("test(throwNullException)");
+shouldThrow("test(throwStringException)");
+
+var successfullyParsed = true;