Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Unified Diff: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc

Issue 1335023004: Prepare MimeHanderViewContainer for removing swapped out RenderFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698