2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: Anonymous <anonymous@electronjs.org>
|
|
|
|
Date: Thu, 20 Sep 2018 17:45:11 -0700
|
|
|
|
Subject: blink_world_context.patch
|
|
|
|
|
|
|
|
|
2018-09-14 18:03:43 +00:00
|
|
|
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
|
2019-08-02 23:56:46 +00:00
|
|
|
index f62985f20f9e89ec663141d09ccae7113f11124e..911e5601a3800e94720dcdc8c91cfeb0d7d72443 100644
|
2018-09-14 18:03:43 +00:00
|
|
|
--- a/third_party/blink/public/web/web_local_frame.h
|
|
|
|
+++ b/third_party/blink/public/web/web_local_frame.h
|
2019-07-03 01:22:09 +00:00
|
|
|
@@ -357,6 +357,9 @@ class WebLocalFrame : public WebFrame {
|
2018-09-14 18:03:43 +00:00
|
|
|
// 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.
|
2018-09-14 05:02:16 +00:00
|
|
|
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
|
2019-08-02 23:56:46 +00:00
|
|
|
index 48d73a37562595ca7f97d839c25df9c58f8efe32..b724c55007baa3c8e791bc7a4816d20861d26e65 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
|
|
|
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
|
2019-08-02 23:56:46 +00:00
|
|
|
@@ -866,6 +866,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
|
2018-09-14 05:02:16 +00:00
|
|
|
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
|
2019-08-02 23:56:46 +00:00
|
|
|
index bad60721541dc8b8f2552f3ba3ef720949eb2baa..b37439a62fd56baa56ca69394000976a3fbb8674 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
|
|
|
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
|
2019-07-24 22:58:51 +00:00
|
|
|
@@ -149,6 +149,8 @@ class CORE_EXPORT WebLocalFrameImpl final
|
2018-09-14 05:02:16 +00:00
|
|
|
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;
|
|
|
|
v8::Local<v8::Object> GlobalProxy() const override;
|
2018-09-21 00:30:26 +00:00
|
|
|
void StartReload(WebFrameLoadType) override;
|
2018-09-14 18:03:43 +00:00
|
|
|
void ReloadImage(const WebNode&) override;
|