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

Unified Diff: test/mjsunit/object-define-property.js

Issue 5773002: Fix issue 965. (Closed)
Patch Set: Address review comments Created 10 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/v8natives.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/object-define-property.js
diff --git a/test/mjsunit/object-define-property.js b/test/mjsunit/object-define-property.js
index b258aa75bf375e279e207746c383168d5ba62dd6..780c720b51082a5c89329cf1ee2121289fbac485 100644
--- a/test/mjsunit/object-define-property.js
+++ b/test/mjsunit/object-define-property.js
@@ -866,4 +866,36 @@ assertFalse(desc.writable);
assertFalse(desc.enumerable);
assertFalse(desc.configurable);
+// See issue 968: http://code.google.com/p/v8/issues/detail?id=968
+var o = { x : 42 };
+Object.defineProperty(o, "x", { writable: false });
+assertEquals(42, o.x);
+o.x = 37;
+assertEquals(42, o.x);
+
+o = { x : 42 };
+Object.defineProperty(o, "x", {});
+assertEquals(42, o.x);
+o.x = 37;
+// Writability is preserved.
+assertEquals(37, o.x);
+
+var o = { };
+Object.defineProperty(o, "x", { writable: false });
+assertEquals(undefined, o.x);
+o.x = 37;
+assertEquals(undefined, o.x);
+
+o = { get x() { return 87; } };
+Object.defineProperty(o, "x", { writable: false });
+assertEquals(undefined, o.x);
+o.x = 37;
+assertEquals(undefined, o.x);
+
+// Ignore inherited properties.
+o = { __proto__ : { x : 87 } };
+Object.defineProperty(o, "x", { writable: false });
+assertEquals(undefined, o.x);
+o.x = 37;
+assertEquals(undefined, o.x);
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698