From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Anonymous 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 e2f071b74c17c4d8854a66c461e6f3fa34ee5eaf..03f725429382a3b2ebc9e73600dc1b92168592b1 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h @@ -466,6 +466,9 @@ class WebLocalFrame : public WebFrame { // be calling this API. virtual v8::Local MainWorldScriptContext() const = 0; + virtual v8::Local 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 fbadba8e0f240ce48ba26ad01573a97203a123ab..ac062b3967e61def6484bb266b55e6006bb0fcdd 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 @@ -885,6 +885,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { return MainWorldScriptContext()->Global(); } +v8::Local WebLocalFrameImpl::WorldScriptContext( + v8::Isolate* isolate, int world_id) const { + scoped_refptr 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 9b07d3bc3e50775225fafc020f6264c6b3f4cd15..8420f56040c87643365d40bd17ff6071e81eb4f8 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 @@ -146,6 +146,8 @@ class CORE_EXPORT WebLocalFrameImpl final int argc, v8::Local argv[]) override; v8::Local MainWorldScriptContext() const override; + v8::Local WorldScriptContext( + v8::Isolate* isolate, int world_id) const override; v8::Local GlobalProxy() const override; void StartReload(WebFrameLoadType) override; void ReloadImage(const WebNode&) override;