| Index: sdk/lib/html/dart2js/html_dart2js.dart
|
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
|
| index 5480b2df0777a603f96f380643d3e218d039f21b..112f7fb72cf6012367380a5f02f6118f2bf63662 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -40077,13 +40077,21 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
|
| EventListener _onData;
|
| final bool _useCapture;
|
|
|
| - // TODO(jacobr): for full strong mode correctness we should write
|
| - // _onData = onData == null ? null : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
|
| - // but that breaks 114 co19 tests as well as multiple html tests as it is reasonable
|
| - // to pass the wrong type of event object to an event listener as part of a
|
| - // test.
|
| + // TODO(leafp): It would be better to write this as
|
| + // _onData = onData == null ? null :
|
| + // onData is _wrapZoneCallback<Event, dynamic>
|
| + // ? _wrapZone/*<Event, dynamic>*/(onData)
|
| + // : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
|
| + // In order to support existing tests which pass the wrong type of events but
|
| + // use a more general listener, without causing as much slowdown for things
|
| + // which are typed correctly. But this currently runs afoul of restrictions
|
| + // on is checks for compatibility with the VM.
|
| _EventStreamSubscription(this._target, this._eventType, void onData(T event),
|
| - this._useCapture) : _onData = _wrapZone/*<Event, dynamic>*/(onData) {
|
| + this._useCapture) :
|
| + _onData = onData == null
|
| + ? null
|
| + : _wrapZone/*<Event, dynamic>*/((e) => (onData as dynamic)(e))
|
| + {
|
| _tryResume();
|
| }
|
|
|
| @@ -43392,23 +43400,13 @@ _wrapZoneCallback/*<A, R>*/ _wrapZone/*<A, R>*/(_wrapZoneCallback/*<A, R>*/ call
|
| // For performance reasons avoid wrapping if we are in the root zone.
|
| if (Zone.current == Zone.ROOT) return callback;
|
| if (callback == null) return null;
|
| - // TODO(jacobr): we cast to _wrapZoneCallback/*<A, R>*/ to hack around missing
|
| - // generic method support in zones.
|
| - // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
|
| - _wrapZoneCallback/*<A, R>*/ wrapped =
|
| - Zone.current.bindUnaryCallback(callback, runGuarded: true);
|
| - return wrapped;
|
| + return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true);
|
| }
|
|
|
| _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(_wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
|
| if (Zone.current == Zone.ROOT) return callback;
|
| if (callback == null) return null;
|
| - // We cast to _wrapZoneBinaryCallback/*<A, B, R>*/ to hack around missing
|
| - // generic method support in zones.
|
| - // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
|
| - _wrapZoneBinaryCallback/*<A, B, R>*/ wrapped =
|
| - Zone.current.bindBinaryCallback(callback, runGuarded: true);
|
| - return wrapped;
|
| + return Zone.current.bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
|
| }
|
|
|
| /**
|
|
|