Index: pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart |
index 9798bbefa4c43d904715c25d1b97cfc428d4dff0..670e03945ee2c317dcdf21f19296812bf8335699 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart |
@@ -36568,7 +36568,9 @@ class _BeforeUnloadEventStreamProvider implements |
const _BeforeUnloadEventStreamProvider(this._eventType); |
Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) { |
- var stream = new _EventStream(e, _eventType, useCapture); |
+ // Specify the generic type for EventStream only in dart2js to avoid |
+ // checked mode errors in dartium. |
+ var stream = new _EventStream<BeforeUnloadEvent>(e, _eventType, useCapture); |
var controller = new StreamController<BeforeUnloadEvent>(sync: true); |
stream.listen((event) { |
@@ -36584,12 +36586,16 @@ class _BeforeUnloadEventStreamProvider implements |
} |
ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) { |
- return new _ElementEventStreamImpl(e, _eventType, useCapture); |
+ // Specify the generic type for _ElementEventStreamImpl only in dart2js to |
+ // avoid checked mode errors in dartium. |
+ return new _ElementEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture); |
} |
ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, |
{bool useCapture: false}) { |
- return new _ElementListEventStreamImpl(e, _eventType, useCapture); |
+ // Specify the generic type for _ElementEventStreamImpl only in dart2js to |
+ // avoid checked mode errors in dartium. |
+ return new _ElementListEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture); |
} |
} |
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
@@ -39931,7 +39937,7 @@ class EventStreamProvider<T extends Event> { |
* [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener) |
*/ |
ElementStream<T> _forElementList(ElementList e, {bool useCapture: false}) { |
- return new _ElementListEventStreamImpl(e, _eventType, useCapture); |
+ return new _ElementListEventStreamImpl<T>(e, _eventType, useCapture); |
} |
/** |
@@ -40081,13 +40087,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(); |
} |
@@ -40149,9 +40163,9 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> { |
} |
} |
- Future asFuture([var futureValue]) { |
+ Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) { |
// We just need a future that will never succeed or fail. |
- Completer completer = new Completer(); |
+ var completer = new Completer/*<E>*/(); |
return completer.future; |
} |
} |
@@ -42527,7 +42541,7 @@ class _WrappedList<E extends Node> extends ListBase<E> |
// Iterable APIs |
- Iterator<E> get iterator => new _WrappedIterator(_list.iterator); |
+ Iterator<E> get iterator => new _WrappedIterator<E>(_list.iterator); |
int get length => _list.length; |
@@ -43387,17 +43401,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. |
- return Zone.current.bindUnaryCallback(callback, runGuarded: true) as _wrapZoneCallback/*<A, R>*/; |
+ 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. |
- return Zone.current.bindBinaryCallback(callback, runGuarded: true) as _wrapZoneBinaryCallback/*<A, B, R>*/; |
+ return Zone.current.bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true); |
} |
/** |