electron/patches/common/chromium/blink_world_context.patch

52 lines
2.6 KiB
Diff
Raw Normal View History

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
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
2019-05-13 18:49:01 +00:00
index fa0c5f7ad8e20b429b697de0f81fe84199c09a87..1bacc981007b4706dc5bd775f96ac4fccb12cdaf 100644
--- a/third_party/blink/public/web/web_local_frame.h
+++ b/third_party/blink/public/web/web_local_frame.h
2019-05-13 18:49:01 +00:00
@@ -351,6 +351,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
2019-05-13 18:49:01 +00:00
index bed103526f62358fa98973ba11bc3e1d9688c159..fcfc4948bc723864ac39cfef34ad28d3a673c0e2 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
2019-05-13 18:49:01 +00:00
@@ -861,6 +861,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
2019-05-13 18:49:01 +00:00
index 8b5916d086f1de3467a8579aebbb910c6568256f..cdea9b68698713cd635f9b1e0c54e1efca76cd51 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
2019-05-13 18:49:01 +00:00
@@ -146,6 +146,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;
v8::Local<v8::Object> GlobalProxy() const override;
2018-09-21 00:30:26 +00:00
void StartReload(WebFrameLoadType) override;
void ReloadImage(const WebNode&) override;