Chromium Code Reviews| Index: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc |
| diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc |
| index e3512823efa7592462c504a7f775375966b1bd41..3ac7e86a2e9b4de9f08788d38c0d330b6fcdafed 100644 |
| --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc |
| +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc |
| @@ -23,6 +23,7 @@ |
| #include "gin/wrappable.h" |
| #include "third_party/WebKit/public/web/WebDocument.h" |
| #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| +#include "third_party/WebKit/public/web/WebRemoteFrame.h" |
| #include "third_party/WebKit/public/web/WebView.h" |
| namespace extensions { |
| @@ -235,8 +236,16 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, |
| v8::Context::Scope context_scope( |
| render_frame()->GetWebFrame()->mainWorldScriptContext()); |
| - v8::Local<v8::Object> guest_proxy_window = |
| - guest_proxy_frame->mainWorldScriptContext()->Global(); |
| + |
| + v8::Local<v8::Object> guest_proxy_window; |
| + if (guest_proxy_frame->isWebLocalFrame()) { |
|
Fady Samuel
2015/09/14 15:39:26
A comment or helper method would be very useful he
nasko
2015/09/14 16:24:21
Done.
|
| + guest_proxy_window = |
| + guest_proxy_frame->mainWorldScriptContext()->Global(); |
| + } else { |
| + guest_proxy_window = guest_proxy_frame->toWebRemoteFrame() |
| + ->deprecatedMainWorldScriptContext() |
| + ->Global(); |
| + } |
| gin::Dictionary window_object(isolate, guest_proxy_window); |
| v8::Local<v8::Function> post_message; |
| if (!window_object.Get(std::string(kPostMessageName), &post_message)) |
| @@ -247,7 +256,7 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, |
| // Post the message to any domain inside the browser plugin. The embedder |
| // should already know what is embedded. |
| gin::StringToV8(isolate, "*")}; |
| - guest_proxy_frame->callFunctionEvenIfScriptDisabled( |
| + render_frame()->GetWebFrame()->callFunctionEvenIfScriptDisabled( |
|
Fady Samuel
2015/09/14 15:38:05
I thought we also wanted to avoid using callFuncti
nasko
2015/09/14 15:39:19
Yes, but on WebRemoteFrame, since it is not implem
|
| post_message.As<v8::Function>(), |
| guest_proxy_window, |
| arraysize(args), |