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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
804 Object.observe(dummy, observer.callback); | 804 Object.observe(dummy, observer.callback); |
805 Object.unobserve(dummy, observer.callback); | 805 Object.unobserve(dummy, observer.callback); |
806 var array = [0]; | 806 var array = [0]; |
807 Object.observe(array, observer.callback); | 807 Object.observe(array, observer.callback); |
808 array.splice(0, 1); | 808 array.splice(0, 1); |
809 Object.deliverChangeRecords(observer.callback); | 809 Object.deliverChangeRecords(observer.callback); |
810 observer.assertCallbackRecords([ | 810 observer.assertCallbackRecords([ |
811 { object: array, name: '0', type: 'deleted', oldValue: 0 }, | 811 { object: array, name: '0', type: 'deleted', oldValue: 0 }, |
812 { object: array, name: 'length', type: 'updated', oldValue: 1}, | 812 { object: array, name: 'length', type: 'updated', oldValue: 1}, |
813 ]); | 813 ]); |
814 | |
815 // __proto__ | |
816 reset(); | |
817 var obj = {}; | |
818 Object.observe(obj, observer.callback); | |
819 var p = {foo: 'yes'}; | |
820 var q = {bar: 'no'}; | |
821 obj.__proto__ = p; | |
822 obj.__proto__ = p; // ignored | |
823 obj.__proto__ = null; | |
824 obj.__proto__ = q; | |
825 // TODO(adamk): Add tests for objects with hidden prototypes | |
826 // once we support observing the global object. | |
827 Object.deliverChangeRecords(observer.callback); | |
828 observer.assertCallbackRecords([ | |
829 { object: obj, name: '__proto__', type: 'prototype', oldValue: Object.prototyp e }, | |
rossberg
2012/12/03 13:37:41
Line length.
adamk
2012/12/03 19:07:05
Done.
| |
830 { object: obj, name: '__proto__', type: 'prototype', oldValue: p }, | |
831 { object: obj, name: '__proto__', type: 'prototype', oldValue: null }, | |
832 ]); | |
OLD | NEW |