| Index: Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
|
| diff --git a/Source/bindings/v8/custom/V8WorkerContextCustom.cpp b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
|
| similarity index 75%
|
| rename from Source/bindings/v8/custom/V8WorkerContextCustom.cpp
|
| rename to Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
|
| index ef35e74091739a830505799d13e998c77e8ab9f1..64c095295c2745f3ec4eed602b2a28149152f93c 100644
|
| --- a/Source/bindings/v8/custom/V8WorkerContextCustom.cpp
|
| +++ b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
|
| @@ -30,25 +30,25 @@
|
|
|
| #include "config.h"
|
|
|
| -#include "V8WorkerContext.h"
|
| +#include "V8WorkerGlobalScope.h"
|
|
|
| #include "bindings/v8/ScheduledAction.h"
|
| #include "bindings/v8/V8Binding.h"
|
| #include "bindings/v8/V8Utilities.h"
|
| -#include "bindings/v8/V8WorkerContextEventListener.h"
|
| +#include "bindings/v8/V8WorkerGlobalScopeEventListener.h"
|
| #include "bindings/v8/WorkerScriptController.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/inspector/ScriptCallStack.h"
|
| #include "core/page/ContentSecurityPolicy.h"
|
| #include "core/page/DOMTimer.h"
|
| -#include "core/workers/WorkerContext.h"
|
| +#include "core/workers/WorkerGlobalScope.h"
|
| #include "modules/websockets/WebSocket.h"
|
|
|
| namespace WebCore {
|
|
|
| void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool singleShot)
|
| {
|
| - WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
|
| + WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(args.Holder());
|
|
|
| int argumentCount = args.Length();
|
| if (argumentCount < 1)
|
| @@ -58,20 +58,20 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
|
| int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
|
| int timerId;
|
|
|
| - WorkerScriptController* script = workerContext->script();
|
| + WorkerScriptController* script = workerGlobalScope->script();
|
| if (!script)
|
| return;
|
|
|
| v8::Handle<v8::Context> v8Context = script->context();
|
| if (function->IsString()) {
|
| - if (ContentSecurityPolicy* policy = workerContext->contentSecurityPolicy()) {
|
| + if (ContentSecurityPolicy* policy = workerGlobalScope->contentSecurityPolicy()) {
|
| if (!policy->allowEval()) {
|
| v8SetReturnValue(args, 0);
|
| return;
|
| }
|
| }
|
| WTF::String stringFunction = toWebCoreString(function);
|
| - timerId = DOMTimer::install(workerContext, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerContext->url(), args.GetIsolate())), timeout, singleShot);
|
| + timerId = DOMTimer::install(workerGlobalScope, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerGlobalScope->url(), args.GetIsolate())), timeout, singleShot);
|
| } else if (function->IsFunction()) {
|
| size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
|
| v8::Local<v8::Value>* params = 0;
|
| @@ -84,14 +84,14 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
|
| OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params, args.GetIsolate()));
|
| // FIXME: We should use a OwnArrayPtr for params.
|
| delete [] params;
|
| - timerId = DOMTimer::install(workerContext, action.release(), timeout, singleShot);
|
| + timerId = DOMTimer::install(workerGlobalScope, action.release(), timeout, singleShot);
|
| } else
|
| return;
|
|
|
| v8SetReturnValue(args, timerId);
|
| }
|
|
|
| -void V8WorkerContext::importScriptsMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| +void V8WorkerGlobalScope::importScriptsMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| {
|
| if (!args.Length())
|
| return;
|
| @@ -104,29 +104,29 @@ void V8WorkerContext::importScriptsMethodCustom(const v8::FunctionCallbackInfo<v
|
| urls.append(toWebCoreString(scriptUrl));
|
| }
|
|
|
| - WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
|
| + WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(args.Holder());
|
|
|
| ExceptionCode ec = 0;
|
| - workerContext->importScripts(urls, ec);
|
| + workerGlobalScope->importScripts(urls, ec);
|
|
|
| if (!ec)
|
| return;
|
| setDOMException(ec, args.GetIsolate());
|
| }
|
|
|
| -void V8WorkerContext::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| +void V8WorkerGlobalScope::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| {
|
| return SetTimeoutOrInterval(args, true);
|
| }
|
|
|
| -void V8WorkerContext::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| +void V8WorkerGlobalScope::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| {
|
| return SetTimeoutOrInterval(args, false);
|
| }
|
|
|
| -v8::Handle<v8::Value> toV8(WorkerContext* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Value> toV8(WorkerGlobalScope* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| - // Notice that we explicitly ignore creationContext because the WorkerContext is its own creationContext.
|
| + // Notice that we explicitly ignore creationContext because the WorkerGlobalScope is its own creationContext.
|
|
|
| if (!impl)
|
| return v8NullWithCheck(isolate);
|
| @@ -140,7 +140,7 @@ v8::Handle<v8::Value> toV8(WorkerContext* impl, v8::Handle<v8::Object> creationC
|
| return global;
|
| }
|
|
|
| -v8::Handle<v8::Value> toV8ForMainWorld(WorkerContext* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Value> toV8ForMainWorld(WorkerGlobalScope* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| return toV8(impl, creationContext, isolate);
|
| }
|
|
|