Send document-start/end to the right context when contextIsolation=true (#12738)
This commit is contained in:
parent
022b6973b2
commit
118da36b52
3 changed files with 6 additions and 5 deletions
|
@ -218,8 +218,9 @@ node::Environment* AtomRendererClient::GetEnvironment(
|
||||||
if (injected_frames_.find(render_frame) == injected_frames_.end())
|
if (injected_frames_.find(render_frame) == injected_frames_.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
|
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
|
||||||
node::Environment* env = node::Environment::GetCurrent(
|
auto context =
|
||||||
render_frame->GetWebFrame()->MainWorldScriptContext());
|
GetContext(render_frame->GetWebFrame(), v8::Isolate::GetCurrent());
|
||||||
|
node::Environment* env = node::Environment::GetCurrent(context);
|
||||||
if (environments_.find(env) == environments_.end())
|
if (environments_.find(env) == environments_.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return env;
|
return env;
|
||||||
|
|
|
@ -226,7 +226,7 @@ void RendererClientBase::AddSupportedKeySystems(
|
||||||
|
|
||||||
v8::Local<v8::Context> RendererClientBase::GetContext(
|
v8::Local<v8::Context> RendererClientBase::GetContext(
|
||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
v8::Isolate* isolate) {
|
v8::Isolate* isolate) const {
|
||||||
if (isolated_world())
|
if (isolated_world())
|
||||||
return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
|
return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,11 +27,11 @@ class RendererClientBase : public content::ContentRendererClient {
|
||||||
virtual void DidClearWindowObject(content::RenderFrame* render_frame);
|
virtual void DidClearWindowObject(content::RenderFrame* render_frame);
|
||||||
virtual void SetupMainWorldOverrides(v8::Handle<v8::Context> context) = 0;
|
virtual void SetupMainWorldOverrides(v8::Handle<v8::Context> context) = 0;
|
||||||
|
|
||||||
bool isolated_world() { return isolated_world_; }
|
bool isolated_world() const { return isolated_world_; }
|
||||||
|
|
||||||
// Get the context that the Electron API is running in.
|
// Get the context that the Electron API is running in.
|
||||||
v8::Local<v8::Context> GetContext(blink::WebLocalFrame* frame,
|
v8::Local<v8::Context> GetContext(blink::WebLocalFrame* frame,
|
||||||
v8::Isolate* isolate);
|
v8::Isolate* isolate) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddRenderBindings(v8::Isolate* isolate,
|
void AddRenderBindings(v8::Isolate* isolate,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue