gecko-dev/docshell
Kris Maglione b68275373e Bug 1672479: Fix beforeunload handling in location.refresh under SHiP. r=peterv
Per spec, whenever a "beforeunload" event handler which would affect a
`location.reload()` call exists, it must be called before the `reload()` call
returns. If a handler requests to block the navigation and we choose to
display a confirmation prompt, that must also be displayed before the call
returns.

With session history in parent, though, that currently does not happen,
because `location.reload()` triggers an async IPC call to the parent process,
and only attempts the actual reload (and thus beforeunload dispatch and
prompting) once it returns, which is too late to affect the caller.

This patch changes the handling in this case to manually perform permit unload
checks before taking an async code path. This still leaves the opportunity for
session history handlers in the parent to cancel the load asynchronously, but
that doesn't violate any spec-defined behavior.

Differential Revision: https://phabricator.services.mozilla.com/D94354
2020-12-14 21:25:46 +00:00
..
base Bug 1672479: Fix beforeunload handling in location.refresh under SHiP. r=peterv 2020-12-14 21:25:46 +00:00
build Bug 1674569 - about:processes registration should no longer be limited to Nightly builds, r=mconley 2020-11-05 19:37:01 +00:00
resources/content Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00
shistory Bug 1678062 - Remove unnecessary includes. r=andi 2020-11-23 16:12:02 +00:00
test Bug 1672479: Fix beforeunload handling in location.refresh under SHiP. r=peterv 2020-12-14 21:25:46 +00:00
moz.build Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00