summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/array-holes-slow.js
blob: 7478ee6ac48dbe80b3b595011b1877a3e084cc03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// for-of on a slow Array consults the prototype chain when it encounters a hole.

var a = [0, , , 3];
a.slow = true;
Object.prototype[1] = 'peek1';
Array.prototype[2] = 'peek2';

var log = [];
for (var x of a)
    log.push(x);
assertEq(log[1], 'peek1');
assertEq(log[2], 'peek2');
assertEq(log.join(), "0,peek1,peek2,3");