| OLD | NEW |
| 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 Window { | 6 class _DOMWindowCrossFrameImpl implements Window { |
| 7 // Private window. Note, this is a window in another frame, so it | 7 // Private window. Note, this is a window in another frame, so it |
| 8 // cannot be typed as "Window" as its prototype is not patched | 8 // cannot be typed as "Window" as its prototype is not patched |
| 9 // properly. Its fields and methods can only be accessed via JavaScript. | 9 // properly. Its fields and methods can only be accessed via JavaScript. |
| 10 var _window; | 10 var _window; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 Window get top => _createSafe(JS('Window', '#.top', _window)); | 26 Window get top => _createSafe(JS('Window', '#.top', _window)); |
| 27 | 27 |
| 28 // Methods. | 28 // Methods. |
| 29 void focus() => JS('void', '#.focus()', _window); | 29 void focus() => JS('void', '#.focus()', _window); |
| 30 | 30 |
| 31 void blur() => JS('void', '#.blur()', _window); | 31 void blur() => JS('void', '#.blur()', _window); |
| 32 | 32 |
| 33 void close() => JS('void', '#.close()', _window); | 33 void close() => JS('void', '#.close()', _window); |
| 34 | 34 |
| 35 void postMessage(Dynamic message, | 35 void postMessage(var message, String targetOrigin, [List messagePorts = null])
{ |
| 36 String targetOrigin, | |
| 37 [List messagePorts = null]) { | |
| 38 if (messagePorts == null) { | 36 if (messagePorts == null) { |
| 39 JS('void', '#.postMessage(#,#)', _window, message, targetOrigin); | 37 JS('void', '#.postMessage(#,#)', _window, message, targetOrigin); |
| 40 } else { | 38 } else { |
| 41 JS('void', '#.postMessage(#,#,#)', _window, message, targetOrigin, message
Ports); | 39 JS('void', '#.postMessage(#,#,#)', _window, message, targetOrigin, message
Ports); |
| 42 } | 40 } |
| 43 } | 41 } |
| 44 | 42 |
| 45 // Implementation support. | 43 // Implementation support. |
| 46 _DOMWindowCrossFrameImpl(this._window); | 44 _DOMWindowCrossFrameImpl(this._window); |
| 47 | 45 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 94 |
| 97 static History _createSafe(h) { | 95 static History _createSafe(h) { |
| 98 if (identical(h, window.history)) { | 96 if (identical(h, window.history)) { |
| 99 return h; | 97 return h; |
| 100 } else { | 98 } else { |
| 101 // TODO(vsm): Cache or implement equality. | 99 // TODO(vsm): Cache or implement equality. |
| 102 return new _HistoryCrossFrameImpl(h); | 100 return new _HistoryCrossFrameImpl(h); |
| 103 } | 101 } |
| 104 } | 102 } |
| 105 } | 103 } |
| OLD | NEW |