summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testDetach.js
blob: fc49e3f99ea8a73101b2b9ba321d917b5991a281 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var ab = new ArrayBuffer(4);
var i32 = new Int32Array(ab);
i32[0] = 42;
detachArrayBuffer(ab);
assertEq(i32.length, 0);
assertEq(ab.byteLength, 0);
assertEq(i32[0], undefined);

var ab = new ArrayBuffer(12);
var i32 = new Int32Array(ab);
i32[0] = 42;
detachArrayBuffer(ab);
assertEq(i32.length, 0);
assertEq(ab.byteLength, 0);
assertEq(i32[0], undefined);

var ab = new ArrayBuffer(4096);
var i32 = new Int32Array(ab);
i32[0] = 42;
detachArrayBuffer(ab);
assertEq(i32.length, 0);
assertEq(ab.byteLength, 0);
assertEq(i32[0], undefined);