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

Unified Diff: test/mjsunit/strong/load-super.js

Issue 1193633003: [strong] Add tests for loading from proxy, super, with access checks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 6 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 | « test/mjsunit/strong/load-proxy.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strong/load-super.js
diff --git a/test/mjsunit/strong/load-super.js b/test/mjsunit/strong/load-super.js
new file mode 100644
index 0000000000000000000000000000000000000000..4aa91c222ae620649d628419c942aa0feb2291d5
--- /dev/null
+++ b/test/mjsunit/strong/load-super.js
@@ -0,0 +1,102 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --strong-mode
+
+"use strong";
+
+function testSuper(object) {
+ assertEquals(0, object.validLoad());
+ assertThrows(function(){ return object.propertyLoad() }, TypeError);
+ assertThrows(function(){ return object.elementLoad() }, TypeError);
+ assertThrows(function(){ return object.accessorLoad() }, TypeError);
+}
+
+class A {
+ constructor() {}
+ foo() {
+ return 0;
+ }
+ get bar() {
+ return 0;
+ }
+ set baz(_) {
+ return;
+ }
+}
+
+class B extends A {
+ constructor() {
+ super();
+ }
+ validLoad() {
+ return super.foo() + super.bar;
+ }
+ propertyLoad() {
+ return super.x;
+ }
+ elementLoad() {
+ return super[1];
+ }
+ accessorLoad() {
+ return super.baz;
+ }
+}
+
+class C extends A {
+ constructor() {
+ super();
+ this[1] = 0;
+ this.x = 0;
+ }
+ get baz() {
+ return 0;
+ }
+ validLoad() {
+ return super.foo() + super.bar;
+ }
+ propertyLoad() {
+ return super.x;
+ }
+ elementLoad() {
+ return super[1];
+ }
+ accessorLoad() {
+ return super.baz;
+ }
+}
+
+let b = new B();
+let c = new C();
+testSuper(b);
+testSuper(c);
+
+let d = {
+ "0": 0,
+ foo: 0,
+ bar: (function(){return 0}),
+ get baz(){return 0},
+ set qux(_){return}
+}
+
+let e = {
+ __proto__: d,
+ "1": 0,
+ x: 0,
+ get baz(){return 0},
+ validLoad() {
+ return super[0] + super.foo + super.bar() + super.baz;
+ },
+ propertyLoad() {
+ return super.x;
+ },
+ elementLoad() {
+ return super[1];
+ },
+ accessorLoad() {
+ return super.qux;
+ }
+}
+
+testSuper(e);
« no previous file with comments | « test/mjsunit/strong/load-proxy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698