diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/collections/Array-of-cross-compartment.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/collections/Array-of-cross-compartment.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,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