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

load(libdir + "iteration.js");

var m = {1: 'peek'};
var a = [0, , 2, 3];
a.__proto__ = m;
var log = [];
Object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
for (var x of a)
    log.push(x);
assertEq(log[1], 'peek');
assertEq(log.join(), "0,peek,2,3");