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

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

Issue 2311413002: Super property loads and stores should throw if [[Prototype]] is null (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | test/test262/test262.status » ('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 4c80ce7711848afe941aaca87e95c3cd88521a4b..a101ea896b0a7d1d1f213e26105252a8039205f2 100644
--- a/test/mjsunit/es6/super.js
+++ b/test/mjsunit/es6/super.js
@@ -2213,3 +2213,35 @@ TestKeyedSetterCreatingOwnPropertiesNonConfigurable(42, 43, 44);
let d = new Derived(42);
assertSame(42, d.x);
})();
+
+(function TestNullSuperPropertyLoad() {
+ var obj = {
+ __proto__: null,
+ named() { return super.x },
+ keyed() { return super[5] }
+ };
+ assertThrows(obj.named, TypeError);
+ assertThrows(obj.keyed, TypeError);
+ class C extends null {
+ named() { return super.x }
+ keyed() { return super[5] }
+ }
+ assertThrows(C.prototype.named, TypeError);
+ assertThrows(C.prototype.keyed, TypeError);
+})();
+
+(function TestNullSuperPropertyStore() {
+ var obj = {
+ __proto__: null,
+ named() { super.x = 42 },
+ keyed() { super[5] = 42 }
+ };
+ assertThrows(obj.named, TypeError);
+ assertThrows(obj.keyed, TypeError);
+ class C extends null {
+ named() { super.x = 42 }
+ keyed() { super[5] = 42 }
+ }
+ assertThrows(C.prototype.named, TypeError);
+ assertThrows(C.prototype.keyed, TypeError);
+})();
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698