Bug 1720290 [wpt PR 29649] - Deflake WPT test: none.https.html, a=testonly
☠☠ backed out by dec0a179f851 ☠ ☠
authorArthur Sonzogni <arthursonzogni@chromium.org>
Sat, 17 Jul 2021 09:54:20 +0000
changeset 585871 9c0bad4c477ba842e60381284aae2c30dffb8380
parent 585870 4f55d470b85b9a425456df3d8a86182700851438
child 585872 6b5bf184887541a7b9efd162ebe807607c5d3fc9
push id38620
push usercsabou@mozilla.com
push dateSun, 18 Jul 2021 09:08:29 +0000
treeherdermozilla-central@cc4e5ea0c986 [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) => {