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

Unified Diff: tests/html/js_test.dart

Issue 26092003: Maintain referential integrity of proxy instances in dart:js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add proxy stability for Dart->JS Created 7 years, 2 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
« sdk/lib/js/dart2js/js_dart2js.dart ('K') | « sdk/lib/js/dartium/js_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/js_test.dart
diff --git a/tests/html/js_test.dart b/tests/html/js_test.dart
index 290a0fbb85e5b77cdcd43b4cacc06109668ef362..ccade724fd302edef8fd493d5678c6857adeb2bb 100644
--- a/tests/html/js_test.dart
+++ b/tests/html/js_test.dart
@@ -124,6 +124,10 @@ function Baz(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11) {
this.f10 = p10;
this.f11 = p11;
}
+
+function identical(o1, o2) {
+ return o1 === o2;
+}
""";
document.body.append(script);
}
@@ -147,6 +151,8 @@ class Color implements Serializable<String> {
String toJs() => this._value;
}
+class TestDartObject {}
+
main() {
_injectJs();
useHtmlConfiguration();
@@ -157,6 +163,28 @@ main() {
expect(identical(c1, c2), isTrue);
});
+ test('identical JS objects should have identical proxies', () {
+ var o1 = context['location'];
+ var o2 = context['location'];
+ expect(identical(o1, o2), isTrue);
+ });
+
+ test('identical JS functions should have identical proxies', () {
+ var f1 = context['Object'];
+ var f2 = context['Object'];
+ expect(identical(f1, f2), isTrue);
+ });
+
+ test('identical Dart objects should have identical proxies', () {
+ var o1 = new TestDartObject();
+ expect(context.callMethod('identical', [o1, o1]), isTrue);
+ });
+
+ test('identical Dart functions should have identical proxies', () {
+ var f1 = () => print("I'm a Function!");
+ expect(context.callMethod('identical', [f1, f1]), isTrue);
+ });
+
test('read global field', () {
expect(context['x'], equals(42));
expect(context['y'], isNull);
« sdk/lib/js/dart2js/js_dart2js.dart ('K') | « sdk/lib/js/dartium/js_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698