-
Notifications
You must be signed in to change notification settings - Fork 6k
Update to the latest package:test #46905
Conversation
Splitting from flutter#46592 to separate code changes from the package roll.
|
I'm not able to find any useful logs about what is failing here. Do you know how to track down the error? |
|
Ah, I was able to find a more useful log. it looks like upgrading That's probably because |
|
OK, this repo made a copy of 1,3c1,3
< // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
< // for details. All rights reserved. Use of this source code is governed by a
< // BSD-style license that can be found in the LICENSE file.
---
> // Copyright 2013 The Flutter Authors. All rights reserved.
> // Use of this source code is governed by a BSD-style license that can be
> // found in the LICENSE file.
49c49
< final _iframes = Map<int, IFrameElement>();
---
> final Map<int, IFrameElement> _iframes = <int, IFrameElement>{};
52c52
< final _subscriptions = Map<int, List<StreamSubscription>>();
---
> final Map<int, List<StreamSubscription<dynamic>>> _subscriptions = <int, List<StreamSubscription<dynamic>>>{};
55c55
< final _currentUrl = Uri.parse(window.location.href);
---
> final Uri _currentUrl = Uri.parse(window.location.href);
118,119c118,119
< var serverChannel = _connectToServer();
< serverChannel.stream.listen((message) {
---
> final MultiChannel<dynamic> serverChannel = _connectToServer();
> serverChannel.stream.listen((dynamic message) {
121,124c121,125
< var suiteChannel =
< serverChannel.virtualChannel(message['channel'] as int);
< var iframeChannel =
< _connectToIframe(message['url'] as String, message['id'] as int);
---
> final int channelId = message['channel'];
> final String url = message['url'];
> final int messageId = message['id'];
> final VirtualChannel<dynamic> suiteChannel = serverChannel.virtualChannel(channelId);
> final StreamChannel<dynamic> iframeChannel = _connectToIframe(url, messageId);
134c135
< for (var subscription in _subscriptions.remove(message['id'])) {
---
> for (StreamSubscription<dynamic> subscription in _subscriptions.remove(message['id'])) {
143,149c144
< (_) => serverChannel.sink.add({'command': 'ping'}));
<
< var play = document.querySelector('#play');
< play.onClick.listen((_) {
< if (!document.body.classes.remove('paused')) return;
< serverChannel.sink.add({'command': 'resume'});
< });
---
> (_) => serverChannel.sink.add(<String, String>{'command': 'ping'}));
152,153c147,150
< if (!document.body.classes.remove('paused')) return;
< serverChannel.sink.add({'command': 'resume'});
---
> if (!document.body.classes.remove('paused')) {
> return;
> }
> serverChannel.sink.add(<String, String>{'command': 'resume'});
155c152
< serverChannel.sink.add({'command': 'restart'});
---
> serverChannel.sink.add(<String, String>{'command': 'restart'});
157c154
< }, onError: (error, StackTrace stackTrace) {
---
> }, onError: (dynamic error, StackTrace stackTrace) {
164c161
< MultiChannel _connectToServer() {
---
> MultiChannel<dynamic> _connectToServer() {
167c164
< var webSocket = WebSocket(_currentUrl.queryParameters['managerUrl']);
---
> final WebSocket webSocket = WebSocket(_currentUrl.queryParameters['managerUrl']);
169,171c166,169
< var controller = StreamChannelController(sync: true);
< webSocket.onMessage.listen((message) {
< controller.local.sink.add(jsonDecode(message.data as String));
---
> final StreamChannelController<dynamic> controller = StreamChannelController<dynamic>(sync: true);
> webSocket.onMessage.listen((MessageEvent message) {
> final String data = message.data;
> controller.local.sink.add(jsonDecode(data));
175c173
< .listen((message) => webSocket.send(jsonEncode(message)));
---
> .listen((dynamic message) => webSocket.send(jsonEncode(message)));
177c175
< return MultiChannel(controller.foreign);
---
> return MultiChannel<dynamic>(controller.foreign);
184,185c182,183
< StreamChannel _connectToIframe(String url, int id) {
< var iframe = IFrameElement();
---
> StreamChannel<dynamic> _connectToIframe(String url, int id) {
> final IFrameElement iframe = IFrameElement();
187c185,188
< iframe.src = url;
---
> iframe
> ..src = url
> ..width = '500'
> ..height = '500';
191,192c192,193
< var channel = MessageChannel();
< var controller = StreamChannelController(sync: true);
---
> final MessageChannel channel = MessageChannel();
> final StreamChannelController<dynamic> controller = StreamChannelController<dynamic>(sync: true);
196c197
< var readyCompleter = Completer();
---
> final Completer<dynamic> readyCompleter = Completer<dynamic>();
198c199
< var subscriptions = <StreamSubscription>[];
---
> final List<StreamSubscription<dynamic>> subscriptions = <StreamSubscription<dynamic>>[];
201c202
< subscriptions.add(window.onMessage.listen((message) {
---
> subscriptions.add(window.onMessage.listen((dynamic message) {
206c207,209
< if (message.origin != window.location.origin) return;
---
> if (message.origin != window.location.origin) {
> return;
> }
208,210c211,213
< // TODO(nweiz): Stop manually checking href here once issue 22554 is
< // fixed.
< if (message.data['href'] != iframe.src) return;
---
> if (message.data['href'] != iframe.src) {
> return;
> }
217,218c220
< iframe.contentWindow
< .postMessage('port', window.location.origin, [channel.port2]);
---
> iframe.contentWindow.postMessage('port', window.location.origin, <MessagePort>[channel.port2]);
227c229
< subscriptions.add(channel.port1.onMessage.listen((message) {
---
> subscriptions.add(channel.port1.onMessage.listen((dynamic message) {
231c233
< subscriptions.add(controller.local.stream.listen((message) async {
---
> subscriptions.add(controller.local.stream.listen((dynamic message) async {
233d234
< I think this initial diff is mainly adapting to flutter's style - adding redundant types, requiring |
See dart-lang/test#2065 Multiple copies of the host and iframe side implementations have been updated, but this copy of `host.dart` was missed. Apply some of the changes from the linked test issue to this copy. - Add `MessageEventSource` and `MessageEventSourceLocation` interop classes. The frame side communication no longer includes an `href` field in the map, read it through `message.source.location`. - Move the `DomMessageChannel` initiation into the handler for the `{'ready': true}` event. This removes the need for the `readyCompleter` since we do not start forwarding messages until the port is ready for use. - Add handling for the new pattern, when the iframe sends a message with the string `'port'` instead of a Map.
|
@yjbanov - I cannot understand this failure or how it might be related to this change. Have you seen failures that look like this before? It looks related to compiling for AOT? |
|
Hmm, maybe I'll merge this back with #46592 since it looks like it would take even more steps to separate code changes from the package roll. |
Splitting from #46592 to separate code changes from the package roll.