Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp |
| index d816d9b2a9353a8a749c8640f7e20a034d9c1352..4b8e6827c7aa62818d1e812053ad2e8da7c8651a 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp |
| @@ -701,6 +701,10 @@ LocalDOMWindow* callingDOMWindow(v8::Isolate* isolate) |
| return toLocalDOMWindow(toDOMWindow(context)); |
| } |
| +namespace { |
| +ExecutionContext* (*s_toExecutionContextForModules)(v8::Local<v8::Context>) = nullptr; |
| +} |
| + |
| ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) |
| { |
| if (context.IsEmpty()) |
| @@ -712,8 +716,13 @@ ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) |
| v8::Local<v8::Object> workerWrapper = V8WorkerGlobalScope::findInstanceInPrototypeChain(global, context->GetIsolate()); |
| if (!workerWrapper.IsEmpty()) |
| return V8WorkerGlobalScope::toImpl(workerWrapper)->executionContext(); |
| - // FIXME: Is this line of code reachable? |
| - return 0; |
| + RELEASE_ASSERT(s_toExecutionContextForModules); |
|
haraken
2016/01/12 00:38:49
This is a performance-sensitive path, so let's use
ikilpatrick
2016/01/12 04:11:24
Done.
|
| + return (*s_toExecutionContextForModules)(context); |
| +} |
| + |
| +void registerToExecutionContextForModules(ExecutionContext* (*toExecutionContextForModules)(v8::Local<v8::Context>)) |
| +{ |
| + s_toExecutionContextForModules = toExecutionContextForModules; |
| } |
| ExecutionContext* currentExecutionContext(v8::Isolate* isolate) |
| @@ -777,7 +786,7 @@ v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w |
| if (LocalFrame* frame = toDocument(context)->frame()) |
| return toV8Context(frame, world); |
| } else if (context->isWorkerGlobalScope()) { |
| - if (WorkerOrWorkletScriptController* script = toWorkerGlobalScope(context)->script()) { |
| + if (WorkerOrWorkletScriptController* script = toWorkerOrWorkletGlobalScope(context)->script()) { |
| if (script->scriptState()->contextIsValid()) |
| return script->scriptState()->context(); |
| } |