diff options
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | webkit/port/bindings/v8/V8WorkerCustom.cpp | 6 | ||||
-rw-r--r-- | webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp | 12 | ||||
-rw-r--r-- | webkit/port/bindings/v8/WorkerContextExecutionProxy.h | 4 |
4 files changed, 23 insertions, 1 deletions
@@ -19,7 +19,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@167", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@11916", + "/trunk/deps/third_party/WebKit@11939", "src/third_party/icu38": "/trunk/deps/third_party/icu38@11496", diff --git a/webkit/port/bindings/v8/V8WorkerCustom.cpp b/webkit/port/bindings/v8/V8WorkerCustom.cpp index 7426383..1f7e5fe 100644 --- a/webkit/port/bindings/v8/V8WorkerCustom.cpp +++ b/webkit/port/bindings/v8/V8WorkerCustom.cpp @@ -42,12 +42,18 @@ #include "V8HTMLDocument.h" #include "V8ObjectEventListener.h" #include "Worker.h" +#include "WorkerContextExecutionProxy.h" namespace WebCore { CALLBACK_FUNC_DECL(WorkerConstructor) { INC_STATS(L"DOM.Worker.Constructor"); + if (!WorkerContextExecutionProxy::isWebWorkersEnabled()) { + V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Worker is not enabled."); + return v8::Undefined(); + } + if (!args.IsConstructCall()) { V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "DOM object constructor cannot be called as a function."); diff --git a/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp b/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp index c7e200f..a73d828 100644 --- a/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp @@ -47,6 +47,18 @@ namespace WebCore { +static bool workerEnabled = false; + +bool WorkerContextExecutionProxy::isWebWorkersEnabled() +{ + return workerEnabled; +} + +void WorkerContextExecutionProxy::enableWebWorkers(bool value) +{ + workerEnabled = true; +} + WorkerContextExecutionProxy::WorkerContextExecutionProxy(WorkerContext* workerContext) : m_workerContext(workerContext) , m_recursion(0) diff --git a/webkit/port/bindings/v8/WorkerContextExecutionProxy.h b/webkit/port/bindings/v8/WorkerContextExecutionProxy.h index b34f92d..9fb3a0c 100644 --- a/webkit/port/bindings/v8/WorkerContextExecutionProxy.h +++ b/webkit/port/bindings/v8/WorkerContextExecutionProxy.h @@ -83,6 +83,10 @@ namespace WebCore { static v8::Handle<v8::Value> EventTargetToV8Object(EventTarget* target); static v8::Handle<v8::Value> WorkerContextToV8Object(WorkerContext* wc); + // Enables HTML5 worker support. + static void enableWebWorkers(bool); + static bool isWebWorkersEnabled(); + private: void initContextIfNeeded(); void dispose(); |