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

Unified Diff: Source/web/tests/WebFrameTest.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
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 13ac82a2d3e4a6277c71f68531d02cfa5aa62091..6fddb1476c9cbfe8acf99383fa8250fca2c6992b 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -6914,6 +6914,35 @@ TEST_F(WebFrameSwapTest, SwapPreservesGlobalContext)
remoteFrame->close();
}
+TEST_F(WebFrameSwapTest, SwapInitializesGlobal)
+{
+ v8::HandleScope scope(v8::Isolate::GetCurrent());
+
+ v8::Local<v8::Value> windowTop = mainFrame()->executeScriptAndReturnValue(WebScriptSource("window"));
+ ASSERT_TRUE(windowTop->IsObject());
+
+ v8::Local<v8::Value> lastChild = mainFrame()->executeScriptAndReturnValue(WebScriptSource("saved = window[2]"));
+ ASSERT_TRUE(lastChild->IsObject());
+
+ FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
+ WebRemoteFrame* remoteFrame = remoteClient.frame();
+ mainFrame()->lastChild()->swap(remoteFrame);
+ remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique());
+ v8::Local<v8::Value> remoteWindowTop = mainFrame()->executeScriptAndReturnValue(WebScriptSource("saved.top"));
+ EXPECT_TRUE(remoteWindowTop->IsObject());
+ EXPECT_TRUE(windowTop->StrictEquals(remoteWindowTop));
+
+ FrameTestHelpers::TestWebFrameClient client;
+ WebLocalFrame* localFrame = WebLocalFrame::create(&client);
+ localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags::None);
+ remoteFrame->swap(localFrame);
+ v8::Local<v8::Value> localWindowTop = mainFrame()->executeScriptAndReturnValue(WebScriptSource("saved.top"));
+ EXPECT_TRUE(localWindowTop->IsObject());
+ EXPECT_TRUE(windowTop->StrictEquals(localWindowTop));
+
+ reset();
+}
+
TEST_F(WebFrameSwapTest, RemoteFramesAreIndexable)
{
v8::HandleScope scope(v8::Isolate::GetCurrent());
« Source/bindings/core/v8/WindowProxy.cpp ('K') | « Source/bindings/core/v8/WindowProxy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698