Index: extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc |
diff --git a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc |
index 7eb129236551ca24185357a5af7054915f95d7a7..ee243bf6922e528e5461ab0762d662a64929378b 100644 |
--- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc |
+++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc |
@@ -24,6 +24,7 @@ |
#include "extensions/renderer/script_context.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
#include "third_party/WebKit/public/web/WebLocalFrame.h" |
+#include "third_party/WebKit/public/web/WebRemoteFrame.h" |
#include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
#include "third_party/WebKit/public/web/WebView.h" |
#include "v8/include/v8.h" |
@@ -314,7 +315,15 @@ void GuestViewInternalCustomBindings::GetContentWindow( |
return; |
blink::WebFrame* frame = 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(); |
+ } |
args.GetReturnValue().Set(window); |
} |