Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 790d0929059fa87c9b159eedefc7943d336cfd18
https://github.com/WebKit/WebKit/commit/790d0929059fa87c9b159eedefc7943d336cfd18
Author: Alex Christensen <[email protected]>
Date: 2026-09-24 (Thu, 24 Sep 2026)
Changed paths:
M Source/WebCore/loader/DocumentPrefetcher.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Loading.mm
Log Message:
-----------
Speculation rules prefetch cancelling cross-origin redirects shouldn't cancel
an actual navigation to the same URL
https://bugs.webkit.org/show_bug.cgi?id=325069
rdar://187701208
Reviewed by Chris Dumez.
In 314970@main I made it so that speculation rules prefetch was restricted to
same-origin loads,
but that introduced two issues. First, if the CachedResource was being used
for a DocumentPrefetcher
and a real navigation, the cancellation would cancel the navigation as well as
the DocumentPrefetcher
load. Second, that cancellation would cause all kinds of assertions then a
crash in
DocumentPrefetcher::takePrefetchedResourceMetrics when called with a null URL.
This fix makes it so we just remove the DocumentPrefetcher as a client of the
CachedResource
if a cross-site redirect happens and there are other clients. I also make
several DocumentPrefetcher
functions more robust against null URLs.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Loading.mm
* Source/WebCore/loader/DocumentPrefetcher.cpp:
(WebCore::DocumentPrefetcher::redirectReceived):
(WebCore::DocumentPrefetcher::removePrefetch):
(WebCore::DocumentPrefetcher::wasPrefetched const):
(WebCore::DocumentPrefetcher::takePrefetchedResourceMetrics):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Loading.mm:
(TestWebKitAPI::TEST(WebKit,
NavigateToInFlightPrefetchWithCrossOriginRedirect)):
Canonical link: https://commits.webkit.org/321796@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications