| Index: third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp b/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp
|
| index 8d4873af01c1476e750837de65dcbba650261e6a..d766a75057ce9ccea677efcd91801854f19d7242 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp
|
| @@ -131,13 +131,39 @@ bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
|
| return canAccessFrame(isolate, accessingWindow, frame->securityContext()->getSecurityOrigin(), frame->domWindow(), reportingOption);
|
| }
|
|
|
| -bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWindow* accessingWindow, const MainThreadWorkletGlobalScope* target, SecurityReportingOption reportingOption)
|
| +bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, v8::Local<v8::Context> context, const ExecutionContext* executionContext, const MainThreadWorkletGlobalScope* workletGlobalScope, SecurityReportingOption reportingOption)
|
| {
|
| - ASSERT(target);
|
| - const Frame* frame = target->frame();
|
| - if (!frame || !frame->securityContext())
|
| + DCHECK(executionContext);
|
| + DOMWindow* domWindow = toDOMWindow(context);
|
| + if (executionContext->isMainThreadWorkletGlobalScope()) {
|
| + Frame* callingFrame = toMainThreadWorkletGlobalScope(executionContext)->frame();
|
| + domWindow = callingFrame ? callingFrame->domWindow() : nullptr;
|
| + }
|
| +
|
| + DCHECK(workletGlobalScope);
|
| + const Frame* workletGlobalScopeFrame = workletGlobalScope->frame();
|
| + if (!workletGlobalScopeFrame || !workletGlobalScopeFrame->securityContext())
|
| return false;
|
| - return canAccessFrame(isolate, accessingWindow, frame->securityContext()->getSecurityOrigin(), frame->domWindow(), reportingOption);
|
| +
|
| + return domWindow && canAccessFrame(isolate, toLocalDOMWindow(domWindow), workletGlobalScopeFrame->securityContext()->getSecurityOrigin(), workletGlobalScopeFrame->domWindow(), reportingOption);
|
| +}
|
| +
|
| +bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, v8::Local<v8::Context> calling, v8::Local<v8::Context> target, SecurityReportingOption reportingOption)
|
| +{
|
| + ExecutionContext* targetExecutionContext = toExecutionContext(target);
|
| + DCHECK(targetExecutionContext);
|
| +
|
| + ExecutionContext* callingExecutionContext = toExecutionContext(calling);
|
| + DCHECK(callingExecutionContext);
|
| +
|
| + if (targetExecutionContext->isMainThreadWorkletGlobalScope())
|
| + return shouldAllowAccessTo(isolate, calling, callingExecutionContext, toMainThreadWorkletGlobalScope(targetExecutionContext), DoNotReportSecurityError);
|
| +
|
| + if (callingExecutionContext->isMainThreadWorkletGlobalScope())
|
| + return shouldAllowAccessTo(isolate, target, targetExecutionContext, toMainThreadWorkletGlobalScope(callingExecutionContext), DoNotReportSecurityError);
|
| +
|
| + DOMWindow* window = toDOMWindow(target);
|
| + return window && shouldAllowAccessTo(isolate, toLocalDOMWindow(toDOMWindow(calling)), window, DoNotReportSecurityError);
|
| }
|
|
|
| bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWindow* accessingWindow, const Node* target, ExceptionState& exceptionState)
|
|
|