aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/tests/navigation-api/precommit-handler/precommitHandler-uncancelable.html
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wpt/tests/navigation-api/precommit-handler/precommitHandler-uncancelable.html')
-rw-r--r--tests/wpt/tests/navigation-api/precommit-handler/precommitHandler-uncancelable.html24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/wpt/tests/navigation-api/precommit-handler/precommitHandler-uncancelable.html b/tests/wpt/tests/navigation-api/precommit-handler/precommitHandler-uncancelable.html
new file mode 100644
index 00000000000..af320b4e32c
--- /dev/null
+++ b/tests/wpt/tests/navigation-api/precommit-handler/precommitHandler-uncancelable.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<iframe id="i" src="/common/blank.html"></iframe>
+<body>
+<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));
+
+ await i.contentWindow.navigation.navigate("#1").finished;
+
+ i.contentWindow.navigation.onnavigate = t.step_func(e => {
+ assert_false(e.cancelable);
+ // intercept() with a precommitHandler is forbidden because e.cancelable is false.
+ let iframe_constructor = i.contentWindow.DOMException;
+ assert_throws_dom("InvalidStateError", iframe_constructor,
+ () => e.intercept({ precommitHandler: async () => {} }));
+ });
+ await i.contentWindow.navigation.back().finished;
+}, "precommitHandler for an uncancelable traverse navigation");
+</script>
+</body>