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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

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:
Download patch
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/dom.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 51bfff954aa84489698d6d98fd818cf5f76de04f..9d2933d1eafc7f3548341b405d2eca0d75eb7ba9 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -55,6 +55,7 @@ export 'dart:math' show Rectangle, Point;
+// Issue 14721, order important for WrappedEvent.
Window _window;
@@ -753,11 +754,18 @@ class BeforeLoadEvent extends Event {
@DocsEditable()
@DomName('BeforeUnloadEvent')
-@Experimental() // untriaged
class BeforeUnloadEvent extends Event {
// To suppress missing implicit constructor warnings.
factory BeforeUnloadEvent._() { throw new UnsupportedError("Not supported"); }
+ @DomName('BeforeUnloadEvent.returnValue')
+ @DocsEditable()
+ String get returnValue native "BeforeUnloadEvent_returnValue_Getter";
+
+ @DomName('BeforeUnloadEvent.returnValue')
+ @DocsEditable()
+ void set returnValue(String value) native "BeforeUnloadEvent_returnValue_Setter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27049,17 +27057,6 @@ class Window extends EventTarget implements WindowBase, _WindowTimers, WindowBas
}
-class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
- String _returnValue;
-
- _BeforeUnloadEvent(Event base): super(base);
-
- String get returnValue => _returnValue;
-
- void set returnValue(String value) {
- _returnValue = value;
- }
-}
class _BeforeUnloadEventStreamProvider implements
EventStreamProvider<BeforeUnloadEvent> {
@@ -27068,15 +27065,8 @@ 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);
- stream.listen((event) {
- var wrapped = new _BeforeUnloadEvent(event);
- controller.add(wrapped);
- return wrapped.returnValue;
- });
-
- return controller.stream;
+ return stream;
}
String getEventType(EventTarget target) {
@@ -29273,6 +29263,54 @@ abstract class _XMLHttpRequestProgressEvent extends ProgressEvent {
factory _XMLHttpRequestProgressEvent._() { throw new UnsupportedError("Not supported"); }
}
+// Copyright (c) 2013, 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.
+
+
+/**
+ * Helper class to implement custom events which wrap DOM events.
+ */
+class _WrappedEvent implements Event {
+ final Event wrapped;
+ _WrappedEvent(this.wrapped);
+
+ bool get bubbles => wrapped.bubbles;
+
+ bool get cancelable => wrapped.cancelable;
+
+ DataTransfer get clipboardData => wrapped.clipboardData;
+
+ EventTarget get currentTarget => wrapped.currentTarget;
+
+ bool get defaultPrevented => wrapped.defaultPrevented;
+
+ int get eventPhase => wrapped.eventPhase;
+
+ EventTarget get target => wrapped.target;
+
+ int get timeStamp => wrapped.timeStamp;
+
+ String get type => wrapped.type;
+
+ void _initEvent(String eventTypeArg, bool canBubbleArg,
+ bool cancelableArg) {
+ throw new UnsupportedError(
+ 'Cannot initialize this Event.');
+ }
+
+ void preventDefault() {
+ wrapped.preventDefault();
+ }
+
+ void stopImmediatePropagation() {
+ wrapped.stopImmediatePropagation();
+ }
+
+ void stopPropagation() {
+ wrapped.stopPropagation();
+ }
+}
// Copyright (c) 2012, 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.
@@ -33474,54 +33512,6 @@ class _ValidatingTreeSanitizer implements NodeTreeSanitizer {
/**
- * Helper class to implement custom events which wrap DOM events.
- */
-class _WrappedEvent implements Event {
- final Event wrapped;
- _WrappedEvent(this.wrapped);
-
- bool get bubbles => wrapped.bubbles;
-
- bool get cancelable => wrapped.cancelable;
-
- DataTransfer get clipboardData => wrapped.clipboardData;
-
- EventTarget get currentTarget => wrapped.currentTarget;
-
- bool get defaultPrevented => wrapped.defaultPrevented;
-
- int get eventPhase => wrapped.eventPhase;
-
- EventTarget get target => wrapped.target;
-
- int get timeStamp => wrapped.timeStamp;
-
- String get type => wrapped.type;
-
- void _initEvent(String eventTypeArg, bool canBubbleArg,
- bool cancelableArg) {
- throw new UnsupportedError(
- 'Cannot initialize this Event.');
- }
-
- void preventDefault() {
- wrapped.preventDefault();
- }
-
- void stopImmediatePropagation() {
- wrapped.stopImmediatePropagation();
- }
-
- void stopPropagation() {
- wrapped.stopPropagation();
- }
-}
-// Copyright (c) 2013, 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.
-
-
-/**
* A list which just wraps another list, for either intercepting list calls or
* retyping the list (for example, from List<A> to List<B> where B extends A).
*/
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/dom.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698