| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 type: 'updated', | 252 type: 'updated', |
| 253 }); | 253 }); |
| 254 Object.observe(obj, observer.callback); | 254 Object.observe(obj, observer.callback); |
| 255 Object.getNotifier(obj).notify({ | 255 Object.getNotifier(obj).notify({ |
| 256 type: 'updated', | 256 type: 'updated', |
| 257 }); | 257 }); |
| 258 records = undefined; | 258 records = undefined; |
| 259 Object.deliverChangeRecords(observer.callback); | 259 Object.deliverChangeRecords(observer.callback); |
| 260 observer.assertRecordCount(1); | 260 observer.assertRecordCount(1); |
| 261 | 261 |
| 262 // Get notifier prior to observing |
| 263 reset(); |
| 264 var obj = {}; |
| 265 Object.getNotifier(obj); |
| 266 Object.observe(obj, observer.callback); |
| 267 obj.id = 1; |
| 268 Object.deliverChangeRecords(observer.callback); |
| 269 observer.assertCallbackRecords([ |
| 270 { object: obj, type: 'new', name: 'id' }, |
| 271 ]); |
| 262 | 272 |
| 263 // Observing a continuous stream of changes, while itermittantly unobserving. | 273 // Observing a continuous stream of changes, while itermittantly unobserving. |
| 264 reset(); | 274 reset(); |
| 265 Object.observe(obj, observer.callback); | 275 Object.observe(obj, observer.callback); |
| 266 Object.getNotifier(obj).notify({ | 276 Object.getNotifier(obj).notify({ |
| 267 type: 'updated', | 277 type: 'updated', |
| 268 val: 1 | 278 val: 1 |
| 269 }); | 279 }); |
| 270 | 280 |
| 271 Object.unobserve(obj, observer.callback); | 281 Object.unobserve(obj, observer.callback); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 delete obj[symbol]; | 786 delete obj[symbol]; |
| 777 obj.__defineSetter__(symbol, function() {}); | 787 obj.__defineSetter__(symbol, function() {}); |
| 778 obj.__defineGetter__(symbol, function() {}); | 788 obj.__defineGetter__(symbol, function() {}); |
| 779 Object.deliverChangeRecords(observer.callback); | 789 Object.deliverChangeRecords(observer.callback); |
| 780 observer.assertNotCalled(); | 790 observer.assertNotCalled(); |
| 781 | 791 |
| 782 | 792 |
| 783 // Test all kinds of objects generically. | 793 // Test all kinds of objects generically. |
| 784 function TestObserveConfigurable(obj, prop) { | 794 function TestObserveConfigurable(obj, prop) { |
| 785 reset(); | 795 reset(); |
| 796 Object.observe(obj, observer.callback); |
| 797 Object.unobserve(obj, observer.callback); |
| 786 obj[prop] = 1; | 798 obj[prop] = 1; |
| 787 Object.observe(obj, observer.callback); | 799 Object.observe(obj, observer.callback); |
| 788 obj[prop] = 2; | 800 obj[prop] = 2; |
| 789 obj[prop] = 3; | 801 obj[prop] = 3; |
| 790 delete obj[prop]; | 802 delete obj[prop]; |
| 791 obj[prop] = 4; | 803 obj[prop] = 4; |
| 792 obj[prop] = 4; // ignored | 804 obj[prop] = 4; // ignored |
| 793 obj[prop] = 5; | 805 obj[prop] = 5; |
| 794 Object.defineProperty(obj, prop, {value: 6}); | 806 Object.defineProperty(obj, prop, {value: 6}); |
| 795 Object.defineProperty(obj, prop, {writable: false}); | 807 Object.defineProperty(obj, prop, {writable: false}); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 { object: obj, name: prop, type: "updated", oldValue: 12 }, | 857 { object: obj, name: prop, type: "updated", oldValue: 12 }, |
| 846 { object: obj, name: prop, type: "deleted", oldValue: 36 }, | 858 { object: obj, name: prop, type: "deleted", oldValue: 36 }, |
| 847 { object: obj, name: prop, type: "new" }, | 859 { object: obj, name: prop, type: "new" }, |
| 848 ]); | 860 ]); |
| 849 Object.unobserve(obj, observer.callback); | 861 Object.unobserve(obj, observer.callback); |
| 850 delete obj[prop]; | 862 delete obj[prop]; |
| 851 } | 863 } |
| 852 | 864 |
| 853 function TestObserveNonConfigurable(obj, prop, desc) { | 865 function TestObserveNonConfigurable(obj, prop, desc) { |
| 854 reset(); | 866 reset(); |
| 867 Object.observe(obj, observer.callback); |
| 868 Object.unobserve(obj, observer.callback); |
| 855 obj[prop] = 1; | 869 obj[prop] = 1; |
| 856 Object.observe(obj, observer.callback); | 870 Object.observe(obj, observer.callback); |
| 857 obj[prop] = 4; | 871 obj[prop] = 4; |
| 858 obj[prop] = 4; // ignored | 872 obj[prop] = 4; // ignored |
| 859 obj[prop] = 5; | 873 obj[prop] = 5; |
| 860 Object.defineProperty(obj, prop, {value: 6}); | 874 Object.defineProperty(obj, prop, {value: 6}); |
| 861 Object.defineProperty(obj, prop, {value: 6}); // ignored | 875 Object.defineProperty(obj, prop, {value: 6}); // ignored |
| 862 Object.defineProperty(obj, prop, {value: 7}); | 876 Object.defineProperty(obj, prop, {value: 7}); |
| 863 Object.defineProperty(obj, prop, {enumerable: desc.enumerable}); // ignored | 877 Object.defineProperty(obj, prop, {enumerable: desc.enumerable}); // ignored |
| 864 Object.defineProperty(obj, prop, {writable: false}); | 878 Object.defineProperty(obj, prop, {writable: false}); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 for (var n1 = 0; n1 < 3; ++n1) | 1526 for (var n1 = 0; n1 < 3; ++n1) |
| 1513 for (var n2 = 0; n2 < 3; ++n2) | 1527 for (var n2 = 0; n2 < 3; ++n2) |
| 1514 for (var i in mutation) | 1528 for (var i in mutation) |
| 1515 TestFastElementsLength(mutation[i], b1 != 0, b2 != 0, 20*n1, 20*n2); | 1529 TestFastElementsLength(mutation[i], b1 != 0, b2 != 0, 20*n1, 20*n2); |
| 1516 | 1530 |
| 1517 for (var b1 = 0; b1 < 2; ++b1) | 1531 for (var b1 = 0; b1 < 2; ++b1) |
| 1518 for (var b2 = 0; b2 < 2; ++b2) | 1532 for (var b2 = 0; b2 < 2; ++b2) |
| 1519 for (var n = 0; n < 3; ++n) | 1533 for (var n = 0; n < 3; ++n) |
| 1520 for (var i in mutationByIncr) | 1534 for (var i in mutationByIncr) |
| 1521 TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1); | 1535 TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1); |
| OLD | NEW |