Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: Source/bindings/core/v8/WindowProxy.cpp

Issue 1096393005: Initialize the new WindowProxy when handing off the global object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698