☠☠ backed out by dec0a179f851 ☠ ☠ | |
author | Arthur Sonzogni <arthursonzogni@chromium.org> |
Sat, 17 Jul 2021 09:54:20 +0000 | |
changeset 585871 | 9c0bad4c477ba842e60381284aae2c30dffb8380 |
parent 585870 | 4f55d470b85b9a425456df3d8a86182700851438 |
child 585872 | 6b5bf184887541a7b9efd162ebe807607c5d3fc9 |
push id | 38620 |
push user | csabou@mozilla.com |
push date | Sun, 18 Jul 2021 09:08:29 +0000 |
treeherder | mozilla-central@cc4e5ea0c986 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | testonly |
bugs | 1720290, 29649, 3015334, 1013596, 3021142, 901978 |
milestone | 92.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
|
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) => {