Debian Codegraph @

js/src/jit-test/tests/ion/bug913749.js

raw
1 y = new Float32Array(11);
2 x = [];
3
4 Object.defineProperty(x, 18, {
5 get: (function() {
6 y.length;
7 }),
8 });
9 JSON.stringify(this);
10
11 y = undefined;
12
13 // The exact error message varies nondeterministically. Accept several
14 // variations on the theme.
15 var variations = [
16 `y is undefined`,
17 `can't access property "length" of undefined`,
18 `can't access property "length", y is undefined`,
19 `undefined has no properties`,
20 ];
21
22 var hits = 0;
23 for (var i = 0; i < 3; i++) {
24 try {
25 x.toString();
26 } catch (e) {
27 assertEq(e.constructor.name, 'TypeError');
28 if (!variations.includes(e.message))
29 throw new Error(`expected one of ${JSON.stringify(variations)}; got ${String(e.message)}`);
30 hits++;
31 }
32 }
33 assertEq(hits, 3);