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

Unified Diff: LayoutTests/http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html

Issue 494343003: Eliminate globalFlag usage from http security layout tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: consistify Created 6 years, 4 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: LayoutTests/http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html
diff --git a/LayoutTests/http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html b/LayoutTests/http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html
index 5fcec5bce7c934954248703b78698df9260bd83a..55504f033ae82acdc2f3dcf6b4b25de2e0fae80e 100644
--- a/LayoutTests/http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html
+++ b/LayoutTests/http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html
@@ -2,47 +2,35 @@
<head>
<script src="../resources/cross-frame-access.js"></script>
<script>
+ var subFramesLoaded = 0;
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpChildFramesAsText();
testRunner.waitUntilDone();
}
+ function startTestWhenReady() {
+ if (++subFramesLoaded == 2)
+ document.getElementById('secondSubFrame').contentWindow.postMessage('perform test', '*');
+ }
+
function loaded() {
var firstURL = "data:text/html,<html>"
- + "<head>"
- + "<scr" + "ipt>"
- + "function fireSentinel() {"
- + "if (window.testRunner)"
- + "testRunner.globalFlag = true;"
- + "}"
- + "</scr" + "ipt>"
- + "</head>"
- + "<body onload=\"fireSentinel();\">"
+ + "<body>"
+ "<p>Inner iframe.</p>"
+ "<p id='accessMe'>Pass: Cross frame access from a sibling data: URL was denied.</p>"
+ "</body>"
+ "</html>";
var iframe = document.getElementById("firstSubFrame");
+ iframe.onload = startTestWhenReady;
iframe.src = firstURL;
var secondURL = "data:text/html,<html>"
+ "<head>"
+ "<scr" + "ipt>"
+ "function loaded() {"
- + "if (window.testRunner) {"
- + "setTimeout(waitForFlag, 1);"
- + "function waitForFlag() {"
- + "if (!testRunner.globalFlag) {"
- + "setTimeout(waitForFlag, 1);"
- + "return;"
- + "}"
- + "performTest();"
- + "}"
- + "} else {"
- + "document.getElementById('console').innerHTML = 'Click the button when all the subframes have finished loading.';"
- + "}"
+ + "window.addEventListener('message', performTest);"
+ "}"
+ "function performTest() {"
+ "try {"
@@ -56,12 +44,12 @@
+ "</head>"
+ "<body onload=\"loaded();\">"
+ "<p>Inner iframe.</p>"
- + "<button onclick='performTest();'>Test</button>"
+ "<pre id='console'></pre>"
+ "</body>"
+ "</html>";
iframe = document.getElementById("secondSubFrame");
+ iframe.onload = startTestWhenReady;
iframe.src = secondURL;
}
</script>

Powered by Google App Engine
This is Rietveld 408576698