Index: tools/dom/templates/html/impl/impl_Window.darttemplate |
diff --git a/tools/dom/templates/html/impl/impl_Window.darttemplate b/tools/dom/templates/html/impl/impl_Window.darttemplate |
index c9f82796bb954f0b4c9e93e627a53c9e4de1d217..8abac3775c4146f65b923db522ae32ae4fa881ac 100644 |
--- a/tools/dom/templates/html/impl/impl_Window.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_Window.darttemplate |
@@ -339,8 +339,10 @@ class _BeforeUnloadEventStreamProvider implements |
const _BeforeUnloadEventStreamProvider(this._eventType); |
Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) { |
- var stream = new _EventStream(e, _eventType, useCapture); |
$if DART2JS |
+ // 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) { |
@@ -350,6 +352,7 @@ $if DART2JS |
return controller.stream; |
$else |
+ var stream = new _EventStream(e, _eventType, useCapture); |
return stream; |
$endif |
} |
@@ -359,11 +362,23 @@ $endif |
} |
ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) { |
+$if DART2JS |
+ // Specify the generic type for _ElementEventStreamImpl only in dart2js to |
+ // avoid checked mode errors in dartium. |
+ return new _ElementEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture); |
+$else |
return new _ElementEventStreamImpl(e, _eventType, useCapture); |
+$endif |
} |
ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, |
{bool useCapture: false}) { |
+$if DART2JS |
+ // Specify the generic type for _ElementEventStreamImpl only in dart2js to |
+ // avoid checked mode errors in dartium. |
+ return new _ElementListEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture); |
+$else |
return new _ElementListEventStreamImpl(e, _eventType, useCapture); |
+$endif |
} |
} |