Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 10f14462c431349224cfd23efe19d3651ba66e99..d669c6ad935649c999d9ef30b7d586174f9ef510 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -6737,7 +6737,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(); } |
@@ -6957,6 +6957,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) { } |