| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library test.runner.browser.host; | 5 library test.runner.browser.host; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // unit tests, let alone be able to find the test server while it's | 119 // unit tests, let alone be able to find the test server while it's |
| 120 // running, but it's good practice to check the origin anyway. | 120 // running, but it's good practice to check the origin anyway. |
| 121 if (message.origin != window.location.origin) return; | 121 if (message.origin != window.location.origin) return; |
| 122 | 122 |
| 123 // TODO(nweiz): Stop manually checking href here once issue 22554 is | 123 // TODO(nweiz): Stop manually checking href here once issue 22554 is |
| 124 // fixed. | 124 // fixed. |
| 125 if (message.data["href"] != iframe.src) return; | 125 if (message.data["href"] != iframe.src) return; |
| 126 | 126 |
| 127 message.stopPropagation(); | 127 message.stopPropagation(); |
| 128 inputController.add(message.data["data"]); | 128 inputController.add(message.data["data"]); |
| 129 readyCompleter.complete(); | 129 if (!readyCompleter.isCompleted) readyCompleter.complete(); |
| 130 }); | 130 }); |
| 131 | 131 |
| 132 outputController.stream.listen((message) { | 132 outputController.stream.listen((message) { |
| 133 readyCompleter.future.then((_) => | 133 readyCompleter.future.then((_) => |
| 134 iframe.contentWindow.postMessage(message, window.location.origin)); | 134 iframe.contentWindow.postMessage(message, window.location.origin)); |
| 135 }); | 135 }); |
| 136 | 136 |
| 137 return new StreamChannel(inputController.stream, outputController.sink); | 137 return new StreamChannel(inputController.stream, outputController.sink); |
| 138 } | 138 } |
| OLD | NEW |