1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/collections/Array-of-length-setter-2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,13 @@ 1.4 +// Array.of does a strict assignment to the new object's .length. 1.5 +// The assignment is strict even if the code we're calling from is not strict. 1.6 + 1.7 +load(libdir + "asserts.js"); 1.8 + 1.9 +function Empty() {} 1.10 +Empty.of = Array.of; 1.11 +Object.defineProperty(Empty.prototype, "length", {get: () => 0}); 1.12 + 1.13 +var nothing = new Empty; 1.14 +nothing.length = 2; // no exception; this is not a strict mode assignment 1.15 + 1.16 +assertThrowsInstanceOf(() => Empty.of(), TypeError);