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

Unified Diff: test/mjsunit/harmony/object-observe.js

Issue 11280118: Object.observe: More tests for accessor reconfiguration. (Closed) Base URL: https://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
« no previous file with comments | « no previous file | 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 ebfae0a9139db36964989c215bbd5d05dc98a50b..fbf4bf49a1d362faa4658a7a4a9852c0994df784 100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -296,7 +296,11 @@ obj.a = 7; // ignored
Object.defineProperty(obj, "a", {value: 8});
Object.defineProperty(obj, "a", {value: 7, writable: true});
Object.defineProperty(obj, "a", {get: function() {}});
-Object.defineProperty(obj, "a", {get: function() {}});
+Object.defineProperty(obj, "a", {get: frozenFunction});
+Object.defineProperty(obj, "a", {get: frozenFunction}); // ignored
+Object.defineProperty(obj, "a", {get: frozenFunction, set: frozenFunction});
+Object.defineProperty(obj, "a", {set: frozenFunction}); // ignored
+Object.defineProperty(obj, "a", {get: undefined, set: frozenFunction});
delete obj.a;
delete obj.a;
Object.defineProperty(obj, "a", {get: function() {}, configurable: true});
@@ -317,6 +321,8 @@ observer.assertCallbackRecords([
{ object: obj, name: "a", type: "reconfigured", oldValue: 8 },
{ object: obj, name: "a", type: "reconfigured", oldValue: 7 },
{ object: obj, name: "a", type: "reconfigured" },
+ { object: obj, name: "a", type: "reconfigured" },
+ { object: obj, name: "a", type: "reconfigured" },
{ object: obj, name: "a", type: "deleted" },
{ object: obj, name: "a", type: "new" },
{ object: obj, name: "a", type: "reconfigured" },
@@ -341,7 +347,11 @@ obj[1] = 7; // ignored
Object.defineProperty(obj, "1", {value: 8});
Object.defineProperty(obj, "1", {value: 7, writable: true});
Object.defineProperty(obj, "1", {get: function() {}});
-Object.defineProperty(obj, "1", {get: function() {}});
+Object.defineProperty(obj, "1", {get: frozenFunction});
+Object.defineProperty(obj, "1", {get: frozenFunction}); // ignored
+Object.defineProperty(obj, "1", {get: frozenFunction, set: frozenFunction});
+Object.defineProperty(obj, "1", {set: frozenFunction}); // ignored
+Object.defineProperty(obj, "1", {get: undefined, set: frozenFunction});
delete obj[1];
delete obj[1];
Object.defineProperty(obj, "1", {get: function() {}, configurable: true});
@@ -362,6 +372,8 @@ observer.assertCallbackRecords([
{ object: obj, name: "1", type: "reconfigured", oldValue: 8 },
{ object: obj, name: "1", type: "reconfigured", oldValue: 7 },
{ object: obj, name: "1", type: "reconfigured" },
+ { object: obj, name: "1", type: "reconfigured" },
+ { object: obj, name: "1", type: "reconfigured" },
{ object: obj, name: "1", type: "deleted" },
{ object: obj, name: "1", type: "new" },
{ object: obj, name: "1", type: "reconfigured" },
@@ -388,7 +400,11 @@ function TestObserveConfigurable(obj, prop) {
Object.defineProperty(obj, prop, {value: 8});
Object.defineProperty(obj, prop, {value: 7, writable: true});
Object.defineProperty(obj, prop, {get: function() {}});
- Object.defineProperty(obj, prop, {get: function() {}});
+ Object.defineProperty(obj, prop, {get: frozenFunction});
+ Object.defineProperty(obj, prop, {get: frozenFunction}); // ignored
+ Object.defineProperty(obj, prop, {get: frozenFunction, set: frozenFunction});
+ Object.defineProperty(obj, prop, {set: frozenFunction}); // ignored
+ Object.defineProperty(obj, prop, {get: undefined, set: frozenFunction});
delete obj[prop];
delete obj[prop];
Object.defineProperty(obj, prop, {get: function() {}, configurable: true});
@@ -409,6 +425,8 @@ function TestObserveConfigurable(obj, prop) {
{ object: obj, name: prop, type: "reconfigured", oldValue: 8 },
{ object: obj, name: prop, type: "reconfigured", oldValue: 7 },
{ object: obj, name: prop, type: "reconfigured" },
+ { object: obj, name: prop, type: "reconfigured" },
+ { object: obj, name: prop, type: "reconfigured" },
{ object: obj, name: prop, type: "deleted" },
{ object: obj, name: prop, type: "new" },
{ object: obj, name: prop, type: "reconfigured" },
@@ -429,14 +447,18 @@ function TestObserveNonConfigurable(obj, prop) {
obj[prop] = 5;
Object.defineProperty(obj, prop, {value: 6});
Object.defineProperty(obj, prop, {value: 6}); // ignored
+ Object.defineProperty(obj, prop, {value: 7});
+ Object.defineProperty(obj, prop, {enumerable: true}); // ignored
Object.defineProperty(obj, prop, {writable: false});
obj[prop] = 7; // ignored
+ Object.defineProperty(obj, prop, {get: function() {}}); // ignored
adamk 2012/11/21 16:24:32 This one confuses me, why is it ignored?
rossberg 2012/11/21 16:57:03 Because the object is not configurable. ;)
Object.deliverChangeRecords(observer.callback);
observer.assertCallbackRecords([
{ object: obj, name: prop, type: "updated", oldValue: 1 },
{ object: obj, name: prop, type: "updated", oldValue: 4 },
{ object: obj, name: prop, type: "updated", oldValue: 5 },
- { object: obj, name: prop, type: "reconfigured", oldValue: 6 },
+ { object: obj, name: prop, type: "updated", oldValue: 6 },
+ { object: obj, name: prop, type: "reconfigured", oldValue: 7 },
]);
Object.unobserve(obj, observer.callback);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698