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

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

Issue 11299260: Object.observe: notify of __proto__ changes (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix naming and line length Created 8 years 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 | « src/accessors.cc ('k') | no next file » | 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 Object.observe(dummy, observer.callback); 803 Object.observe(dummy, observer.callback);
804 Object.unobserve(dummy, observer.callback); 804 Object.unobserve(dummy, observer.callback);
805 var array = [0]; 805 var array = [0];
806 Object.observe(array, observer.callback); 806 Object.observe(array, observer.callback);
807 array.splice(0, 1); 807 array.splice(0, 1);
808 Object.deliverChangeRecords(observer.callback); 808 Object.deliverChangeRecords(observer.callback);
809 observer.assertCallbackRecords([ 809 observer.assertCallbackRecords([
810 { object: array, name: '0', type: 'deleted', oldValue: 0 }, 810 { object: array, name: '0', type: 'deleted', oldValue: 0 },
811 { object: array, name: 'length', type: 'updated', oldValue: 1}, 811 { object: array, name: 'length', type: 'updated', oldValue: 1},
812 ]); 812 ]);
813
814 // __proto__
815 reset();
816 var obj = {};
817 Object.observe(obj, observer.callback);
818 var p = {foo: 'yes'};
819 var q = {bar: 'no'};
820 obj.__proto__ = p;
821 obj.__proto__ = p; // ignored
822 obj.__proto__ = null;
823 obj.__proto__ = q;
824 // TODO(adamk): Add tests for objects with hidden prototypes
825 // once we support observing the global object.
826 Object.deliverChangeRecords(observer.callback);
827 observer.assertCallbackRecords([
828 { object: obj, name: '__proto__', type: 'prototype',
829 oldValue: Object.prototype },
830 { object: obj, name: '__proto__', type: 'prototype', oldValue: p },
831 { object: obj, name: '__proto__', type: 'prototype', oldValue: null },
832 ]);
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698