diff options
Diffstat (limited to 'testing/web-platform/tests/navigation-api/navigation-history-entry/resources')
8 files changed, 69 insertions, 0 deletions
diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/is_uuid.js b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/is_uuid.js new file mode 100644 index 0000000000..3b855c01b0 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/is_uuid.js @@ -0,0 +1,3 @@ +function isUUID(key) { + return /[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/.test(key); +} diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/key-navigate-back-cross-document-helper.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/key-navigate-back-cross-document-helper.html new file mode 100644 index 0000000000..79f3c3da0a --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/key-navigate-back-cross-document-helper.html @@ -0,0 +1,27 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script> + // Wait for after the load event so that the navigation doesn't get converted + // into a replace navigation. +window.onload = () => step_timeout(() => { + if (location.search == "?go-back") { + assert_equals(navigation.entries().length, 2); + assert_equals(navigation.currentEntry.index, 1); + // Step 2: Navigate back. + history.back(); + return; + } + if (top.start_key) { + assert_equals(navigation.entries().length, 2); + assert_equals(navigation.currentEntry.index, 0); + // Step 3: Notify parent, which will ensure the same key is used after back navigation. + top.finish(navigation.currentEntry.key, navigation.currentEntry.id); + return; + } + // Step 1: Record initial key and navigate. + assert_equals(navigation.entries().length, 1); + top.start_key = navigation.currentEntry.key; + top.start_id = navigation.currentEntry.id; + location.search = "go-back"; +}, 0); +</script> diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer-meta.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer-meta.html new file mode 100644 index 0000000000..bd5ec391cc --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer-meta.html @@ -0,0 +1,2 @@ +<meta name="referrer" content="no-referrer"> +<body></body> diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer.html new file mode 100644 index 0000000000..c8b7661f42 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer.html @@ -0,0 +1 @@ +<body></body> diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer.html.headers b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer.html.headers new file mode 100644 index 0000000000..7ffbf17d6b --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/no-referrer.html.headers @@ -0,0 +1 @@ +Referrer-Policy: no-referrer diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/opaque-origin-page.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/opaque-origin-page.html new file mode 100644 index 0000000000..98e2c1b317 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/opaque-origin-page.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<!-- Put this page in a sandbox to give it an opaque origin --> + +<script> +promise_test(async t => { + // Wait for after the load event so that the navigation doesn't get converted + // into a replace navigation. + await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); + + location.hash = "#1"; + await new Promise(resolve => window.onhashchange = resolve); + location.hash = "#2"; + await new Promise(resolve => window.onhashchange = resolve); + history.back(); + await new Promise(resolve => window.onhashchange = resolve); + + assert_equals(location.hash, "#1"); + + assert_equals(navigation.currentEntry, null); + assert_equals(navigation.entries().length, 0); + assert_false(navigation.canGoBack); + assert_false(navigation.canGoForward); +}, "navigation.currentEntry/entries()/canGoBack/canGoForward in an opaque origin iframe"); +</script> diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/post-entries-length-to-top.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/post-entries-length-to-top.html new file mode 100644 index 0000000000..c8fe005d8e --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/post-entries-length-to-top.html @@ -0,0 +1,7 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script> +// Wait for after the load event so that the navigation doesn't get converted +// into a replace navigation. +window.onload = () => step_timeout(() => top.postMessage(navigation.entries().length, "*"), 0); +</script> diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/post-key-to-top.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/post-key-to-top.html new file mode 100644 index 0000000000..285f345dc1 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/resources/post-key-to-top.html @@ -0,0 +1,3 @@ +<script> +top.postMessage(navigation.currentEntry.key, "*"); +</script> |