[webkit-changes] [WebKit/WebKit] a44fcd: Fix several site isolation tests that assert after...
Alex Christensen
noreply at github.com
Tue Sep 17 18:53:53 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a44fcd73edd7995f2eef7e0c62bb36c5b73ef068
https://github.com/WebKit/WebKit/commit/a44fcd73edd7995f2eef7e0c62bb36c5b73ef068
Author: Alex Christensen <achristensen at apple.com>
Date: 2024-09-17 (Tue, 17 Sep 2024)
Changed paths:
M Source/WebCore/loader/DocumentLoader.cpp
M Source/WebCore/loader/EmptyClients.cpp
M Source/WebCore/loader/EmptyFrameLoaderClient.h
M Source/WebCore/loader/FrameLoader.cpp
M Source/WebCore/loader/FrameLoader.h
M Source/WebCore/loader/FrameLoaderTypes.h
M Source/WebCore/loader/LocalFrameLoaderClient.h
M Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
M Source/WebCore/loader/ResourceLoadNotifier.cpp
M Source/WebCore/loader/ResourceLoadNotifier.h
M Source/WebCore/loader/ResourceLoader.cpp
M Source/WebCore/platform/network/mac/WebCoreURLResponse.h
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/ProvisionalPageProxy.h
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxyInternals.h
M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h
M Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
Log Message:
-----------
Fix several site isolation tests that assert after 283102 at main
https://bugs.webkit.org/show_bug.cgi?id=279810
rdar://135761477
Reviewed by Ryosuke Niwa.
A mechanism has been introduced to keep track of whether loads are happening in
each frame by counting the number of outstanding resource requests. This is fine
except for the case of the main resource request of each frame with site isolation
on for two reasons. First, the main resource request may start in one process
then be redirected to a different domain which then continues the load of the same
main resource of a frame in a different process, so state in any one web content
process cannot represent this with a count. Second, a frame may be showing content
in one process which is starting and stopping subresource loads at the same time
as a provisional load is happening in a different process. That provisional load
is guaranteed to only be one main resource request until the load commits.
To have WebPageProxy::generatePageLoadingTimingSoon successfully wait for all the
main resource requests in all frames and all subresource requests in all frames,
I pipe information from the DocumentLoader and FrameLoader to the
WebLocalFrameLoaderClient where we send IPC indicating the begin and end of
subresource requests. This information indicates whether the call is for a
main resource request, in which case it should be omitted from the count.
Instead, I make a FrameLoadStateObserver that simply counts the number of
frames that are between the provisional begin state and the successful or
unsuccessful end state, and I make WebPageProxy::generatePageLoadingTimingSoon
also wait for that count to go to zero.
I needed to add an early return in NetscapePlugInStreamLoader::create because
ResourceLoader::willSendRequestInternal will call didFail then complete with
nullptr, but that messes up the resource accounting in an edge case that is hit
when a test is run after the layout test pdf/pdf-plugin-null-onloaddeddata.html.
I verified this fixes all tests listed in the radar. There is still an issue
with accounting for fragment navigations with site isolation on, but that should
be addressed separately in a PR that is not focused on the main resource accounting.
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::mainReceivedError):
(WebCore::DocumentLoader::finishedLoading):
(WebCore::DocumentLoader::tryLoadingSubstituteData):
(WebCore::DocumentLoader::loadMainResource):
* Source/WebCore/loader/EmptyClients.cpp:
(WebCore::EmptyFrameLoaderClient::assignIdentifierToInitialRequest):
(WebCore::EmptyFrameLoaderClient::dispatchDidFinishLoading):
(WebCore::EmptyFrameLoaderClient::dispatchDidFailLoading):
* Source/WebCore/loader/EmptyFrameLoaderClient.h:
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::willLoadMediaElementURL):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::loadResourceSynchronously):
(WebCore::FrameLoader::requestFromDelegate):
(WebCore::FrameLoader::loadedResourceFromMemoryCache):
* Source/WebCore/loader/FrameLoader.h:
* Source/WebCore/loader/FrameLoaderTypes.h:
* Source/WebCore/loader/LocalFrameLoaderClient.h:
* Source/WebCore/loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::didFinishLoad):
(WebCore::ResourceLoadNotifier::didFailToLoad):
(WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest):
(WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
(WebCore::ResourceLoadNotifier::dispatchDidFailLoading):
(WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
* Source/WebCore/loader/ResourceLoadNotifier.h:
* Source/WebCore/loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
* Source/WebCore/platform/network/mac/WebCoreURLResponse.h:
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::didReceiveMessage):
(WebKit::ProvisionalPageProxy::startNetworkRequestsForPageLoadTiming): Deleted.
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didCreateSubframe):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::generatePageLoadingTimingSoon):
(WebKit::WebPageProxy::observeAndCreateRemoteSubframesInOtherProcesses):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::createRemoteSubframesInOtherProcesses): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::assignIdentifierToInitialRequest):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFinishLoading):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFailLoading):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addResourceRequest):
(WebKit::WebPage::removeResourceRequest):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::assignIdentifierToInitialRequest):
(WebFrameLoaderClient::dispatchDidFinishLoading):
(WebFrameLoaderClient::dispatchDidFailLoading):
Canonical link: https://commits.webkit.org/283813@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list