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

Unified Diff: tests/language/mixin_proto_test.dart

Issue 2550903002: Fix csp mode on platforms that don't support __proto__. (Closed)
Patch Set: Created 4 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 | « pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/mixin_proto_test.dart
diff --git a/tests/language/mixin_proto_test.dart b/tests/language/mixin_proto_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e195d904b4c21e22f1865f07f416cdc2acd7a822
--- /dev/null
+++ b/tests/language/mixin_proto_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Tests that a program in csp mode doesn't access the prototype chain
+// on platforms that don't support direct access to __proto__.
+// This test is most useful with --csp and on a platform that doesn't support
+// __proto__ access (such as Rhino).
+// See http://dartbug.com/27290 .
+
+import 'package:expect/expect.dart';
+
+class A {
+ var x;
+ foo() => 44;
+ bar() => 22;
+}
+
+class B {
+ var y;
+ foo() => 42;
+}
+
+class C extends A with B {
+ var z;
+ bar() => 499;
+}
+
+main() {
+ var all = [new A(), new B(), new C()];
sra1 2017/02/23 23:43:39 Always use a 'confuse' function to obfuscate. It w
floitsch 2017/02/24 12:35:29 https://codereview.chromium.org/2712603006/
+ Expect.equals(44, all[0].foo());
+ Expect.equals(22, all[0].bar());
+ Expect.equals(42, all[1].foo());
+ Expect.equals(42, all[2].foo());
+ Expect.equals(499, all[2].bar());
+}
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698