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

Unified 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: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« src/accessors.cc ('K') | « src/accessors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/object-observe.js
diff --git a/test/mjsunit/harmony/object-observe.js b/test/mjsunit/harmony/object-observe.js
index 474bfcd3bc49bb7aeb8f7a8d92e97f725161ca5d..73edce263a8fc35fd324a0c256416dfbcf99a42a 100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -811,3 +811,22 @@ observer.assertCallbackRecords([
{ object: array, name: '0', type: 'deleted', oldValue: 0 },
{ object: array, name: 'length', type: 'updated', oldValue: 1},
]);
+
+// __proto__
+reset();
+var obj = {};
+Object.observe(obj, observer.callback);
+var p = {foo: 'yes'};
+var q = {bar: 'no'};
+obj.__proto__ = p;
+obj.__proto__ = p; // ignored
+obj.__proto__ = null;
+obj.__proto__ = q;
+// TODO(adamk): Add tests for objects with hidden prototypes
+// once we support observing the global object.
+Object.deliverChangeRecords(observer.callback);
+observer.assertCallbackRecords([
+ { object: obj, name: '__proto__', type: 'prototype', oldValue: Object.prototype },
rossberg 2012/12/03 13:37:41 Line length.
adamk 2012/12/03 19:07:05 Done.
+ { object: obj, name: '__proto__', type: 'prototype', oldValue: p },
+ { object: obj, name: '__proto__', type: 'prototype', oldValue: null },
+]);
« src/accessors.cc ('K') | « src/accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698