Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0c4284a07df5588ca03abf283e1cf9152ca1666a
https://github.com/WebKit/WebKit/commit/0c4284a07df5588ca03abf283e1cf9152ca1666a
Author: Chris Dumez <[email protected]>
Date: 2026-10-02 (Fri, 02 Oct 2026)
Changed paths:
M Source/WebCore/loader/DocumentLoader.cpp
M Source/WebCore/loader/DocumentLoader.h
M Source/WebCore/loader/FrameLoader.cpp
M Source/WebCore/loader/FrameLoader.h
M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm
Log Message:
-----------
Going back to a POST page reports a spurious provisional load failure when
the cache-only load misses
https://bugs.webkit.org/show_bug.cgi?id=325937
Reviewed by Basuke Suzuki.
When going back to a form submission, FrameLoader first attempts a cache-only
load. If that
misses, retryAfterFailedCacheOnlyMainResourceLoad() stops all loaders and
retries as a form
resubmission. Stopping the loaders reported a -999 didFailProvisionalLoad to
the client, and the
retry then started under a new navigation (navigationID=0). Clients therefore
saw the back
navigation fail even though the load was continuing.
On a page that has not committed yet (e.g. after a WebContent process crash),
this failure clears
WKWebView.URL. MobileSafari reacts by restoring the session state, which
repeats the cache-only
load, and the loop re-prompts "Are you sure you want to submit this form
again?" faster than the
user can dismiss it.
The retry now continues the original navigation: the cancellation of the
cache-only load is not
reported, the retry's DocumentLoader inherits the original navigation ID, and
its provisional load
start is not sent to the UIProcess again, since the UIProcess still considers
the navigation
provisional. If the resubmission is declined, a single cancellation is reported
for the original
navigation.
This is WebKit-side hardening for rdar://187512112.
Tests: WKBackForwardList.GoBackToFormSubmissionResubmitsWithinSameNavigation
WKBackForwardList.GoBackToFormSubmissionDeclinedResubmissionFailsNavigation
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::clearMainResourceLoader):
(WebCore::DocumentLoader::clearMainResource):
* Source/WebCore/loader/DocumentLoader.h:
(WebCore::DocumentLoader::isCacheOnlyLoadRetry const):
(WebCore::DocumentLoader::setIsCacheOnlyLoadRetry):
(WebCore::DocumentLoader::takeNavigationID):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadWithNavigationAction):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
(WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
* Source/WebCore/loader/FrameLoader.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidStartProvisionalLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFailProvisionalLoad):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKBackForwardListTests.mm:
(webViewWithFormSubmissionInBackList):
(formSubmissionServer):
(TEST(WKBackForwardList, GoBackToFormSubmissionResubmitsWithinSameNavigation)):
(TEST(WKBackForwardList,
GoBackToFormSubmissionDeclinedResubmissionFailsNavigation)):
Canonical link: https://commits.webkit.org/322516@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications