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

Unified Diff: test/mjsunit/es6/super.js

Issue 1427113002: Fix corner-case behavior of Object::SetSuperProperty. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 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 | « src/objects.cc ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/super.js
diff --git a/test/mjsunit/es6/super.js b/test/mjsunit/es6/super.js
index a3437f0cf92a3e3381686d4a79164a525699997f..355cbdd7d651bd31f1ed62174f1332f459d6c217 100644
--- a/test/mjsunit/es6/super.js
+++ b/test/mjsunit/es6/super.js
@@ -949,21 +949,14 @@
assertEquals(15, this.ownReadonlyAccessor);
super.ownReadonlyAccessor = 25;
- assertEquals(25, this.ownReadonlyAccessor);
- var descr = Object.getOwnPropertyDescriptor(this, 'ownReadonlyAccessor');
- assertEquals(25, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertSame(undefined, super.ownReadonlyAccessor);
+ assertEquals(15, this.ownReadonlyAccessor);
assertFalse(Base.prototype.hasOwnProperty('ownReadonlyAccessor'));
super.ownSetter = 35;
- assertEquals(35, this.ownSetter);
+ assertSame(undefined, super.ownSetter);
var descr = Object.getOwnPropertyDescriptor(this, 'ownSetter');
- assertEquals(35, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertTrue('set' in descr);
assertFalse(Base.prototype.hasOwnProperty('ownSetter'));
},
mStrict() {
@@ -979,22 +972,15 @@
assertFalse(Base.prototype.hasOwnProperty('ownReadOnly'));
assertEquals(15, this.ownReadonlyAccessor);
- super.ownReadonlyAccessor = 25;
- assertEquals(25, this.ownReadonlyAccessor);
- var descr = Object.getOwnPropertyDescriptor(this, 'ownReadonlyAccessor');
- assertEquals(25, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertThrows(() => {super.ownReadonlyAccessor = 25}, TypeError);
+ assertSame(undefined, super.ownReadonlyAccessor);
+ assertEquals(15, this.ownReadonlyAccessor);
assertFalse(Base.prototype.hasOwnProperty('ownReadonlyAccessor'));
- super.ownSetter = 35;
- assertEquals(35, this.ownSetter);
+ assertThrows(() => {super.ownSetter = 35}, TypeError);
+ assertSame(undefined, super.ownSetter);
var descr = Object.getOwnPropertyDescriptor(this, 'ownSetter');
- assertEquals(35, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertTrue('set' in descr);
assertFalse(Base.prototype.hasOwnProperty('ownSetter'));
},
};
@@ -1052,6 +1038,7 @@
assertEquals(15, this.ownReadonlyAccessor);
super.ownReadonlyAccessor = 25;
+ assertSame(undefined, super.ownReadonlyAccessor);
assertEquals(15, this.ownReadonlyAccessor);
var descr = Object.getOwnPropertyDescriptor(this, 'ownReadonlyAccessor');
assertFalse(descr.configurable);
@@ -1190,21 +1177,14 @@ function TestKeyedSetterCreatingOwnPropertiesReconfigurable(ownReadOnly,
assertEquals(15, this[ownReadonlyAccessor]);
super[ownReadonlyAccessor] = 25;
- assertEquals(25, this[ownReadonlyAccessor]);
- var descr = Object.getOwnPropertyDescriptor(this, ownReadonlyAccessor);
- assertEquals(25, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertSame(undefined, super[ownReadonlyAccessor]);
+ assertEquals(15, this[ownReadonlyAccessor]);
assertFalse(Base.prototype.hasOwnProperty(ownReadonlyAccessor));
super[ownSetter] = 35;
- assertEquals(35, this[ownSetter]);
+ assertSame(undefined, super[ownSetter]);
var descr = Object.getOwnPropertyDescriptor(this, ownSetter);
- assertEquals(35, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertTrue('set' in descr);
assertFalse(Base.prototype.hasOwnProperty(ownSetter));
},
mStrict() {
@@ -1220,22 +1200,15 @@ function TestKeyedSetterCreatingOwnPropertiesReconfigurable(ownReadOnly,
assertFalse(Base.prototype.hasOwnProperty(ownReadOnly));
assertEquals(15, this[ownReadonlyAccessor]);
- super[ownReadonlyAccessor] = 25;
- assertEquals(25, this[ownReadonlyAccessor]);
- var descr = Object.getOwnPropertyDescriptor(this, ownReadonlyAccessor);
- assertEquals(25, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertThrows(() => {super[ownReadonlyAccessor] = 25}, TypeError);
+ assertSame(undefined, super[ownReadonlyAccessor]);
+ assertEquals(15, this[ownReadonlyAccessor]);
assertFalse(Base.prototype.hasOwnProperty(ownReadonlyAccessor));
- super[ownSetter] = 35;
- assertEquals(35, this[ownSetter]);
+ assertThrows(() => {super[ownSetter] = 35}, TypeError);
+ assertSame(undefined, super[ownSetter]);
var descr = Object.getOwnPropertyDescriptor(this, ownSetter);
- assertEquals(35, descr.value);
- assertTrue(descr.configurable);
- assertFalse(descr.enumerable);
- assertTrue(descr.writable);
+ assertTrue('set' in descr);
assertFalse(Base.prototype.hasOwnProperty(ownSetter));
},
};
@@ -1298,6 +1271,7 @@ function TestKeyedSetterCreatingOwnPropertiesNonConfigurable(
assertEquals(15, this[ownReadonlyAccessor]);
super[ownReadonlyAccessor] = 25;
+ assertSame(undefined, super[ownReadonlyAccessor]);
assertEquals(15, this[ownReadonlyAccessor]);
var descr = Object.getOwnPropertyDescriptor(this, ownReadonlyAccessor);
assertFalse(descr.configurable);
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698