summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/unhandled-rejections-dead-2.js
blob: ef42340fde54a25739346a7c63c3b3dde4a2f537 (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
// |jit-test| error:Unhandled rejection

var g = newGlobal({newCompartment: true})
g.outer = this;
g.eval(`
  // Create a new Promise in |outer| using new.target, but with
  // resolver functions in |g|.
  var resolvers;
  var p = Reflect.construct(Promise, [
    (resolve, reject) => {
      resolvers = {resolve, reject};
    }
  ], outer.Promise);

  resolvers.resolve({
    get then() {
      // Throw from the about to be nuked compartment.
      throw null;
    }
  });
`);

// Nuke CCWs, including the SavedFrame for the Promise resolution info.
nukeAllCCWs();