51 lines
2.7 KiB
Diff
51 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Anonymous <anonymous@electronjs.org>
|
|
Date: Thu, 20 Sep 2018 17:45:11 -0700
|
|
Subject: blink_world_context.patch
|
|
|
|
|
|
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
|
|
index 98c18915bff9ac57fa99f07f3213c4b75795e47f..d696c5b9cf3a31233b91d395bea1ac389e182192 100644
|
|
--- a/third_party/blink/public/web/web_local_frame.h
|
|
+++ b/third_party/blink/public/web/web_local_frame.h
|
|
@@ -343,6 +343,9 @@ class WebLocalFrame : public WebFrame {
|
|
// be calling this API.
|
|
virtual v8::Local<v8::Context> MainWorldScriptContext() const = 0;
|
|
|
|
+ virtual v8::Local<v8::Context> WorldScriptContext(
|
|
+ v8::Isolate* isolate, int world_id) const = 0;
|
|
+
|
|
// Executes script in the context of the current page and returns the value
|
|
// that the script evaluated to with callback. Script execution can be
|
|
// suspend.
|
|
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
|
index d87ab3ddb5e85f820fc2deb03a245bddd74f0c38..8981f9b0101de4e99e2b5585bb05fa82464b34ff 100644
|
|
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
|
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
|
@@ -880,6 +880,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
|
|
return MainWorldScriptContext()->Global();
|
|
}
|
|
|
|
+v8::Local<v8::Context> WebLocalFrameImpl::WorldScriptContext(
|
|
+ v8::Isolate* isolate, int world_id) const {
|
|
+ scoped_refptr<DOMWrapperWorld> world = DOMWrapperWorld::EnsureIsolatedWorld(
|
|
+ isolate, world_id);
|
|
+ return ToScriptState(GetFrame(), *world)->GetContext();
|
|
+}
|
|
+
|
|
bool WebFrame::ScriptCanAccess(WebFrame* target) {
|
|
return BindingSecurity::ShouldAllowAccessToFrame(
|
|
CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()),
|
|
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
|
index 7e2986c37ed7946a180c2c61adeb1047f7e39291..01ec09ad30949e16d1e037124cd3d82065d3d4f6 100644
|
|
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
|
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
|
@@ -170,6 +170,8 @@ class CORE_EXPORT WebLocalFrameImpl final
|
|
int argc,
|
|
v8::Local<v8::Value> argv[]) override;
|
|
v8::Local<v8::Context> MainWorldScriptContext() const override;
|
|
+ v8::Local<v8::Context> WorldScriptContext(
|
|
+ v8::Isolate* isolate, int world_id) const override;
|
|
void RequestExecuteScriptAndReturnValue(const WebScriptSource&,
|
|
bool user_gesture,
|
|
WebScriptExecutionCallback*) override;
|