summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/WorkerScriptController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/v8/WorkerScriptController.cpp')
-rw-r--r--WebCore/bindings/v8/WorkerScriptController.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/WebCore/bindings/v8/WorkerScriptController.cpp b/WebCore/bindings/v8/WorkerScriptController.cpp
index b3ede11..f2311bf 100644
--- a/WebCore/bindings/v8/WorkerScriptController.cpp
+++ b/WebCore/bindings/v8/WorkerScriptController.cpp
@@ -40,6 +40,7 @@
#include "ScriptValue.h"
#include "DOMTimer.h"
#include "V8DOMMap.h"
+#include "V8Proxy.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
#include "WorkerObjectProxy.h"
@@ -61,21 +62,27 @@ WorkerScriptController::~WorkerScriptController()
ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
+ return evaluate(sourceCode, 0);
+}
+
+ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ScriptValue* exception)
+{
{
MutexLocker lock(m_sharedDataMutex);
if (m_executionForbidden)
return ScriptValue();
}
- v8::Local<v8::Value> result = m_proxy->evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startLine() - 1);
- m_workerContext->thread()->workerObjectProxy().reportPendingActivity(m_workerContext->hasPendingActivity());
- return ScriptValue();
-}
+ WorkerContextExecutionState state;
+ ScriptValue result = m_proxy->evaluate(sourceCode.source(), sourceCode.url().string(), sourceCode.startLine() - 1, &state);
+ if (state.hadException) {
+ if (exception)
+ *exception = state.exception;
+ else
+ m_workerContext->reportException(state.errorMessage, state.lineNumber, state.sourceURL);
+ }
-ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ScriptValue* /* exception */)
-{
- // FIXME: Need to return an exception.
- return evaluate(sourceCode);
+ return result;
}
void WorkerScriptController::forbidExecution()
@@ -85,9 +92,9 @@ void WorkerScriptController::forbidExecution()
m_executionForbidden = true;
}
-void WorkerScriptController::setException(ScriptValue /* exception */)
+void WorkerScriptController::setException(ScriptValue exception)
{
- notImplemented();
+ throwError(*exception.v8Value());
}
} // namespace WebCore