OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Based on: https://hg.mozilla.org/mozilla-central/file/d0c3168c3c47/js/src/jit
-test/tests/collections/Array-of-4.js |
| 6 |
| 7 // Flags: --harmony-arrays |
| 8 |
| 9 |
| 10 // Array.of does not trigger prototype setters. |
| 11 |
| 12 // (It defines elements rather than assigning to them.) |
| 13 |
| 14 var status = "pass"; |
| 15 Object.defineProperty(Array.prototype, "0", {set: function(v) {status = "FAIL 1"
}}); |
| 16 assertEquals(Array.of(1)[0], 1); |
| 17 assertEquals(status, "pass"); |
| 18 |
| 19 function Bag() {} |
| 20 Bag.of = Array.of; |
| 21 Object.defineProperty(Bag.prototype, "0", {set: function(v) {status = "FAIL 2"}}
); |
| 22 assertEquals(Bag.of(1)[0], 1); |
| 23 assertEquals(status, "pass"); |
OLD | NEW |