summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-unserializable-state.html
blob: 36464ec3c54edfc92048a466c07f94735f725ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>

<script>
promise_test(async t => {
  await assertBothRejectDOM(t, navigation.navigate("#1", { state: new WritableStream() }), "DataCloneError");
  assert_equals(navigation.currentEntry.getState(), undefined);
  assert_equals(location.hash, "");
}, "navigate() with an unserializable state (WritableStream)");

promise_test(async t => {
  // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
  const buffer = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer;

  await assertBothRejectDOM(t, navigation.navigate("#2", { state: buffer }), "DataCloneError");
  assert_equals(navigation.currentEntry.getState(), undefined);
  assert_equals(location.hash, "");
}, "navigate() with an unserializable state (SharedArrayBuffer)");
</script>