summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Array-of-cross-compartment.js
blob: 5872a98fd586100b64ed600a3a0f7cd5a3ad41c6 (plain)
1
2
3
4
5
6
7
8
9
10
// Array.of returns an object in the target compartment, not the caller's compartment.
// This rules out implementations along the lines of (...args) => args.

var g = newGlobal();
var ga = g.Array.of(1, 2, 3);
assertEq(ga instanceof g.Array, true);

g.Array.of = Array.of;
var a = g.Array.of(1, 2, 3); // this-value is a wrapper of g.Array, which IsConstructor, so we call it
assertEq(ga instanceof g.Array, true);  // it produces a g.Array instance