summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-api/navigation-methods/navigate-state-repeated.html
blob: 227bbb0cfcce4d752a840e0bf6dde568bba29d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
  navigation.onnavigate = e => e.intercept();

  let result1 = navigation.navigate('/foo', {state: {foo: 1}});
  assert_equals(navigation.currentEntry.getState().foo, 1);

  // Don't let the harness fail because of the "AbortError" DOMException that is caused by interrupting the navigation.
  result1.finished.catch(() => {});

  let result2 = navigation.navigate('/foo', {state: {foo: 2}});
  assert_equals(navigation.currentEntry.getState().foo, 2);

  await result1.committed;
  await result2.committed;
}, "navigate() with state should work correctly when called repeatedly");
</script>