diff --git a/chrome/VERSION b/chrome/VERSION
index 2d9ec92..c174c882 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=59
 MINOR=0
-BUILD=3039
+BUILD=3040
 PATCH=0
diff --git a/components/guest_view/renderer/guest_view_request.cc b/components/guest_view/renderer/guest_view_request.cc
index 1d26c3f4..abc7e3a7 100644
--- a/components/guest_view/renderer/guest_view_request.cc
+++ b/components/guest_view/renderer/guest_view_request.cc
@@ -97,8 +97,7 @@
   if (frame->isWebLocalFrame()) {
     window = frame->mainWorldScriptContext()->Global();
   } else {
-    window =
-        frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global();
+    window = frame->toWebRemoteFrame()->globalProxy();
   }
 
   const int argc = 1;
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 d9a09ffe..c1c985fd 100644
--- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
+++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
@@ -348,8 +348,7 @@
   if (frame->isWebLocalFrame()) {
     window = frame->mainWorldScriptContext()->Global();
   } else {
-    window =
-        frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global();
+    window = frame->toWebRemoteFrame()->globalProxy();
   }
   args.GetReturnValue().Set(window);
 }
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 b05e9f5f..26222a2 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
@@ -240,12 +240,9 @@
   // on top of out-of-process iframes. Remove it once the code is converted.
   v8::Local<v8::Object> guest_proxy_window;
   if (guest_proxy_frame->isWebLocalFrame()) {
-    guest_proxy_window =
-        guest_proxy_frame->mainWorldScriptContext()->Global();
+    guest_proxy_window = guest_proxy_frame->mainWorldScriptContext()->Global();
   } else {
-    guest_proxy_window = guest_proxy_frame->toWebRemoteFrame()
-                             ->deprecatedMainWorldScriptContext()
-                             ->Global();
+    guest_proxy_window = guest_proxy_frame->toWebRemoteFrame()->globalProxy();
   }
   gin::Dictionary window_object(isolate, guest_proxy_window);
   v8::Local<v8::Function> post_message;
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
index 945729d..fec62fc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
@@ -34,6 +34,7 @@
 #include "bindings/core/v8/DOMWrapperWorld.h"
 #include "bindings/core/v8/ScopedPersistent.h"
 #include "bindings/core/v8/ScriptState.h"
+#include "core/CoreExport.h"
 #include "platform/heap/Handle.h"
 #include "v8/include/v8.h"
 #include "wtf/RefPtr.h"
@@ -136,7 +137,7 @@
   void clearForClose();
   void clearForNavigation();
 
-  v8::Local<v8::Object> globalIfNotDetached();
+  CORE_EXPORT v8::Local<v8::Object> globalIfNotDetached();
   v8::Local<v8::Object> releaseGlobal();
   void setGlobal(v8::Local<v8::Object>);
 
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp b/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
index 7210cc4..d78b57e 100644
--- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp
@@ -4,6 +4,8 @@
 
 #include "web/WebRemoteFrameImpl.h"
 
+#include "bindings/core/v8/DOMWrapperWorld.h"
+#include "bindings/core/v8/WindowProxy.h"
 #include "core/dom/Fullscreen.h"
 #include "core/dom/RemoteSecurityContext.h"
 #include "core/dom/SecurityContext.h"
@@ -22,10 +24,10 @@
 #include "public/web/WebPerformance.h"
 #include "public/web/WebRange.h"
 #include "public/web/WebTreeScopeType.h"
+#include "v8/include/v8.h"
 #include "web/RemoteFrameOwner.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include <v8/include/v8.h>
 
 namespace blink {
 
@@ -213,11 +215,6 @@
   return v8::Local<v8::Context>();
 }
 
-v8::Local<v8::Context> WebRemoteFrameImpl::deprecatedMainWorldScriptContext()
-    const {
-  return toV8Context(frame(), DOMWrapperWorld::mainWorld());
-}
-
 void WebRemoteFrameImpl::reload(WebFrameLoadType) {
   NOTREACHED();
 }
@@ -527,6 +524,12 @@
   frame()->setDocumentHasReceivedUserGesture();
 }
 
+v8::Local<v8::Object> WebRemoteFrameImpl::globalProxy() const {
+  return frame()
+      ->windowProxy(DOMWrapperWorld::mainWorld())
+      ->globalIfNotDetached();
+}
+
 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope,
                                        WebRemoteFrameClient* client)
     : WebRemoteFrame(scope),
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
index d049228..578f6d9 100644
--- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
+++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -75,7 +75,6 @@
       int argc,
       v8::Local<v8::Value> argv[]) override;
   v8::Local<v8::Context> mainWorldScriptContext() const override;
-  v8::Local<v8::Context> deprecatedMainWorldScriptContext() const override;
   void reload(WebFrameLoadType) override;
   void reloadWithOverrideURL(const WebURL& overrideUrl,
                              WebFrameLoadType) override;
@@ -156,15 +155,12 @@
       WebInsecureRequestPolicy) const override;
   void setReplicatedPotentiallyTrustworthyUniqueOrigin(bool) const override;
   void dispatchLoadEventOnFrameOwner() const override;
-
   void didStartLoading() override;
   void didStopLoading() override;
-
   bool isIgnoredForHitTest() const override;
-
   void willEnterFullscreen() override;
-
   void setHasReceivedUserGesture() override;
+  v8::Local<v8::Object> globalProxy() const override;
 
   DECLARE_TRACE();
 
diff --git a/third_party/WebKit/public/web/WebRemoteFrame.h b/third_party/WebKit/public/web/WebRemoteFrame.h
index 04659d0..d0a60a27 100644
--- a/third_party/WebKit/public/web/WebRemoteFrame.h
+++ b/third_party/WebKit/public/web/WebRemoteFrame.h
@@ -10,6 +10,7 @@
 #include "public/platform/WebInsecureRequestPolicy.h"
 #include "public/web/WebFrame.h"
 #include "public/web/WebSandboxFlags.h"
+#include "v8/include/v8.h"
 
 namespace blink {
 
@@ -101,10 +102,7 @@
 
   virtual void setHasReceivedUserGesture() = 0;
 
-  // Temporary method to allow embedders to get the script context of a
-  // remote frame. This should only be used by legacy code that has not yet
-  // migrated over to the new OOPI infrastructure.
-  virtual v8::Local<v8::Context> deprecatedMainWorldScriptContext() const = 0;
+  virtual v8::Local<v8::Object> globalProxy() const = 0;
 
  protected:
   explicit WebRemoteFrame(WebTreeScopeType scope) : WebFrame(scope) {}