fix: emit IPC event in correct context if isolation and sandbox enabled (#16352)

* fix: emit IPC event in correct context if isolation and sandbox enabled

IPC events were not being delivered to renderer processes when both
`contextIsolation` and `sandbox` were enabled. This is because the
`AtomSandboxedRenderFrameObserver` class was incorrectly using the
`MainWorldScriptContext`, rather than conditionally selecting the
context based on if isolation was enabled.

Fixes #11922
This commit is contained in:
Alex Garbutt 2019-01-12 05:19:20 -08:00 committed by Alexey Kuzmin
parent 134792a594
commit dcb670fa46
5 changed files with 58 additions and 70 deletions

View file

@ -111,8 +111,10 @@ class AtomSandboxedRenderFrameObserver : public AtomRenderFrameObserver {
auto* isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate);
auto context = frame->MainWorldScriptContext();
auto context = renderer_client_->GetContext(frame, isolate);
v8::Context::Scope context_scope(context);
v8::Local<v8::Value> argv[] = {mate::ConvertToV8(isolate, channel),
mate::ConvertToV8(isolate, args),
mate::ConvertToV8(isolate, sender_id)};