1 // META: global=window,worker
2 // META: script=/common/sab.js
4 ["ArrayBuffer", "SharedArrayBuffer"].forEach(arrayBufferOrSharedArrayBuffer => {
6 const buf = createBuffer(arrayBufferOrSharedArrayBuffer, 2);
7 const view = new Uint8Array(buf);
8 const buf2 = createBuffer(arrayBufferOrSharedArrayBuffer, 2);
9 const view2 = new Uint8Array(buf2);
10 const decoder = new TextDecoder("utf-8");
15 assert_equals(decoder.decode(buf, {stream:true}), "");
18 assert_equals(decoder.decode(buf2), "@");
19 }, "Modify buffer after passing it in (" + arrayBufferOrSharedArrayBuffer + ")");