<!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>
