[webkit-dev] The case for disallowing alerts in unload, redux

Ryosuke Niwa rniwa at webkit.org
Mon Jun 27 00:11:09 PDT 2011


On Sun, Jun 26, 2011 at 11:48 PM, Sreeram Ramachandran <sreeram at chromium.org
> wrote:
>
> I think the performance benefit and reduction in code complexity are
> secondary. Reducing user annoyance is the number one priority.
>

But websites can annoy users by many other means.  It seems like all we need
is a "do not show again" checkbox rather than disallowing
them indiscriminately.


> I'd prefer to keep things consistent and just disallow all modal dialogs
> in all types of unload handlers (beforeunload, pagehide and unload).
>

Why is that good or necessary?

beforeunload and unload have very different semantics.  beforeunload is
fired before a page is unloaded to make the navigation cancelable and
prepare for unloading the page whereas unload is fired AFTER the page
dismissal has started.  At this point, the navigation cannot be stopped and
all script can do is to save states, etc...

Given these semantics, it seems okay to disallow modal dialogs in unload
event because the navigation cannot be canceled after unload event is fired
and, in fact, browser has already started unloading the page. On the other
hand, disallowing modal dialogs in beforeunload event seems weird to me
because the navigation can still be canceled and the browser hasn't (and
shouldn't have) started evicting the page.

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110627/31771fa6/attachment.html>


More information about the webkit-dev mailing list