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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 { object: obj, name: "1", type: "updated", oldValue: 6 }, | 316 { object: obj, name: "1", type: "updated", oldValue: 6 }, |
317 { object: obj, name: "1", type: "reconfigured", oldValue: 8 }, | 317 { object: obj, name: "1", type: "reconfigured", oldValue: 8 }, |
318 { object: obj, name: "1", type: "reconfigured", oldValue: 7 }, | 318 { object: obj, name: "1", type: "reconfigured", oldValue: 7 }, |
319 // TODO(observe): oldValue should not be present below. | 319 // TODO(observe): oldValue should not be present below. |
320 { object: obj, name: "1", type: "deleted", oldValue: undefined }, | 320 { object: obj, name: "1", type: "deleted", oldValue: undefined }, |
321 { object: obj, name: "1", type: "new" }, | 321 { object: obj, name: "1", type: "new" }, |
322 // TODO(observe): oldValue should be absent below, and type = "reconfigured". | 322 // TODO(observe): oldValue should be absent below, and type = "reconfigured". |
323 { object: obj, name: "1", type: "updated", oldValue: undefined }, | 323 { object: obj, name: "1", type: "updated", oldValue: undefined }, |
324 { object: obj, name: "1", type: "updated", oldValue: 9 }, | 324 { object: obj, name: "1", type: "updated", oldValue: 9 }, |
325 ]); | 325 ]); |
| 326 |
| 327 |
| 328 // Assignments in loops (checking different IC states). |
| 329 reset(); |
| 330 var obj = {}; |
| 331 Object.observe(obj, observer.callback); |
| 332 for (var i = 0; i < 5; i++) { |
| 333 obj["a" + i] = i; |
| 334 } |
| 335 Object.deliverChangeRecords(observer.callback); |
| 336 observer.assertCallbackRecords([ |
| 337 { object: obj, name: "a0", type: "new" }, |
| 338 { object: obj, name: "a1", type: "new" }, |
| 339 { object: obj, name: "a2", type: "new" }, |
| 340 { object: obj, name: "a3", type: "new" }, |
| 341 { object: obj, name: "a4", type: "new" }, |
| 342 ]); |
| 343 |
| 344 reset(); |
| 345 var obj = {}; |
| 346 Object.observe(obj, observer.callback); |
| 347 for (var i = 0; i < 5; i++) { |
| 348 obj[i] = i; |
| 349 } |
| 350 Object.deliverChangeRecords(observer.callback); |
| 351 observer.assertCallbackRecords([ |
| 352 { object: obj, name: "0", type: "new" }, |
| 353 { object: obj, name: "1", type: "new" }, |
| 354 { object: obj, name: "2", type: "new" }, |
| 355 { object: obj, name: "3", type: "new" }, |
| 356 { object: obj, name: "4", type: "new" }, |
| 357 ]); |
OLD | NEW |