wasm-resizablearraybuffer-cloning.js (593B)
1 // |jit-test| skip-if: !wasmThreadsEnabled() || !('toResizableBuffer' in WebAssembly.Memory.prototype) 2 3 // When serializing and deserializing a SAB extracted from a memory, the length 4 // of the SAB should not change even if the memory was grown after serialization 5 // and before deserialization. 6 7 let mem = new WebAssembly.Memory({initial: 2, maximum: 4, shared: true}); 8 let buf = mem.toResizableBuffer(); 9 let clonedbuf = serialize(buf, [], {SharedArrayBuffer: 'allow'}); 10 mem.grow(1); 11 let buf2 = deserialize(clonedbuf, {SharedArrayBuffer: 'allow'}); 12 assertEq(buf.byteLength, buf2.byteLength);