1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/collections/Array-of-4.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,13 @@ 1.4 +// Array.of does not trigger prototype setters. 1.5 +// (It defines elements rather than assigning to them.) 1.6 + 1.7 +var status = "pass"; 1.8 +Object.defineProperty(Array.prototype, "0", {set: v => status = "FAIL 1"}); 1.9 +assertEq(Array.of(1)[0], 1); 1.10 +assertEq(status, "pass"); 1.11 + 1.12 +function Bag() {} 1.13 +Bag.of = Array.of; 1.14 +Object.defineProperty(Bag.prototype, "0", {set: v => status = "FAIL 2"}); 1.15 +assertEq(Bag.of(1)[0], 1); 1.16 +assertEq(status, "pass");