summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/realms/bug1513665.js
blob: 6fd803b4869803f4192f84820602c54d5ed9fa6e (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
load(libdir + "asserts.js");

var g = newGlobal();

function testArrayOf() {
    var a = Array.of.call(g.Array);
    assertEq(a instanceof g.Array, true);
}
testArrayOf();

function testPromiseThen() {
    var p = Promise.resolve(0);
    p.constructor = g.Promise;
    var r = p.then(() => {});
    assertEq(r instanceof g.Promise, true);
}
testPromiseThen();

function testPromiseCatch() {
    Boolean.prototype.then = g.Promise.prototype.then;
    assertThrowsInstanceOf(() => Promise.prototype.catch.call(false),
                           g.TypeError);
}
testPromiseCatch();