diff options
-rw-r--r-- | components/guest_view/renderer/guest_view_request.cc | 11 | ||||
-rw-r--r-- | extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/components/guest_view/renderer/guest_view_request.cc b/components/guest_view/renderer/guest_view_request.cc index f666c1c..2a4fd31 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]); 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 7eb1292..ee243bf 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); } |