summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/ShadowRealms/ccw-2.js
blob: 5a60341a652d82dfccab4375d7a3345a39df1211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell)

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

var sr = new ShadowRealm();

var f = sr.evaluate(`
  var wrappedCCW;
  (f => { wrappedCCW = f; });
`);

f(g.evaluate(`x => x()`));

var h = sr.evaluate(`
  // Pass an object from the ShadowRealm's compartment to the CCW function.
  wrappedCCW(() => { return "ok"; })
`);

assertEq(h, "ok");

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