summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/async-functions/clone.js
blob: 42d4b883df9e6ab6363e408efb1c35c06729c916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |reftest| skip-if(!xulRuntime.shell) -- needs cloneAndExecuteScript, drainJobQueue

// Async function source code scripts can be cloned.
let g = newGlobal();
cloneAndExecuteScript(`
async function f() {
  var a = await 1;
  var b = await 2;
  var c = await 3;
  return a + b + c;
}
var V;
f().then(v => V = v);
drainJobQueue();
`, g);
assertEq(g.V, 6);

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