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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 { object: obj, name: "a", type: "reconfigured", oldValue: 6 }, | 275 { object: obj, name: "a", type: "reconfigured", oldValue: 6 }, |
276 { object: obj, name: "a", type: "updated", oldValue: 6 }, | 276 { object: obj, name: "a", type: "updated", oldValue: 6 }, |
277 { object: obj, name: "a", type: "reconfigured", oldValue: 8 }, | 277 { object: obj, name: "a", type: "reconfigured", oldValue: 8 }, |
278 { object: obj, name: "a", type: "reconfigured", oldValue: 7 }, | 278 { object: obj, name: "a", type: "reconfigured", oldValue: 7 }, |
279 { object: obj, name: "a", type: "reconfigured" }, | 279 { object: obj, name: "a", type: "reconfigured" }, |
280 { object: obj, name: "a", type: "deleted" }, | 280 { object: obj, name: "a", type: "deleted" }, |
281 { object: obj, name: "a", type: "new" }, | 281 { object: obj, name: "a", type: "new" }, |
282 { object: obj, name: "a", type: "reconfigured" }, | 282 { object: obj, name: "a", type: "reconfigured" }, |
283 { object: obj, name: "a", type: "updated", oldValue: 9 }, | 283 { object: obj, name: "a", type: "updated", oldValue: 9 }, |
284 ]); | 284 ]); |
| 285 |
| 286 // Observing indexed properties. |
| 287 reset(); |
| 288 var obj = {'1': 1} |
| 289 Object.observe(obj, observer.callback); |
| 290 obj[1] = 2; |
| 291 obj[1] = 3; |
| 292 delete obj[1]; |
| 293 obj[1] = 4; |
| 294 obj[1] = 4; // ignored |
| 295 obj[1] = 5; |
| 296 Object.defineProperty(obj, "1", {value: 6}); |
| 297 Object.defineProperty(obj, "1", {writable: false}); |
| 298 obj[1] = 7; // ignored |
| 299 Object.defineProperty(obj, "1", {value: 8}); |
| 300 Object.defineProperty(obj, "1", {value: 7, writable: true}); |
| 301 Object.defineProperty(obj, "1", {get: function() {}}); |
| 302 delete obj[1]; |
| 303 delete obj[1]; |
| 304 Object.defineProperty(obj, "1", {get: function() {}, configurable: true}); |
| 305 Object.defineProperty(obj, "1", {value: 9, writable: true}); |
| 306 obj[1] = 10; |
| 307 Object.deliverChangeRecords(observer.callback); |
| 308 observer.assertCallbackRecords([ |
| 309 { object: obj, name: "1", type: "updated", oldValue: 1 }, |
| 310 { object: obj, name: "1", type: "updated", oldValue: 2 }, |
| 311 { object: obj, name: "1", type: "deleted", oldValue: 3 }, |
| 312 { object: obj, name: "1", type: "new" }, |
| 313 { object: obj, name: "1", type: "updated", oldValue: 4 }, |
| 314 { object: obj, name: "1", type: "updated", oldValue: 5 }, |
| 315 { object: obj, name: "1", type: "reconfigured", oldValue: 6 }, |
| 316 { object: obj, name: "1", type: "updated", oldValue: 6 }, |
| 317 { object: obj, name: "1", type: "reconfigured", oldValue: 8 }, |
| 318 { object: obj, name: "1", type: "reconfigured", oldValue: 7 }, |
| 319 // TODO(observe): oldValue should not be present below. |
| 320 { object: obj, name: "1", type: "deleted", oldValue: undefined }, |
| 321 { object: obj, name: "1", type: "new" }, |
| 322 // TODO(observe): oldValue should be absent below, and type = "reconfigured". |
| 323 { object: obj, name: "1", type: "updated", oldValue: undefined }, |
| 324 { object: obj, name: "1", type: "updated", oldValue: 9 }, |
| 325 ]); |
OLD | NEW |