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

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

Issue 6035014: First cut at bug 992 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Format to 80 columns Created 9 years, 12 months 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
Index: test/mjsunit/object-define-property.js
diff --git a/test/mjsunit/object-define-property.js b/test/mjsunit/object-define-property.js
index d24a4e5a398c0d84a85052283daf0f0516d4f87f..4c374972322c19efcc7616bd2d70a41d984c5906 100644
--- a/test/mjsunit/object-define-property.js
+++ b/test/mjsunit/object-define-property.js
@@ -749,9 +749,21 @@ assertTrue(desc.writable);
assertTrue(desc.enumerable);
assertFalse(desc.configurable);
-// Ensure that we can't overwrite the non configurable element.
+// Can use defineProperty to change the value of a non
+// configurable property
Rico 2011/01/05 13:40:39 period at end of comment
Peter Hallam 2011/01/05 23:50:31 Done.
try {
Object.defineProperty(obj6, '2', descElement);
+ desc = Object.getOwnPropertyDescriptor(obj6, '2');
+ assertEquals(desc.value, 'foobar');
+} catch (e) {
+ assertUnreachable();
+}
+
+// Ensure that we can't change the descriptor of a
+// the non configurable property.
Rico 2011/01/05 13:40:39 a the -> a
Peter Hallam 2011/01/05 23:50:31 Done.
+try {
+ var descAccessor = { get: function() { return 0; } };
Rico 2011/01/05 13:37:01 could we also try with descElementNonWritable, whi
Peter Hallam 2011/01/05 23:50:31 I've added a test for descElementNonWritable. Inte
+ Object.defineProperty(obj6, '2', descAccessor);
assertUnreachable();
} catch (e) {
assertTrue(/Cannot redefine property/.test(e));
@@ -827,9 +839,21 @@ assertTrue(desc.writable);
assertTrue(desc.enumerable);
assertFalse(desc.configurable);
-// Ensure that we can't overwrite the non configurable element.
+// Can use defineProperty to change the value of a non
+// configurable property of an array
Rico 2011/01/05 13:40:39 period at end of comment
Peter Hallam 2011/01/05 23:50:31 Done.
try {
Object.defineProperty(arr, '2', descElement);
+ desc = Object.getOwnPropertyDescriptor(arr, '2');
+ assertEquals(desc.value, 'foobar');
+} catch (e) {
+ assertUnreachable();
+}
+
+// Ensure that we can't change the descriptor of a
+// non configurable property.
+try {
+ var descAccessor = { get: function() { return 0; } };
Rico 2011/01/05 13:37:01 Again, could we also try with descElementNonWritab
Peter Hallam 2011/01/05 23:50:31 Done. See comment above.
+ Object.defineProperty(arr, '2', descAccessor);
assertUnreachable();
} catch (e) {
assertTrue(/Cannot redefine property/.test(e));
« src/v8natives.js ('K') | « src/v8natives.js ('k') | test/mjsunit/regress/regress-992.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698