summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-forward-initial-about-blank.html
blob: dfdb6611ab3f9c50b5c5aafe32acd96600850be9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>

<body>
<script>
promise_test(async t => {
  let i = document.createElement("iframe");
  document.body.append(i);

  i.contentWindow.navigation.onnavigate = t.unreached_func("onnavigate should not be called");
  i.contentWindow.navigation.onnavigatesuccess = t.unreached_func("onnavigatesuccess should not be called");
  i.contentWindow.navigation.onnavigateerror = t.unreached_func("onnavigateerror should not be called");

  // Since there's no way to do a non-replacement navigation on the initial
  // about:blank, there's no way to actually get in a situation where we're on
  // about:blank but there's something else backward/forward in the history
  // list. So this test will almost certainly pass just because there's nothing
  // to go back/forward to. Oh well; it's still reasonable coverage.

  await assertBothRejectDOM(t, i.contentWindow.navigation.back(), "InvalidStateError", i.contentWindow);
  await assertBothRejectDOM(t, i.contentWindow.navigation.forward(), "InvalidStateError", i.contentWindow);
}, "back() and forward() in initial about:blank document");
</script>