Index: LayoutTests/http/tests/misc/set-window-opener-to-null.html |
diff --git a/LayoutTests/http/tests/misc/set-window-opener-to-null.html b/LayoutTests/http/tests/misc/set-window-opener-to-null.html |
index e9439048dea748f76749b5eae4d881182686d69e..de56c2c1227a71546e0a2147b96106891048ed66 100644 |
--- a/LayoutTests/http/tests/misc/set-window-opener-to-null.html |
+++ b/LayoutTests/http/tests/misc/set-window-opener-to-null.html |
@@ -4,31 +4,13 @@ if (window.testRunner) { |
testRunner.setCanOpenWindows(); |
testRunner.dumpAsText(); |
testRunner.waitUntilDone(); |
- testRunner.globalFlag = false; |
} |
-var w = window.open("http://127.0.0.1:8000/misc/resources/content-iframe.html"); |
-w.opener = null; |
- |
-function wait_to_start() { |
- var child_window_opened; |
- |
- // polling testRunner.globalFlag or w.document |
- if (window.testRunner) { |
- child_window_opened = testRunner.globalFlag; |
- } else { |
- // polling w.document is not very reliable cross browsers, |
- // it works in chrome for manual testsing. |
- // We might want to change it to using postMessage when it |
- // is supported. |
- child_window_opened = !w.document; |
- } |
- |
- if (!child_window_opened) { |
- setTimeout(wait_to_start, 30); |
- return; |
- } |
+function maybeStartTest(w) { |
+ w.postMessage('start', '*'); |
+} |
+function runTest() { |
var e = document.getElementById('console'); |
e.innerHTML = w.opener == null ? 'PASS' : 'FAIL'; |
@@ -38,8 +20,10 @@ function wait_to_start() { |
testRunner.notifyDone(); |
} |
-window.onload = wait_to_start; |
- |
+window.addEventListener('message', runTest); |
+var w = window.open('http://127.0.0.1:8000/misc/resources/content-iframe.html'); |
+w.opener = null; |
+w.onload = function() { maybeStartTest(w); }; |
esprehn
2014/08/21 19:44:07
This looks flakey, just add an onmessage listener
dcheng
2014/08/21 20:18:10
Unfortunately the other window doesn't have a conn
|
</script> |
<body> |
This tests that following code works in Chrome: |