Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: tools/dom/templates/html/impl/impl_Window.darttemplate

Issue 55903004: Fixing BeforeUnloadEvent.returnValue (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/templates/html/dartium/html_dartium.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a45122ab68f53c799e218fe1167cf95a05a131f3..7ddeaada1264ece71d0bbb284525d94408af0334 100644
--- a/tools/dom/templates/html/impl/impl_Window.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Window.darttemplate
@@ -292,6 +292,7 @@ $if DART2JS
$endif
}
+$if DART2JS
class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
String _returnValue;
@@ -301,15 +302,14 @@ class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
void set returnValue(String value) {
_returnValue = value;
-$if DART2JS
// FF and IE use the value as the return value, Chrome will return this from
// the event callback function.
if (JS('bool', '("returnValue" in #)', wrapped)) {
JS('void', '#.returnValue = #', wrapped, value);
}
-$endif
}
}
+$endif
class _BeforeUnloadEventStreamProvider implements
EventStreamProvider<BeforeUnloadEvent> {
@@ -318,8 +318,10 @@ class _BeforeUnloadEventStreamProvider implements
const _BeforeUnloadEventStreamProvider(this._eventType);
Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) {
- var controller = new StreamController(sync: true);
var stream = new _EventStream(e, _eventType, useCapture);
+$if DART2JS
+ var controller = new StreamController(sync: true);
+
stream.listen((event) {
var wrapped = new _BeforeUnloadEvent(event);
controller.add(wrapped);
@@ -327,6 +329,9 @@ class _BeforeUnloadEventStreamProvider implements
});
return controller.stream;
+$else
+ return stream;
+$endif
}
String getEventType(EventTarget target) {
« no previous file with comments | « tools/dom/templates/html/dartium/html_dartium.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698