Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e5d4f4568fdeda62d3855fff8da75d118e810250
https://github.com/WebKit/WebKit/commit/e5d4f4568fdeda62d3855fff8da75d118e810250
Author: Chris Dumez <[email protected]>
Date: 2026-04-13 (Mon, 13 Apr 2026)
Changed paths:
M LayoutTests/fast/events/before-unload-forbidden-navigation-expected.txt
M LayoutTests/fast/events/before-unload-forbidden-navigation.html
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/browsers/browsing-the-web/unloading-documents/navigation-during-beforeunload-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/navigation-during-beforeunload.html
A
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/support/navigation-during-beforeunload-container.html
A
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/support/navigation-target.html
A
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/support/navigation-target2.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
Log Message:
-----------
NavigationDisabler should not block navigations in unrelated frames
https://bugs.webkit.org/show_bug.cgi?id=312044
rdar://174592318
Reviewed by Anne van Kesteren.
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, including siblings. If
JavaScript happened to schedule a navigation on a sibling iframe during
this window (e.g. via the beforeunload handler), the navigation would be
silently dropped.
Fix by storing the disable count on the specific frame rather than the
main frame. isNavigationAllowed() now checks only the target frame's own
disable count. Sibling frames, ancestor frames, and descendant frames
are all unaffected.
This matches Chromium's FrameNavigationDisabler, which sets
navigation_disable_count_ on the specific frame being navigated and
checks only that frame's count in IsNavigationAllowed().
Tests:
imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/navigation-during-beforeunload.html
imported/w3c/web-platform-tests/html/meta/refresh-time.html
* LayoutTests/fast/events/before-unload-sibling-frame-expected.txt:
* LayoutTests/fast/events/before-unload-sibling-frame.html:
Updated test: navigating a sibling iframe during beforeunload should now
succeed, not be blocked.
*
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/navigation-during-beforeunload-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/navigation-during-beforeunload.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/support/navigation-during-beforeunload-container.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/support/navigation-target.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/support/navigation-target2.html:
Added.
WPT test with three subtests: sibling navigation (not blocked), self
navigation (blocked), and parent navigation (not blocked). The parent
navigation test uses a container iframe so the test harness isn't
navigated away. This test is passing in Chrome and Firefox.
*
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.
Imported WPT test from upstream that was failing due to this bug in
shipping Safari.
* Source/WebCore/loader/NavigationDisabler.h:
(WebCore::NavigationDisabler::NavigationDisabler):
(WebCore::NavigationDisabler::~NavigationDisabler):
(WebCore::NavigationDisabler::isNavigationAllowed):
Canonical link: https://commits.webkit.org/311054@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications