Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 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 | (function () { |
| 6 | var o = []; |
| 7 | o.__proto__ = {}; |
| 8 | |
| 9 | function store(o, i, v) { |
| 10 | o[i] = v; |
| 11 | } |
| 12 | |
| 13 | store(o, 0, 0); |
| 14 | store(o, 1, 0); |
| 15 | store(o, 2, 0); |
| 16 | o.__proto__[10000000] = 1; |
| 17 | |
| 18 | var set = 0; |
| 19 | |
| 20 | Object.defineProperty(o, "3", { |
| 21 | get:function() { return 100; }, |
| 22 | set:function(v) { set = v; }}); |
| 23 | |
| 24 | store(o, 3, 1000); |
| 25 | assertEquals(1000, set); |
| 26 | assertEquals(100, o[3]); |
| 27 | })(); |
| 28 | |
| 29 | (function () { |
| 30 | var o = new Int32Array(); |
| 31 | Object.defineProperty(o, "0", {get: function(){}}); |
| 32 | assertEquals(undefined, Object.getOwnPropertyDescriptor(o, "0")); |
| 33 | })(); |