Index: components/guest_view/renderer/guest_view_request.cc |
diff --git a/components/guest_view/renderer/guest_view_request.cc b/components/guest_view/renderer/guest_view_request.cc |
index f666c1c5dc73ac9c8f94896e491ca1a2088f378b..2a4fd3157bcd678ebdd00cfd01cbd983333ba6e3 100644 |
--- a/components/guest_view/renderer/guest_view_request.cc |
+++ b/components/guest_view/renderer/guest_view_request.cc |
@@ -9,6 +9,7 @@ |
#include "content/public/renderer/render_frame.h" |
#include "content/public/renderer/render_view.h" |
#include "third_party/WebKit/public/web/WebLocalFrame.h" |
+#include "third_party/WebKit/public/web/WebRemoteFrame.h" |
#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" |
#include "third_party/WebKit/public/web/WebView.h" |
@@ -88,7 +89,15 @@ void GuestViewAttachRequest::HandleResponse(const IPC::Message& message) { |
v8::HandleScope handle_scope(isolate()); |
blink::WebFrame* frame = guest_proxy_render_view->GetWebView()->mainFrame(); |
- v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); |
+ // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running |
+ // on top of out-of-process iframes. Remove it once the code is converted. |
+ v8::Local<v8::Value> window; |
+ if (frame->isWebLocalFrame()) { |
+ window = frame->mainWorldScriptContext()->Global(); |
+ } else { |
+ window = |
+ frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global(); |
+ } |
const int argc = 1; |
scoped_ptr<v8::Local<v8::Value>[]> argv(new v8::Local<v8::Value>[argc]); |