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

Side by Side Diff: lib/dom/src/frog_DOMImplementation.dart

Issue 10388234: Fix for postMessage on dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/dom/frog/dom_frog.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // TODO(vsm): Unify with Dartium version. 5 // TODO(vsm): Unify with Dartium version.
6 class _DOMWindowCrossFrameImpl implements DOMType, DOMWindow { 6 class _DOMWindowCrossFrameImpl implements DOMType, DOMWindow {
7 // Private window. 7 // Private window.
8 _DOMWindowJs _window; 8 _DOMWindowJs _window;
9 9
10 // DOMType 10 // DOMType
(...skipping 13 matching lines...) Expand all
24 void focus() => _window.focus(); 24 void focus() => _window.focus();
25 25
26 void blur() => _window.blur(); 26 void blur() => _window.blur();
27 27
28 void close() => _window.close(); 28 void close() => _window.close();
29 29
30 void postMessage(Dynamic message, 30 void postMessage(Dynamic message,
31 String targetOrigin, 31 String targetOrigin,
32 [List messagePorts = null]) { 32 [List messagePorts = null]) {
33 if (messagePorts == null) { 33 if (messagePorts == null) {
34 _window.postMessage(message, targetOrigin); 34 _postMessage2(_window, message, targetOrigin);
35 } else { 35 } else {
36 _window.postMessage(message, targetOrigin, messagePorts); 36 _postMessage3(_window, message, targetOrigin, messagePorts);
37 } 37 }
38 } 38 }
39 39
40 // TODO(vsm): This is a hack to workaround dartbug.com/3175. We
41 // need a more robust convention to invoke JS methods on the
42 // underlying window.
43 static void _postMessage2(win, message, targetOrigin) native """
44 win.postMessage(message, targetOrigin);
45 """;
46
47 static void _postMessage3(win, message, targetOrigin, messagePorts) native """
48 win.postMessage(message, targetOrigin, messagePorts);
49 """;
50
40 // Implementation support. 51 // Implementation support.
41 _DOMWindowCrossFrameImpl(this._window); 52 _DOMWindowCrossFrameImpl(this._window);
42 53
43 static DOMWindow _createSafe(w) { 54 static DOMWindow _createSafe(w) {
44 if (w === window) { 55 if (w === window) {
45 return w; 56 return w;
46 } else { 57 } else {
47 // TODO(vsm): Cache or implement equality. 58 // TODO(vsm): Cache or implement equality.
48 return new _DOMWindowCrossFrameImpl(w); 59 return new _DOMWindowCrossFrameImpl(w);
49 } 60 }
50 } 61 }
51 } 62 }
OLDNEW
« no previous file with comments | « lib/dom/frog/dom_frog.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698