| 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 889 |
| 890 // __proto__ | 890 // __proto__ |
| 891 reset(); | 891 reset(); |
| 892 var obj = {}; | 892 var obj = {}; |
| 893 Object.observe(obj, observer.callback); | 893 Object.observe(obj, observer.callback); |
| 894 var p = {foo: 'yes'}; | 894 var p = {foo: 'yes'}; |
| 895 var q = {bar: 'no'}; | 895 var q = {bar: 'no'}; |
| 896 obj.__proto__ = p; | 896 obj.__proto__ = p; |
| 897 obj.__proto__ = p; // ignored | 897 obj.__proto__ = p; // ignored |
| 898 obj.__proto__ = null; | 898 obj.__proto__ = null; |
| 899 obj.__proto__ = q; | 899 obj.__proto__ = q; // the __proto__ accessor is gone |
| 900 // TODO(adamk): Add tests for objects with hidden prototypes | 900 // TODO(adamk): Add tests for objects with hidden prototypes |
| 901 // once we support observing the global object. | 901 // once we support observing the global object. |
| 902 Object.deliverChangeRecords(observer.callback); | 902 Object.deliverChangeRecords(observer.callback); |
| 903 observer.assertCallbackRecords([ | 903 observer.assertCallbackRecords([ |
| 904 { object: obj, name: '__proto__', type: 'prototype', | 904 { object: obj, name: '__proto__', type: 'prototype', |
| 905 oldValue: Object.prototype }, | 905 oldValue: Object.prototype }, |
| 906 { object: obj, name: '__proto__', type: 'prototype', oldValue: p }, | 906 { object: obj, name: '__proto__', type: 'prototype', oldValue: p }, |
| 907 { object: obj, name: '__proto__', type: 'prototype', oldValue: null }, | 907 { object: obj, name: '__proto__', type: 'new' }, |
| 908 ]); | 908 ]); |
| 909 | 909 |
| 910 | 910 |
| 911 // Function.prototype | 911 // Function.prototype |
| 912 reset(); | 912 reset(); |
| 913 var fun = function(){}; | 913 var fun = function(){}; |
| 914 Object.observe(fun, observer.callback); | 914 Object.observe(fun, observer.callback); |
| 915 var myproto = {foo: 'bar'}; | 915 var myproto = {foo: 'bar'}; |
| 916 fun.prototype = myproto; | 916 fun.prototype = myproto; |
| 917 fun.prototype = 7; | 917 fun.prototype = 7; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 for (var n1 = 0; n1 < 3; ++n1) | 1045 for (var n1 = 0; n1 < 3; ++n1) |
| 1046 for (var n2 = 0; n2 < 3; ++n2) | 1046 for (var n2 = 0; n2 < 3; ++n2) |
| 1047 for (var i in mutation) | 1047 for (var i in mutation) |
| 1048 TestFastElementsLength(mutation[i], b1 != 0, b2 != 0, 20*n1, 20*n2); | 1048 TestFastElementsLength(mutation[i], b1 != 0, b2 != 0, 20*n1, 20*n2); |
| 1049 | 1049 |
| 1050 for (var b1 = 0; b1 < 2; ++b1) | 1050 for (var b1 = 0; b1 < 2; ++b1) |
| 1051 for (var b2 = 0; b2 < 2; ++b2) | 1051 for (var b2 = 0; b2 < 2; ++b2) |
| 1052 for (var n = 0; n < 3; ++n) | 1052 for (var n = 0; n < 3; ++n) |
| 1053 for (var i in mutationByIncr) | 1053 for (var i in mutationByIncr) |
| 1054 TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1); | 1054 TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1); |
| OLD | NEW |