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

Unified Diff: LayoutTests/http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.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/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
diff --git a/LayoutTests/http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html b/LayoutTests/http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
index a6139643391e04023b895a18d71aae2ae1ebce32..6018c7d30dcd57457a22e0a9144d096f9fbf2c81 100644
--- a/LayoutTests/http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
+++ b/LayoutTests/http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-window-open.html
@@ -12,29 +12,14 @@
testRunner.setCanOpenWindows();
}
- var url = "javascript:\"<html><head><scr" + "ipt>window.onload = function() { if (window.testRunner) testRunner.globalFlag = true; }</scr" + "ipt></head><body><p>Opened Frame</p><p id='accessMe'>FAIL</p></body></html>\"";
+ var url = "javascript:\"<html><head><scr" + "ipt>window.onload = function() { window.opener.postMessage('run test', '*'); }</scr" + "ipt></head><body><p>Opened Frame</p><p id='accessMe'>FAIL</p></body></html>\"";
openedWindow = window.open(url);
- if (window.testRunner) {
- setTimeout(pollForTest, 1);
- } else {
- log("To run the test, click the button below when the opened window finishes loading.");
- var button = document.createElement("button");
- button.appendChild(document.createTextNode("Run Test"));
- button.onclick = runTest;
- document.body.appendChild(button);
- }
-
- }
-
- pollForTest = function()
- {
- if (!testRunner.globalFlag) {
- setTimeout(pollForTest, 1);
- return;
- }
- runTest();
- closeWindowAndNotifyDone(openedWindow);
+ window.addEventListener('message', function ()
+ {
+ runTest();
+ closeWindowAndNotifyDone(openedWindow);
+ });
}
runTest = function()

Powered by Google App Engine
This is Rietveld 408576698