| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 // TODO(vsm): Unify with Dartium version. | 7 // TODO(vsm): Unify with Dartium version. |
| 8 class _DOMWindowCrossFrame implements WindowBase { | 8 class _DOMWindowCrossFrame implements WindowBase { |
| 9 // Private window. Note, this is a window in another frame, so it | 9 // Private window. Note, this is a window in another frame, so it |
| 10 // cannot be typed as "Window" as its prototype is not patched | 10 // cannot be typed as "Window" as its prototype is not patched |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 WindowBase get parent => _createSafe(JS('WindowBase', '#.parent', _window)); | 26 WindowBase get parent => _createSafe(JS('WindowBase', '#.parent', _window)); |
| 27 | 27 |
| 28 WindowBase get top => _createSafe(JS('WindowBase', '#.top', _window)); | 28 WindowBase get top => _createSafe(JS('WindowBase', '#.top', _window)); |
| 29 | 29 |
| 30 // Methods. | 30 // Methods. |
| 31 void close() => JS('void', '#.close()', _window); | 31 void close() => JS('void', '#.close()', _window); |
| 32 | 32 |
| 33 void postMessage(var message, String targetOrigin, [List messagePorts = null])
{ | 33 void postMessage(var message, String targetOrigin, [List messagePorts = null])
{ |
| 34 if (messagePorts == null) { | 34 if (messagePorts == null) { |
| 35 JS('void', '#.postMessage(#,#)', _window, message, targetOrigin); | 35 JS('void', '#.postMessage(#,#)', _window, |
| 36 convertDartToNative_SerializedScriptValue(message), targetOrigin); |
| 36 } else { | 37 } else { |
| 37 JS('void', '#.postMessage(#,#,#)', _window, message, targetOrigin, message
Ports); | 38 JS('void', '#.postMessage(#,#,#)', _window, |
| 39 convertDartToNative_SerializedScriptValue(message), targetOrigin, |
| 40 messagePorts); |
| 38 } | 41 } |
| 39 } | 42 } |
| 40 | 43 |
| 41 // Implementation support. | 44 // Implementation support. |
| 42 _DOMWindowCrossFrame(this._window); | 45 _DOMWindowCrossFrame(this._window); |
| 43 | 46 |
| 44 static WindowBase _createSafe(w) { | 47 static WindowBase _createSafe(w) { |
| 45 if (identical(w, window)) { | 48 if (identical(w, window)) { |
| 46 return w; | 49 return w; |
| 47 } else { | 50 } else { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 110 |
| 108 static HistoryBase _createSafe(h) { | 111 static HistoryBase _createSafe(h) { |
| 109 if (identical(h, window.history)) { | 112 if (identical(h, window.history)) { |
| 110 return h; | 113 return h; |
| 111 } else { | 114 } else { |
| 112 // TODO(vsm): Cache or implement equality. | 115 // TODO(vsm): Cache or implement equality. |
| 113 return new _HistoryCrossFrame(h); | 116 return new _HistoryCrossFrame(h); |
| 114 } | 117 } |
| 115 } | 118 } |
| 116 } | 119 } |
| OLD | NEW |