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

Unified Diff: tests/html/postmessage_structured_test.dart

Issue 886673002: Check for null prototype in isJavaScriptSimpleObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Eliminate common sub-expression Created 5 years, 11 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 | « sdk/lib/html/html_common/conversions.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/postmessage_structured_test.dart
diff --git a/tests/html/postmessage_structured_test.dart b/tests/html/postmessage_structured_test.dart
index 1dc65d7549d6e29dac2caef33d5f93866e9a564a..32daa2a0a34fb7c3f5e3e563b4a3b50ec710d0ea 100644
--- a/tests/html/postmessage_structured_test.dart
+++ b/tests/html/postmessage_structured_test.dart
@@ -78,6 +78,33 @@ main() {
injectSource(JS_CODE);
});
+ test('js-to-dart--null-prototype-eventdata', () {
+ // Pass an object with a null prototype from JavaScript.
+ // It should be seen as a Dart Map.
+ final JS_CODE = """
+ // Call anonymous function to create a local scope.
+ (function() {
+ var o = Object.create(null);
+ o.eggs = 3;
+ var foo = new MessageEvent('stuff', {data: o});
+ window.dispatchEvent(foo);
+ })();
+ """;
+ var completed = false;
+ var subscription = null;
+ subscription = window.on['stuff'].listen(expectAsyncUntil(
+ (MessageEvent e) {
+ var data = e.data;
+ if (data is String) return; // Messages from unit test protocol.
+ completed = true;
+ subscription.cancel();
+ expect(data, isMap);
+ expect(data['eggs'], equals(3));
+ },
+ () => completed));
+ injectSource(JS_CODE);
+ });
+
test('dart-to-js-to-dart-postmessage', () {
// Pass dictionaries between Dart and JavaScript.
« no previous file with comments | « sdk/lib/html/html_common/conversions.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698