http/tests/navigation/window-open-cross-origin-then-navigated-back-same-origin.html...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2018 08:16:23 +0000 (08:16 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2018 08:16:23 +0000 (08:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189710

Reviewed by Ryosuke Niwa.

Update the test to stop relying on the test page posting a message to the auxiliary window
to trigger a navigation. Instead, the auxiliary window now takes care of navigating itself
after it is loaded. This is more robust, especially considering that the test page is cross
origin and thus is not getting a load event for the auxiliary window.

* http/tests/navigation/resources/navigate-back-same-origin-helper.html: Added.
* http/tests/navigation/resources/navigate-helper.html: Removed.
* http/tests/navigation/window-open-cross-origin-then-navigated-back-same-origin.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/resources/navigate-back-same-origin-helper.html [new file with mode: 0644]
LayoutTests/http/tests/navigation/resources/navigate-helper.html [deleted file]
LayoutTests/http/tests/navigation/window-open-cross-origin-then-navigated-back-same-origin.html

index be0b1c9..f253457 100644 (file)
@@ -1,3 +1,19 @@
+2018-09-19  Chris Dumez  <cdumez@apple.com>
+
+        http/tests/navigation/window-open-cross-origin-then-navigated-back-same-origin.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=189710
+
+        Reviewed by Ryosuke Niwa.
+
+        Update the test to stop relying on the test page posting a message to the auxiliary window
+        to trigger a navigation. Instead, the auxiliary window now takes care of navigating itself
+        after it is loaded. This is more robust, especially considering that the test page is cross
+        origin and thus is not getting a load event for the auxiliary window.
+
+        * http/tests/navigation/resources/navigate-back-same-origin-helper.html: Added.
+        * http/tests/navigation/resources/navigate-helper.html: Removed.
+        * http/tests/navigation/window-open-cross-origin-then-navigated-back-same-origin.html:
+
 2018-09-19  Claudio Saavedra  <csaavedra@igalia.com>
 
         [WPE][GTK] Assorted gardening
diff --git a/LayoutTests/http/tests/navigation/resources/navigate-back-same-origin-helper.html b/LayoutTests/http/tests/navigation/resources/navigate-back-same-origin-helper.html
new file mode 100644 (file)
index 0000000..fb9ac47
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+onload = () => {
+    setTimeout(() => {
+        window.location = "http://127.0.0.1:8000/navigation/resources/otherpage.html";
+    }, 0);
+};
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/navigation/resources/navigate-helper.html b/LayoutTests/http/tests/navigation/resources/navigate-helper.html
deleted file mode 100644 (file)
index dfc9e6e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script>
-onmessage = (msg) => {
-    setTimeout(() => {
-        window.location = msg.data.navigate;
-    }, 0);
-};
-</script>
-</body>
-</html>
index ebcbea8..5025a5c 100644 (file)
@@ -11,36 +11,18 @@ jsTestIsAsync = true;
 if (window.testRunner)
     testRunner.setCanOpenWindows();
 
-function wasNavigatedSameOrigin()
-{
-    shouldBeEqualToString("w.location.href", "http://127.0.0.1:8000/navigation/resources/otherpage.html");
-    finishJSTest();
-}
-
-function wasNavigatedCrossOrigin()
-{
-    // Navigate back same origin.
-    w.postMessage({ navigate: "http://127.0.0.1:8000/navigation/resources/otherpage.html" }, "*");
-    handle = setInterval(() => {
-        try {
-            w.name;
-            clearInterval(handle);
-            wasNavigatedSameOrigin();
-        } catch(e) {
-        }
-    }, 10);
-}
-
 onload = function() {
     w = window.open();
     w.opener = null;
-    w.location = "http://localhost:8000/navigation/resources/navigate-helper.html";
+    w.location = "http://localhost:8000/navigation/resources/navigate-back-same-origin-helper.html";
     handle = setInterval(() => {
         try {
-            w.name;
+            if (w.location.href != "about:blank") {
+                clearInterval(handle);
+                shouldBeEqualToString("w.location.href", "http://127.0.0.1:8000/navigation/resources/otherpage.html");
+                finishJSTest();
+            }
         } catch(e) {
-            clearInterval(handle);
-            wasNavigatedCrossOrigin();
         }
     }, 10);
 }