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