Bug 282593
Summary: | [Navigation] Navigation.navigate() should trigger the 'beforeunload' event synchronously | ||
---|---|---|---|
Product: | WebKit | Reporter: | Rob Buis <rbuis> |
Component: | Page Loading | Assignee: | Chris Dumez <cdumez> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | achristensen, beidson, cdumez, karlcow, webkit-bug-importer |
Priority: | P2 | Keywords: | BrowserCompat, InRadar, WPTImpact |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 284637 | ||
Bug Blocks: | 258384 |
Rob Buis
Support beforeunload on subframes.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Rob Buis
This is blocking many navigation-api WPT tests, for example:
navigation-api/navigate-event/navigate-navigation-back-cross-document.html
navigation-api/navigation-methods/return-value/back-beforeunload.html
navigation-api/navigation-methods/return-value/forward-beforeunload.html
navigation-api/navigation-methods/return-value/navigate-beforeunload.html
navigation-api/navigation-methods/return-value/navigate-rejection-order-beforeunload-unserializablestate.html
navigation-api/navigation-methods/return-value/navigate-rejection-order-invalidurl-beforeunload.html
navigation-api/navigation-methods/return-value/reload-beforeunload.html
navigation-api/navigation-methods/return-value/reload-rejection-order-beforeunload-unserializablestate.html
navigation-api/navigation-methods/return-value/traverseTo-beforeunload.html
Rob Buis
Note that this is not just for the benefit of navigation api though, it should allow interoperability with Chrome and gecko too.
Radar WebKit Bug Importer
<rdar://problem/139628818>
Chris Dumez
We do dispatch beforeunload in subframes. The issue is that the tests seem to expect the beforeunload event to get fired *synchronously* when calling `navigate()`. In WebKit, it gets called asynchronously since there is a navigation policy decision that happens before we navigate and this policy decision is normally async.
Rob Buis
(In reply to Chris Dumez from comment #4)
> We do dispatch beforeunload in subframes. The issue is that the tests seem
> to expect the beforeunload event to get fired *synchronously* when calling
> `navigate()`. In WebKit, it gets called asynchronously since there is a
> navigation policy decision that happens before we navigate and this policy
> decision is normally async.
Thanks Chris, I renamed the bug so it reflects it is a problem with Navigation API + beforeunload on subframes, not beforeunload on subframes by itself.
Chris Dumez
BTW, I tried making the policy decision synchronous but it caused other issues. If the navigation happens synchronously, then it ends up canceling the *current* navigation (triggered by Navigation API) and we fire the navigateerror event. This doesn't happen when the navigation happens asynchronously.
Chris Dumez
Pull request: https://github.com/WebKit/WebKit/pull/36915
EWS
Committed 286919@main (4c2147c4b2aa): <https://commits.webkit.org/286919@main>
Reviewed commits have been landed. Closing PR #36915 and removing active labels.
Chris Dumez
Re-opening since the patch got reverted because of a Speedometer regression.
Chris Dumez
Pull request: https://github.com/WebKit/WebKit/pull/38019
EWS
Committed 288106@main (9fb3593f38c1): <https://commits.webkit.org/288106@main>
Reviewed commits have been landed. Closing PR #38019 and removing active labels.