summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Promise/for-of-iterator-uses-getv.js
blob: 28c888d7a3ab2d433da82f4fa4d43d238770a3d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use strict"; // Use strict-mode to ensure |this| arguments aren't converted to objects.

var emptyIterator = {
  next() {
    return {done: true};
  }
};

Object.defineProperty(Number.prototype, Symbol.iterator, {
  configurable: true,
  get() {
    assertEq(typeof this, "number");
    return function() {
      assertEq(typeof this, "number");
      return emptyIterator;
    }
  }
});

Promise.all(0);
Promise.allSettled(0);
Promise.race(0);

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