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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 23620020: Don't wait to notify client of spoof attempt if a modal dialog is created. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use PageGroupLoadDeferrer instead Created 7 years, 3 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 | « Source/core/page/PageGroupLoadDeferrer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 3ebaed81af6d3a1ae437d36ed36b99f831c19753..b66c211372939390bf630104bde014d725e4f1a4 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -3306,6 +3306,39 @@ TEST_F(WebFrameTest, DidAccessInitialDocumentViaJavascriptUrl)
m_webView = 0;
}
+TEST_F(WebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog)
+{
+ TestAccessInitialDocumentWebFrameClient webFrameClient;
+ m_webView = FrameTestHelpers::createWebView(true, &webFrameClient);
+ runPendingTasks();
+ EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
+
+ // Create another window that will try to access it.
+ WebView* newView = FrameTestHelpers::createWebView(true);
+ newView->mainFrame()->setOpener(m_webView->mainFrame());
+ runPendingTasks();
+ EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
+
+ // Access the initial document by modifying the body. We normally set a
+ // timer to notify the client.
+ newView->mainFrame()->executeScript(
+ WebScriptSource("window.opener.document.body.innerHTML += 'Modified';"));
+ EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
+
+ // Make sure that a modal dialog forces us to notify right away.
+ newView->mainFrame()->executeScript(
+ WebScriptSource("window.opener.confirm('Modal');"));
+ EXPECT_TRUE(webFrameClient.m_didAccessInitialDocument);
+
+ // Ensure that we don't notify again later.
+ runPendingTasks();
+ EXPECT_TRUE(webFrameClient.m_didAccessInitialDocument);
+
+ newView->close();
+ m_webView->close();
+ m_webView = 0;
+}
+
class TestMainFrameUserOrProgrammaticScrollFrameClient : public WebFrameClient {
public:
TestMainFrameUserOrProgrammaticScrollFrameClient() { reset(); }
« no previous file with comments | « Source/core/page/PageGroupLoadDeferrer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698