unserializable.html (1136B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="iframe" src="/common/blank.html"></iframe> 5 6 <script> 7 setup({ explicit_done: true }); 8 9 window.onload = () => { 10 test(() => { 11 assert_throws_dom("DataCloneError", iframe.contentWindow.DOMException, () => { 12 iframe.contentWindow.navigation.updateCurrentEntry({ state: new WritableStream() }); 13 }); 14 assert_equals(navigation.currentEntry.getState(), undefined); 15 }, "updateCurrentEntry() must throw if state is unserializable (WritableStream)"); 16 17 test(() => { 18 // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()` 19 const buffer = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer; 20 21 assert_throws_dom("DataCloneError", iframe.contentWindow.DOMException, () => { 22 iframe.contentWindow.navigation.updateCurrentEntry({ state: buffer }); 23 }); 24 assert_equals(navigation.currentEntry.getState(), undefined); 25 }, "updateCurrentEntry() must throw if state is unserializable (SharedArrayBuffer)"); 26 27 done(); 28 }; 29 </script>