summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/port/bindings/v8/V8WorkerCustom.cpp6
-rw-r--r--webkit/port/bindings/v8/WorkerContextExecutionProxy.cpp12
-rw-r--r--webkit/port/bindings/v8/WorkerContextExecutionProxy.h4
3 files changed, 22 insertions, 0 deletions
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();