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

Unified Diff: dart/tests/html/cross_domain_iframe_test.dart

Issue 406143004: Bugfix in html_dart2js: Detect window objects in a way compatible with cross domain iframes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use 'postMessage', change tools/dom/src/dart2js_Conversions.dart Created 6 years, 5 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 | « dart/tests/html/cross_domain_iframe_script.html ('k') | dart/tools/dom/src/dart2js_Conversions.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/html/cross_domain_iframe_test.dart
diff --git a/dart/tests/html/cross_domain_iframe_test.dart b/dart/tests/html/cross_domain_iframe_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0a234f89ac43393e8b55be9ae702b3458d620a58
--- /dev/null
+++ b/dart/tests/html/cross_domain_iframe_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2012, 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.
+
+import 'dart:html';
+
+import 'package:unittest/unittest.dart';
+
+main() {
+ test('cross_domain_iframe', () {
+ var uri = Uri.parse(window.location.href);
+
+ var crossOriginPort = int.parse(uri.queryParameters['crossOriginPort']);
+ var crossOrigin = '${uri.scheme}://${uri.host}:$crossOriginPort';
+ var crossOriginUrl =
+ '$crossOrigin/root_dart/tests/html/cross_domain_iframe_script.html';
+
+ var iframe = new IFrameElement();
+ iframe.src = crossOriginUrl;
+ document.body.append(iframe);
+
+ window.onMessage.where((MessageEvent event) {
+ return event.origin == crossOrigin;
+ }).first.then(expectAsync((MessageEvent event) {
+ expect(event.data, equals('foobar'));
+ expect(event.source, isNotNull);
+ }));
+ });
+}
« no previous file with comments | « dart/tests/html/cross_domain_iframe_script.html ('k') | dart/tools/dom/src/dart2js_Conversions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698