summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/toArray/create-in-current-realm.js
blob: 850729e5e36472b013274b91914ebad495875fe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally

const otherGlobal = newGlobal({newCompartment: true});

let array = [1, 2, 3].values().toArray();
assertEq(array instanceof Array, true);
assertEq(array instanceof otherGlobal.Array, false);

array = otherGlobal.Iterator.prototype.toArray.call([1, 2, 3].values());
assertEq(array instanceof Array, false);
assertEq(array instanceof otherGlobal.Array, true);

if (typeof reportCompare === 'function')
  reportCompare(0, 0);