Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 2706813002: CHECK correct context usage in V8ScriptRunner::callFunction (Closed)
Patch Set: updates Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
index 5391482d81548700912e7efb8ea3a13cb71fd54c..41c662e5b9ff894869551505b8fe012d73ec79c7 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
@@ -25,6 +25,7 @@
#include "bindings/core/v8/V8ScriptRunner.h"
+#include "bindings/core/v8/BindingSecurity.h"
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/ScriptStreamer.h"
#include "bindings/core/v8/V8Binding.h"
@@ -32,6 +33,7 @@
#include "bindings/core/v8/V8ThrowException.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
+#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/PerformanceMonitor.h"
#include "core/inspector/InspectorTraceEvents.h"
@@ -630,8 +632,9 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(
int argc,
v8::Local<v8::Value> args[],
v8::Isolate* isolate) {
- ScopedFrameBlamer frameBlamer(
- context->isDocument() ? toDocument(context)->frame() : nullptr);
+ LocalFrame* frame =
+ context->isDocument() ? toDocument(context)->frame() : nullptr;
+ ScopedFrameBlamer frameBlamer(frame);
TRACE_EVENT0("v8", "v8.callFunction");
int depth = v8::MicrotasksScope::GetCurrentDepth(isolate);
@@ -649,6 +652,11 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(
TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data",
InspectorFunctionCallEvent::data(context, function));
+ if (frame) {
+ CHECK(BindingSecurity::shouldAllowAccessToFrame(
+ toDOMWindow(function->CreationContext())->toLocalDOMWindow(), frame,
+ BindingSecurity::ErrorReportOption::DoNotReport));
+ }
CHECK(!ThreadState::current()->isWrapperTracingForbidden());
v8::MicrotasksScope microtasksScope(isolate,
v8::MicrotasksScope::kRunMicrotasks);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698