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