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 var records; |
| 6 function observer(r) { |
| 7 records = r; |
| 8 } |
| 9 |
| 10 Object.defineProperty(Array.prototype, '0', { |
| 11 get: function() { return 0; }, |
| 12 set: function() { throw "boom!"; } |
| 13 }); |
| 14 arr = [1, 2]; |
| 15 Array.observe(arr, observer); |
| 16 arr.length = 0; |
| 17 assertEquals(0, arr.length); |
| 18 |
| 19 Object.deliverChangeRecords(observer); |
| 20 assertEquals(1, records.length); |
| 21 assertEquals('splice', records[0].type); |
| 22 assertArrayEquals([1, 2], records[0].removed); |
OLD | NEW |