diff --git a/pkgs/test/tool/host.dart b/pkgs/test/tool/host.dart index 51b3343c8..6b347f47f 100644 --- a/pkgs/test/tool/host.dart +++ b/pkgs/test/tool/host.dart @@ -231,36 +231,15 @@ StreamChannel _connectToIframe(String url, int id) { dom.window.console.log('Connecting channel for suite $suiteUrl'); // The frame is starting and sending a port to forward for the suite. final port = message.ports.first; + assert(!_domSubscriptions.containsKey(id)); _domSubscriptions[id] = dom.Subscription(port, 'message', allowInterop((event) { controller.local.sink.add((event as dom.MessageEvent).data); })); port.start(); - _subscriptions[id] = controller.local.stream.listen(port.postMessage); - case {'ready': true}: - // This message indicates that the iframe is actively listening for - // events, so the message channel's second port can now be transferred. - var channel = dom.createMessageChannel(); - assert(!_domSubscriptions.containsKey(id)); - _domSubscriptions[id] = dom.Subscription(channel.port1, 'message', - allowInterop((dom.Event event) { - controller.local.sink.add((event as dom.MessageEvent).data['data']); - })); - assert(!_subscriptions.containsKey(id)); - _subscriptions[id] = - controller.local.stream.listen(channel.port1.postMessage); - channel - ..port2.start() - ..port1.start(); - // TODO(#1758): This is a work around for a crash in package:build. - js_util.callMethod( - js_util.getProperty(iframe, 'contentWindow'), 'postMessage', [ - 'port', - dom.window.location.origin, - [channel.port2] - ]); + _subscriptions[id] = controller.local.stream.listen(port.postMessage); case {'exception': true, 'data': final data}: // This message from `dart.js` indicates that an exception occurred // loading the test.