summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Temporal/TimeZone/getPossibleInstantsFor-returns-dead-proxy.js
blob: 0af1889bea0c04fc64aab376ec1414e4dea934f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// |reftest| skip-if(!this.hasOwnProperty("Temporal")||!xulRuntime.shell)

var g = newGlobal({newCompartment: true});

var tz = new class extends Temporal.TimeZone {
  *getPossibleInstantsFor() {
    // Return an Instant from a different compartment.
    yield new g.Temporal.Instant(0n);

    // Turn the CCW into a dead proxy wrapper.
    nukeAllCCWs();
  }
}("UTC");

var dt = new Temporal.PlainDateTime(2000, 1, 1);

// Throws a TypeError when attempting to unwrap the dead proxy.
assertThrowsInstanceOf(() => dt.toZonedDateTime(tz), TypeError);

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