Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index ed37af9ec251f6c0a1fff35466be1896532ba67b..d9081192d76855dc6fcc34a615b441f5b75ac6a9 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -6740,7 +6740,7 @@ protected: |
registerMockedHttpURLLoad("subframe-c.html"); |
registerMockedHttpURLLoad("subframe-hello.html"); |
- m_webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html"); |
+ m_webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html", true); |
} |
void reset() { m_webViewHelper.reset(); } |
@@ -6960,6 +6960,41 @@ TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterRemoteToLocalSwap) |
remoteFrame->close(); |
} |
+class RemoteNavigationClient : public FrameTestHelpers::TestWebRemoteFrameClient { |
+public: |
+ void navigate(const WebURLRequest& request, bool shouldReplaceCurrentEntry) override |
+ { |
+ m_lastRequest = request; |
+ } |
+ |
+ const WebURLRequest& lastRequest() const { return m_lastRequest; } |
+ |
+private: |
+ WebURLRequest m_lastRequest; |
+}; |
+ |
+TEST_F(WebFrameSwapTest, NavigateRemoteFrameViaLocation) |
+{ |
+ RemoteNavigationClient client; |
+ WebRemoteFrame* remoteFrame = WebRemoteFrame::create(&client); |
+ WebFrame* targetFrame = mainFrame()->firstChild(); |
+ ASSERT_TRUE(targetFrame); |
+ targetFrame->swap(remoteFrame); |
+ ASSERT_TRUE(mainFrame()->firstChild()); |
+ ASSERT_EQ(mainFrame()->firstChild(), remoteFrame); |
+ |
+ remoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("http://127.0.0.1")); |
+ mainFrame()->executeScript(WebScriptSource( |
+ "document.getElementsByTagName('iframe')[0].contentWindow.location = 'data:text/html,hi'")); |
+ ASSERT_FALSE(client.lastRequest().isNull()); |
+ EXPECT_EQ(WebURL(toKURL("data:text/html,hi")), client.lastRequest().url()); |
+ |
+ // Manually reset to break WebViewHelper's dependency on the stack allocated |
+ // TestWebFrameClient. |
+ reset(); |
+ remoteFrame->close(); |
+} |
+ |
class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient { |
public: |
MockDocumentThreadableLoaderClient() : m_failed(false) { } |