Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
<!DOCTYPE html>
<meta charset="utf-8">
<title>SharedArrayBuffers cloning via history's methods invoking StructuredSerializeForStorage</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
for (const method of ["pushState", "replaceState"]) {
test(() => {
assert_throws_dom("DataCloneError", () => {
history[method](new SharedArrayBuffer(), "dummy title");
});
}, `history.${method}(): simple case`);
test(() => {
let getter1Called = false;
let getter2Called = false;
assert_throws_dom("DataCloneError", () => {
history[method]([
{ get x() { getter1Called = true; return 5; } },
new SharedArrayBuffer(),
{ get x() { getter2Called = true; return 5; } }
], "dummy title");
});
assert_true(getter1Called, "The getter before the SAB must have been called");
assert_false(getter2Called, "The getter after the SAB must not have been called");
}, `history.${method}(): is interleaved correctly`);
}
</script>