js/src/jit-test/tests/collections/Array-of-cross-compartment.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/collections/Array-of-cross-compartment.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,10 @@
     1.4 +// Array.of returns an object in the target compartment, not the caller's compartment.
     1.5 +// This rules out implementations along the lines of (...args) => args.
     1.6 +
     1.7 +var g = newGlobal();
     1.8 +var ga = g.Array.of(1, 2, 3);
     1.9 +assertEq(ga instanceof g.Array, true);
    1.10 +
    1.11 +g.Array.of = Array.of;
    1.12 +var a = g.Array.of(1, 2, 3); // this-value is a wrapper of g.Array, which IsConstructor, so we call it
    1.13 +assertEq(ga instanceof g.Array, true);  // it produces a g.Array instance

mercurial