From c5e067fc0c6f7b1a0e1ed53743857cac5ff48a81 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 17 Mar 2010 15:01:37 +0000 Subject: [PATCH] Cherry-pick WebKit change 56112 to add WORKERS guards to V8 bindings The motivation for this change is to allow us to disable workers on Android, because V8 on Android does not have the required locking. See http://trac.webkit.org/changeset/56112 Change-Id: Ieee214f4765af3188bbdc51c56f14883f6a6779c --- WebCore/bindings/v8/V8DOMWrapper.cpp | 4 ++++ WebCore/bindings/v8/V8Proxy.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp index d2ed659cc..0f96a74b7 100644 --- a/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -212,6 +212,7 @@ v8::Local V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType return getConstructorForContext(type, context); } +#if ENABLE(WORKERS) v8::Local V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, WorkerContext*) { WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve(); @@ -224,6 +225,7 @@ v8::Local V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType return getConstructorForContext(type, context); } +#endif void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalIndex, v8::Handle jsObject) { @@ -296,8 +298,10 @@ v8::Local V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI v8::Handle globalPrototype = v8::Handle::Cast(context->Global()->GetPrototype()); if (globalObjectPrototypeIsDOMWindow(globalPrototype)) proxy = V8Proxy::retrieve(V8DOMWindow::toNative(globalPrototype)->frame()); +#if ENABLE(WORKERS) else workerContext = V8WorkerContext::toNative(globalPrototype); +#endif } } diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 9b1fff5ef..85db55483 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -910,9 +910,11 @@ v8::Local toV8Context(ScriptExecutionContext* context, const WorldC if (context->isDocument()) { if (V8Proxy* proxy = V8Proxy::retrieve(context)) return worldContext.adjustedContext(proxy); +#if ENABLE(WORKERS) } else if (context->isWorkerContext()) { if (WorkerContextExecutionProxy* proxy = static_cast(context)->script()->proxy()) return proxy->context(); +#endif } return v8::Local(); } -- 2.11.0