Bug 1720290 [wpt PR 29649] - Deflake WPT test: none.https.html, a=testonly
authorArthur Sonzogni <arthursonzogni@chromium.org>
Sat, 17 Jul 2021 09:54:20 +0000
changeset 586047 2eb9ec1f61f4d7470f3efa0f3ca3691b9d1c1178
parent 586046 4fc85648d9d7c3d522eba16f8a3d4967015b6839
child 586048 56c02e5f7e6a7802f7b17c8427411b0d94e03732
push id146502
push userwptsync@mozilla.com
push dateMon, 19 Jul 2021 16:05:56 +0000
treeherderautoland@835956c1727a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1720290, 29649, 3015334, 1013596, 3021142, 901978
milestone92.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1720290 [wpt PR 29649] - Deflake WPT test: none.https.html, a=testonly Automatic update from web-platform-tests Deflake WPT test: none.https.html The failing subtest was identified by: https://chromium-review.googlesource.com/c/chromium/src/+/3015334 This patch puts the culprit into its own file, and tries to make it work reliably. Bug: 1013596 Fixed: 1013596 Change-Id: Ie98b5554824cee35f1e9f671a9962ba993a8b674 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3021142 Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org> Reviewed-by: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/master@{#901978} -- wpt-commits: d2a0a6a108413e945e253b0f0493e718637dce09 wpt-pr: 29649
testing/web-platform/tests/html/cross-origin-embedder-policy/iframe-history-none-require-corp.https.html
testing/web-platform/tests/html/cross-origin-embedder-policy/none.https.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/iframe-history-none-require-corp.https.html
@@ -0,0 +1,54 @@
+<meta name="timeout" content="long">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/common/utils.js></script
+<script src="/common/get-host-info.sub.js"></script>
+<script>
+
+promise_test(async test => {
+  // TODO(arthursonzogni): Consider switching toward another message passing
+  // API like:
+  // /html/cross-origin-embedder-policy/credentialless/resources/dispatcher.js
+  const bc = new BroadcastChannel(token());
+  const futureMessage = () => {
+    return new Promise(resolve => {
+      bc.onmessage = event => resolve(event.data);
+    });
+  };
+
+  const prefix = document.URL.substr(0, document.URL.lastIndexOf('/'))
+  const attribute = `?channelName=${bc.name}`;
+  const url_coep_none =
+    prefix + "/resources/navigate-none.sub.html" + attribute;
+  const url_coep_require_corp =
+    prefix + "/resources/navigate-require-corp.sub.html" + attribute;
+
+  const w = window.open();
+  test.add_cleanup(() => w.close());
+
+  // Navigate to COEP:unsafe-none.
+  w.location.href = url_coep_none;
+  assert_equals(await futureMessage(), "loaded");
+  assert_equals(w.location.href, url_coep_none);
+
+  // For unknown reasons so far. Waiting in between the different navigations
+  // avoids flakes.
+  await new Promise(resolve => test.step_timeout(resolve, 1000));
+
+  // Navigate to COEP:require-corp.
+  w.location.href = url_coep_require_corp;
+  assert_equals(await futureMessage(), "loaded");
+  assert_equals(w.location.href, url_coep_require_corp);
+
+  // For unknown reasons so far. Waiting in between the different navigations
+  // avoids flakes.
+  await new Promise(resolve => test.step_timeout(resolve, 1000));
+
+  // Navigate back to COEP:unsafe-none, using the history API.
+  // Note: `url_coep_none` already take the BFCache into account.
+  w.history.back();
+  assert_equals(await futureMessage(), "loaded");
+  assert_equals(w.location.href, url_coep_none);
+}, `"none" top-level: navigating a frame back from "require-corp" should succeed`);
+
+</script>
--- a/testing/web-platform/tests/html/cross-origin-embedder-policy/none.https.html
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/none.https.html
@@ -1,17 +1,17 @@
-<!doctype html>
 <meta name="timeout" content="long">
 <title>Cross-Origin-Embedder-Policy header and nested navigable resource without such header</title>
 <script src=/resources/testharness.js></script>
 <script src=/resources/testharnessreport.js></script>
 <script src=/common/utils.js></script> <!-- Use token() to allow running tests in parallel -->
 <script src="/common/get-host-info.sub.js"></script>
 <div id=log></div>
 <script>
+
 const HOST = get_host_info();
 const BASE = new URL("resources", location).pathname;
 
 async_test(t => {
   const frame = document.createElement("iframe");
   t.add_cleanup(() => frame.remove());
   frame.onload = t.step_func_done(() => {
     assert_not_equals(frame.contentDocument, null);
@@ -37,48 +37,20 @@ async_test(t => {
     }
   });
   frame.src = `resources/navigate-require-corp.sub.html?to=${blank}`;
   document.body.append(frame);
   assert_equals(frame.contentDocument.body.localName, "body");
 }, `"none" top-level: navigating a frame from "require-corp" to "none" should succeed`);
 
 async_test(t => {
-  Promise.resolve().then(async () => {
-    const bc = new BroadcastChannel(token());
-    const futureMessage = () => {
-      return new Promise(resolve => {
-        bc.onmessage = event => resolve(event.data);
-      });
-    };
-
-    const prefix = document.URL.substr(0, document.URL.lastIndexOf('/'))
-    const attribute = `?channelName=${bc.name}`;
-    const url_1 = prefix + "/resources/navigate-none.sub.html" + attribute;
-    const url_2 = prefix + "/resources/navigate-require-corp.sub.html" + attribute;
-
-    const w = window.open(url_1, "window_name");
-    t.add_cleanup(() => w.close());
-    assert_equals(await futureMessage(), "loaded");
-    assert_equals(w.location.href, url_1);
-
-    w.location.href = url_2;
-    assert_equals(await futureMessage(), "loaded");
-    assert_equals(w.location.href, url_2);
-
-    w.history.back();
-    assert_equals(await futureMessage(), "loaded");
-    assert_equals(w.location.href, url_1);
-
-    t.done();
-  }).catch((e) => t.unreached_func(e));
-}, `"none" top-level: navigating a frame back from "require-corp" should succeed`);
-
-async_test(t => {
   let pageLoaded = false;
+  // TODO(arthursonzogni): Consider switching toward another message passing
+  // API like:
+  // /html/cross-origin-embedder-policy/credentialless/resources/dispatcher.js
   const bc = new BroadcastChannel(token());
   let finished = false;
   let doneCheck = _ => {
     if (finished && pageLoaded) {
       t.done();
     }
   }
   bc.onmessage = t.step_func((event) => {