DescriptionAllowing Window.onBeforeUnload event to work properly.
There are a couple of issues here, fixing some of them, but not quite all.
Background- the beforeunload event is used to present a dialog to the user after they have clicked a window/tab close button, usually to indicate unsaved changes. This is effectively the only mechanism available to preempt the close action.
In WebKit, the user must return a string value from the beforeunload event and that string will be displayed in an alert dialog prompting the user if they are sure they want to leave the page.
In FireFox, IE & the W3C spec, the beforeunload event is of type BeforeUnloadEvent. The string used to prompt the user is specified by the 'returnValue' field. Furthermore, WebKit exposes 'returnValue' as a bool on Event, where the spec does not have it on Event at all.
With this change, a user can utilize the beforeunload event on all platforms:
window.onBeforeUnload.listen((e) {
e.returnValue = "foo!";
});
BUG=2350
Committed: https://code.google.com/p/dart/source/detail?r=21003
Patch Set 1 #Patch Set 2 : Adding support for FireFox #
Total comments: 1
Patch Set 3 : #Messages
Total messages: 10 (0 generated)
|