diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/collections/Array-of-length-setter-2.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/collections/Array-of-length-setter-2.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,13 @@ +// Array.of does a strict assignment to the new object's .length. +// The assignment is strict even if the code we're calling from is not strict. + +load(libdir + "asserts.js"); + +function Empty() {} +Empty.of = Array.of; +Object.defineProperty(Empty.prototype, "length", {get: () => 0}); + +var nothing = new Empty; +nothing.length = 2; // no exception; this is not a strict mode assignment + +assertThrowsInstanceOf(() => Empty.of(), TypeError);