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

Side by Side Diff: LayoutTests/http/tests/misc/set-window-opener-to-null.html

Issue 475933003: Remove testRunner.globalFlag use from layout tests outside http/security (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Just use onload 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/misc/resources/content-iframe.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <script> 2 <script>
3 if (window.testRunner) { 3 if (window.testRunner) {
4 testRunner.setCanOpenWindows(); 4 testRunner.setCanOpenWindows();
5 testRunner.dumpAsText(); 5 testRunner.dumpAsText();
6 testRunner.waitUntilDone(); 6 testRunner.waitUntilDone();
7 testRunner.globalFlag = false;
8 } 7 }
9 8
10 var w = window.open("http://127.0.0.1:8000/misc/resources/content-iframe.html"); 9 function runTest() {
11 w.opener = null;
12
13 function wait_to_start() {
14 var child_window_opened;
15
16 // polling testRunner.globalFlag or w.document
17 if (window.testRunner) {
18 child_window_opened = testRunner.globalFlag;
19 } else {
20 // polling w.document is not very reliable cross browsers,
21 // it works in chrome for manual testsing.
22 // We might want to change it to using postMessage when it
23 // is supported.
24 child_window_opened = !w.document;
25 }
26
27 if (!child_window_opened) {
28 setTimeout(wait_to_start, 30);
29 return;
30 }
31
32 var e = document.getElementById('console'); 10 var e = document.getElementById('console');
33 e.innerHTML = w.opener == null ? 'PASS' : 'FAIL'; 11 e.innerHTML = w.opener == null ? 'PASS' : 'FAIL';
34 12
35 w.close(); 13 w.close();
36 14
37 if (window.testRunner) 15 if (window.testRunner)
38 testRunner.notifyDone(); 16 testRunner.notifyDone();
39 } 17 }
40 18
41 window.onload = wait_to_start; 19 var w = window.open('http://127.0.0.1:8000/misc/resources/content-iframe.html');
42 20 w.opener = null;
21 w.onload = runTest;
43 </script> 22 </script>
44 <body> 23 <body>
45 This tests that following code works in Chrome: 24 This tests that following code works in Chrome:
46 <pre> 25 <pre>
47 var w = window.open(...); 26 var w = window.open(...);
48 w.opener = null; 27 w.opener = null;
49 </pre> 28 </pre>
50 After new page finishes loading, its opener should stay as null. 29 After new page finishes loading, its opener should stay as null.
51 30
52 <p> 31 <p>
53 <div id="console">Running ...<div> 32 <div id="console">Running ...<div>
54 </body> 33 </body>
55 </html> 34 </html>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/misc/resources/content-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698