OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 { object: obj, name: "1", type: "reconfigured", oldValue: 7 }, | 325 { object: obj, name: "1", type: "reconfigured", oldValue: 7 }, |
326 // TODO(observe): oldValue should not be present below. | 326 // TODO(observe): oldValue should not be present below. |
327 { object: obj, name: "1", type: "deleted", oldValue: undefined }, | 327 { object: obj, name: "1", type: "deleted", oldValue: undefined }, |
328 { object: obj, name: "1", type: "new" }, | 328 { object: obj, name: "1", type: "new" }, |
329 // TODO(observe): oldValue should be absent below, and type = "reconfigured". | 329 // TODO(observe): oldValue should be absent below, and type = "reconfigured". |
330 { object: obj, name: "1", type: "updated", oldValue: undefined }, | 330 { object: obj, name: "1", type: "updated", oldValue: undefined }, |
331 { object: obj, name: "1", type: "updated", oldValue: 9 }, | 331 { object: obj, name: "1", type: "updated", oldValue: 9 }, |
332 { object: obj, name: "1", type: "deleted", oldValue: 10 }, | 332 { object: obj, name: "1", type: "deleted", oldValue: 10 }, |
333 { object: obj, name: "1", type: "new" }, | 333 { object: obj, name: "1", type: "new" }, |
334 ]); | 334 ]); |
335 | |
336 // Observing array length (including truncation) | |
337 reset(); | |
338 var arr = ['a', 'b', 'c', 'd']; | |
339 Object.defineProperty(arr, '0', {configurable: false}); | |
340 Object.defineProperty(arr, '2', {get: function(){}}); | |
rossberg
2012/11/08 14:26:22
Perhaps add the case of a non-configurable accesso
adamk
2012/11/08 14:48:01
Done.
| |
341 Object.observe(arr, observer.callback); | |
342 arr.length = 2; | |
343 arr.length = 0; | |
344 arr.length = 10; | |
345 Object.deliverChangeRecords(observer.callback); | |
346 observer.assertCallbackRecords([ | |
347 { object: arr, name: '3', type: 'deleted', oldValue: 'd' }, | |
348 // TODO(adamk): oldValue should not be present below | |
349 { object: arr, name: '2', type: 'deleted', oldValue: undefined }, | |
350 { object: arr, name: 'length', type: 'updated', oldValue: 4 }, | |
351 { object: arr, name: '1', type: 'deleted', oldValue: 'b' }, | |
352 { object: arr, name: 'length', type: 'updated', oldValue: 2 }, | |
353 { object: arr, name: 'length', type: 'updated', oldValue: 1 }, | |
354 ]); | |
OLD | NEW |