summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Array-of-4.js
blob: 0bb1c8b8f49737ac131a6fd8c24e4b8a1edb5d6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Array.of does not trigger prototype setters.
// (It defines elements rather than assigning to them.)

var status = "pass";
Object.defineProperty(Array.prototype, "0", {set: v => status = "FAIL 1"});
assertEq(Array.of(1)[0], 1);
assertEq(status, "pass");

function Bag() {}
Bag.of = Array.of;
Object.defineProperty(Bag.prototype, "0", {set: v => status = "FAIL 2"});
assertEq(Bag.of(1)[0], 1);
assertEq(status, "pass");