Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a3ea192199a9cf6018890cf11cddfe0b442353be
https://github.com/WebKit/WebKit/commit/a3ea192199a9cf6018890cf11cddfe0b442353be
Author: Chris Dumez <[email protected]>
Date: 2026-04-12 (Sun, 12 Apr 2026)
Changed paths:
M LayoutTests/fast/events/before-unload-sibling-frame-expected.txt
M LayoutTests/fast/events/before-unload-sibling-frame.html
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/navigation-during-beforeunload-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/navigation-during-beforeunload.html
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/refresh-time-expected.txt
A LayoutTests/imported/w3c/web-platform-tests/html/meta/refresh-time.html
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/gotRefreshed.html
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/refresh1.99.html
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/refresh1.html
A
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/refresh1dotdot9dot.html
M Source/WebCore/loader/NavigationDisabler.h
M Source/WebCore/page/LocalFrame.h
Log Message:
-----------
NavigationDisabler should not block navigations in unrelated frames
https://bugs.webkit.org/show_bug.cgi?id=312044
Reviewed by Darin Adler.
NavigationDisabler was storing its disable count on the main frame,
making it page-global. This meant that when shouldClose() dispatched
beforeunload for one iframe, its NavigationDisabler would block
navigations in all other iframes on the page. If JavaScript happened
to schedule a navigation on a sibling iframe during this window (e.g.
via promise microtasks from the beforeunload handler, or from setting
frame.src while an async policy check was in flight), the
scheduleLocationChange would be silently dropped.
Fix by storing the disable count on the specific frame rather than
the main frame. isNavigationAllowed() now walks both directions:
up the ancestor chain (a descendant can't navigate while an ancestor
has beforeunload active) and down the descendant tree (an ancestor
can't navigate while a descendant has beforeunload active). Sibling
frames that are not in the ancestor-descendant chain are unaffected.
This matches the behavior of Chrome and Firefox, where navigations
of sibling iframes are allowed during another iframe's beforeunload
dispatch, while navigations of the frame itself, its ancestors, and
its descendants remain blocked.
* LayoutTests/fast/events/before-unload-sibling-frame-expected.txt:
* LayoutTests/fast/events/before-unload-sibling-frame.html:
Updated test expectations to match the correct behavior: navigating a
sibling iframe during beforeunload should be allowed, not blocked.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/navigation-during-beforeunload-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/navigation-during-beforeunload.html:
Added.
Add WPT test coverage.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/refresh-time-expected.txt:
Added.
* LayoutTests/imported/w3c/web-platform-tests/html/meta/refresh-time.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/gotRefreshed.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/refresh1.99.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/refresh1.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/meta/resources/refresh1dotdot9dot.html:
Added.
Import WPT test from upstream that was failing due to this bug in shipping
Safari. This test is fully passing in Chrome and Firefox.
* Source/WebCore/loader/NavigationDisabler.h:
(WebCore::NavigationDisabler::NavigationDisabler):
(WebCore::NavigationDisabler::~NavigationDisabler):
(WebCore::NavigationDisabler::isNavigationAllowed):
* Source/WebCore/page/LocalFrame.h:
Canonical link: https://commits.webkit.org/311030@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications