Debian Codegraph @

js/src/jit-test/tests/typedarray/define-property-oob.js

raw
1 const ta = new Int32Array(1);
2 const desc = {value: 0, writable: true, enumerable: true, configurable: true};
3
4 // Out-of-bounds with an int32 index.
5 for (let i = 0; i < 1000; ++i) {
6 let didThrow = false;
7 try {
8 Object.defineProperty(ta, 10, desc);
9 } catch {
10 didThrow = true;
11 }
12 assertEq(didThrow, true);
13 }
14
15 // Out-of-bounds with a non-int32 index.
16 for (let i = 0; i < 1000; ++i) {
17 let didThrow = false;
18 try {
19 Object.defineProperty(ta, 12.3, desc);
20 } catch {
21 didThrow = true;
22 }
23 assertEq(didThrow, true);
24 }