2018-10-24 11:24:11 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-20 17:30:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								From: Anonymous <anonymous@electronjs.org>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Date: Thu, 20 Sep 2018 17:45:11 -0700
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Subject: blink_world_context.patch
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-13 09:18:45 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								This exposes a method for obtaining a reference to an isolated world, which is
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								otherwise not available in the Blink API.
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-20 17:30:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-14 11:03:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-20 17:25:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								index afbed9686b4fccd43991f16be15a261486c127b9..80398b633bed8cd7d04f1ecb44abc306131fa977 100644
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-14 11:03:43 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								--- a/third_party/blink/public/web/web_local_frame.h
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+++ b/third_party/blink/public/web/web_local_frame.h
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-06 13:09:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -334,6 +334,9 @@ class WebLocalFrame : public WebFrame {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-14 11:03:43 -07: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-13 22:02:16 -07: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
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-20 17:25:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								index bef9aa2ebcebea5e57f67ac03a1b16f6b0bfaa97..5deb335845057b1fb4e051af91f926ffeb2dd270 100644
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 22:02:16 -07: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
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-20 17:25:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -925,6 +925,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 22:02:16 -07: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
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-20 17:25:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								index 7f031166c0e98c06a93b419e11e1b2b9989a8e4e..ca5eb27215f12d0c15d9cd4a5ecc121327977ba4 100644
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 22:02:16 -07: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
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-13 16:39:26 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -161,6 +161,8 @@ class CORE_EXPORT WebLocalFrameImpl final
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 22:02:16 -07: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;
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-28 18:12:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   void RequestExecuteScriptAndReturnValue(const WebScriptSource&,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                           bool user_gesture,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                           WebScriptExecutionCallback*) override;
							 |