2009-06-25 Jian Li <jianli@chromium.org>
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jun 2009 21:54:04 +0000 (21:54 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jun 2009 21:54:04 +0000 (21:54 +0000)
        Reviewed by Dimitri Glazkov.

        Bug 26701: Implement the missing code for "FIXME: Need to return an
        exception" in WorkerScriptController::evaluate for v8 bindings.
        https://bugs.webkit.org/show_bug.cgi?id=26701

        * bindings/v8/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::evaluate):

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

WebCore/ChangeLog
WebCore/bindings/v8/WorkerScriptController.cpp

index 164a668..5c5cc9d 100644 (file)
@@ -1,3 +1,14 @@
+2009-06-25  Jian Li  <jianli@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Bug 26701: Implement the missing code for "FIXME: Need to return an
+        exception" in WorkerScriptController::evaluate for v8 bindings.
+        https://bugs.webkit.org/show_bug.cgi?id=26701
+
+        * bindings/v8/WorkerScriptController.cpp:
+        (WebCore::WorkerScriptController::evaluate):
+
 2009-06-25  Nate Chapin  <japhet@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index b3ede11..d418184 100644 (file)
@@ -72,10 +72,16 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)
     return ScriptValue();
 }
 
-ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ScriptValue* /* exception */)
+ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ScriptValue* exception)
 {
-    // FIXME: Need to return an exception.
-    return evaluate(sourceCode);
+    v8::TryCatch exceptionCatcher;
+    ScriptValue result = evaluate(sourceCode);
+    if (exceptionCatcher.HasCaught()) {
+        *exception = ScriptValue(exceptionCatcher.Exception());
+        throwError(exceptionCatcher.Exception());
+        return ScriptValue();
+    } else
+        return result;
 }
 
 void WorkerScriptController::forbidExecution()