Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /encoding/textdecoder-copy.any.html - WPT Dashboard Interop Dashboard
- /encoding/textdecoder-copy.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /encoding/textdecoder-copy.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /encoding/textdecoder-copy.any.worker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker
// META: script=/common/sab.js
["ArrayBuffer", "SharedArrayBuffer"].forEach(arrayBufferOrSharedArrayBuffer => {
test(() => {
const buf = createBuffer(arrayBufferOrSharedArrayBuffer, 2);
const view = new Uint8Array(buf);
const buf2 = createBuffer(arrayBufferOrSharedArrayBuffer, 2);
const view2 = new Uint8Array(buf2);
const decoder = new TextDecoder("utf-8");
view[0] = 0xEF;
view[1] = 0xBB;
view2[0] = 0xBF;
view2[1] = 0x40;
assert_equals(decoder.decode(buf, {stream:true}), "");
view[0] = 0x01;
view[1] = 0x02;
assert_equals(decoder.decode(buf2), "@");
}, "Modify buffer after passing it in (" + arrayBufferOrSharedArrayBuffer + ")");
});