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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « 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 d88c24eac5bcd87c98ecf0e7b6899ada76c0e050..28c19749ec699403085a76d580e07dffe64cbfbd 100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -810,3 +810,23 @@ 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 },
+ { object: obj, name: '__proto__', type: 'prototype', oldValue: p },
+ { object: obj, name: '__proto__', type: 'prototype', oldValue: null },
+]);
« 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