Commit 438db6ae authored by sammc's avatar sammc Committed by Commit bot

Use the main world script context for mime handler postMessage.

Previously, calling postMessage from an isolated world would use that
world's context for calling the proxy frame's postMessage(). This
resulted in "Illegal invocation" errors. This CL avoids this problem by
using the main world script context when calling postMessage on the
proxy frame.

BUG=453184

Review URL: https://codereview.chromium.org/861073004

Cr-Commit-Position: refs/heads/master@{#313665}
parent 65a326a7
...@@ -212,6 +212,8 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, ...@@ -212,6 +212,8 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate,
if (!guest_proxy_frame) if (!guest_proxy_frame)
return; return;
v8::Context::Scope context_scope(
render_frame()->GetWebFrame()->mainWorldScriptContext());
v8::Local<v8::Object> guest_proxy_window = v8::Local<v8::Object> guest_proxy_window =
guest_proxy_frame->mainWorldScriptContext()->Global(); guest_proxy_frame->mainWorldScriptContext()->Global();
gin::Dictionary window_object(isolate, guest_proxy_window); gin::Dictionary window_object(isolate, guest_proxy_window);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment