Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/mjsunit/harmony/object-observe.js

Issue 12212011: Make __proto__ a foreign callback on Object.prototype. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test for issue 2441. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/builtins.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « test/mjsunit/builtins.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698