Index: Source/bindings/core/v8/WindowProxy.cpp |
diff --git a/Source/bindings/core/v8/WindowProxy.cpp b/Source/bindings/core/v8/WindowProxy.cpp |
index c88a6e57b0d6dcfacd6c45ddb8933eebbe9db69f..d5a04620c83830d8ca6ebcc6ce3a58ce3a156455 100644 |
--- a/Source/bindings/core/v8/WindowProxy.cpp |
+++ b/Source/bindings/core/v8/WindowProxy.cpp |
@@ -156,6 +156,13 @@ void WindowProxy::takeGlobalFrom(WindowProxy* windowProxy) |
ASSERT(windowProxy->m_scriptState->isGlobalObjectDetached()); |
m_global.set(m_isolate, windowProxy->m_global.newLocal(m_isolate)); |
windowProxy->m_global.clear(); |
+ // Initialize the window proxy now, to re-establish the connection between |
+ // the global object and the v8::Context. This is really only needed for a |
+ // RemoteDOMWindow, since it has no scripting environment of its own. |
+ // Without this, existing script references to a swapped in RemoteDOMWindow |
+ // would be broken until that RemoteDOMWindow was vended again through an |
+ // interface like window.frames. |
+ initializeIfNeeded(); |
haraken
2015/04/24 05:06:04
Just to confirm: This initializeIfNeeded() creates
|
} |
// Create a new environment and setup the global object. |
@@ -397,8 +404,8 @@ void WindowProxy::setSecurityToken(SecurityOrigin* origin) |
// - the frame is showing the initial empty document |
// - the frame is remote |
bool delaySet = m_world->isMainWorld() |
- && (origin->domainWasSetInDOM() |
- || m_frame->isRemoteFrame() |
+ && (m_frame->isRemoteFrame() |
+ || origin->domainWasSetInDOM() |
|| toLocalFrame(m_frame)->loader().stateMachine()->isDisplayingInitialEmptyDocument()); |
if (origin && !delaySet) |
token = origin->toString(); |