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

Unified Diff: LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener.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/aboutBlank/xss-DENIED-set-opener.html
diff --git a/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener.html b/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener.html
index b4120c53707fb36ce5161248ab0f425dde6f5fea..415388cd7aade30ceb8543f01e566c1fb3ece52c 100644
--- a/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener.html
+++ b/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener.html
@@ -26,7 +26,7 @@
var try_control = 'write(window.opener.top.frames[1], ' + libwrapjs.in_string(message_success) + ');';
var control = 'setTimeout(function() {' + try_control + '}, 200);\n';
- var sigDone = 'setTimeout(function() { if (window.testRunner) testRunner.globalFlag = true; }, 300);';
+ var sigDone = 'setTimeout(function() { window.opener.top.postMessage(\'done\', \'*\'); }, 300);';
var payload = write_func + attack + control + sigDone;
code = libwrapjs.in_script_tag(payload);
@@ -46,12 +46,11 @@
runTest = function()
{
+ window.addEventListener('message', function () { closeWindowAndNotifyDone(openedWindow); });
openedWindow = window.open('', 'attacker');
openedWindow.document.write(code);
openedWindow.document.close();
- setTimeout(pollForDone, 1);
-
try {
window.open.call(frames[0], '', 'attacker');
log("FAIL: 'window.open' called on another frame should throw.");
@@ -59,15 +58,6 @@
log("PASS: 'window.open' called on another frame threw: " + e);
}
}
-
- pollForDone = function()
- {
- if (!testRunner.globalFlag) {
- setTimeout(pollForDone, 1);
- return;
- }
- closeWindowAndNotifyDone(openedWindow);
- }
</script>
</head>
<body>

Powered by Google App Engine
This is Rietveld 408576698