Skip to content
Permalink
Browse files
Unreviewed, reverting r294371.
https://bugs.webkit.org/show_bug.cgi?id=240740

Introduced page load regression

Reverted changeset:

"Private relay should fail closed for third party loads if the main resource was loaded over private relay"
https://bugs.webkit.org/show_bug.cgi?id=240483
https://commits.webkit.org/r294371

Canonical link: https://commits.webkit.org/250825@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed May 21, 2022
1 parent 2d87ce8 commit 2969827a64d3b814154186815577248d37d8ab89
Showing 5 changed files with 2 additions and 29 deletions.
@@ -75,8 +75,6 @@ void NetworkCORSPreflightChecker::startPreflight()
m_loadInformation = NetworkTransactionInformation { NetworkTransactionInformation::Type::Preflight, loadParameters.request, { }, { } };

loadParameters.webPageProxyID = m_parameters.webPageProxyID;
loadParameters.topOrigin = m_parameters.topOrigin;
loadParameters.sourceOrigin = m_parameters.sourceOrigin.ptr();

if (auto* networkSession = m_networkProcess->networkSession(m_parameters.sessionID)) {
m_task = NetworkDataTask::create(*networkSession, *this, WTFMove(loadParameters));
@@ -67,7 +67,6 @@ SpeculativeLoad::SpeculativeLoad(Cache& cache, const GlobalFrameID& globalFrameI
parameters.contentSniffingPolicy = ContentSniffingPolicy::DoNotSniffContent;
parameters.contentEncodingSniffingPolicy = ContentEncodingSniffingPolicy::Sniff;
parameters.request = m_originalRequest;
parameters.topOrigin = SecurityOrigin::create(m_originalRequest.firstPartyForCookies());
parameters.isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain;
m_networkLoad = makeUnique<NetworkLoad>(*this, nullptr, WTFMove(parameters), *networkSession);
m_networkLoad->startWithScheduling();
@@ -340,14 +340,6 @@ static inline bool computeIsAlwaysOnLoggingAllowed(NetworkSession& session)
RetainPtr<NSURLRequest> nsRequest = request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::UpdateHTTPBody);
RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);

if (parameters.isMainFrameNavigation
|| parameters.hadMainFrameMainResourcePrivateRelayed
|| !parameters.topOrigin
|| request.url().host() == parameters.topOrigin->host()) {
if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
[mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
}

#if ENABLE(APP_PRIVACY_REPORT)
mutableRequest.get().attribution = request.isAppInitiated() ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser;
#endif
@@ -936,9 +936,7 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)data

NSURLSessionTaskTransactionMetrics *metrics = taskMetrics.transactionMetrics.lastObject;
#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
auto privateRelayed = metrics._privacyStance == nw_connection_privacy_stance_direct
|| metrics._privacyStance == nw_connection_privacy_stance_not_eligible
? PrivateRelayed::No : PrivateRelayed::Yes;
auto privateRelayed = metrics._privacyStance == nw_connection_privacy_stance_direct ? PrivateRelayed::No : PrivateRelayed::Yes;
#else
auto privateRelayed = PrivateRelayed::No;
#endif
@@ -1714,17 +1712,6 @@ static void activateSessionCleanup(NetworkSessionCocoa& session, const NetworkSe
appPrivacyReportTestingData().didLoadAppInitiatedRequest(nsRequest.get().attribution == NSURLRequestAttributionDeveloper);
#endif

// FIXME: This function can make up to 3 copies of a request.
// Reduce that to one if the protocol is null, the request isn't app initiated,
// or the main frame main resource was private relayed, then set all properties
// on the one copy.
if (hadMainFrameMainResourcePrivateRelayed || request.url().host() == clientOrigin.topOrigin.host) {
RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
[mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
nsRequest = WTFMove(mutableRequest);
}

auto& sessionSet = sessionSetForPage(webPageProxyID);
RetainPtr<NSURLSessionWebSocketTask> task = [sessionSet.sessionWithCredentialStorage.session webSocketTaskWithRequest:nsRequest.get()];

@@ -830,19 +830,16 @@ void WebLoaderStrategy::preconnectTo(WebCore::ResourceRequest&& request, WebPage
return;
}

NetworkResourceLoadParameters parameters;

if (auto* document = webPage.mainFrame()->document()) {
if (shouldPreconnectAsFirstParty == ShouldPreconnectAsFirstParty::Yes)
request.setFirstPartyForCookies(request.url());
else
request.setFirstPartyForCookies(document->firstPartyForCookies());
if (auto* loader = document->loader())
request.setIsAppInitiated(loader->lastNavigationWasAppInitiated());
parameters.topOrigin = &document->topOrigin();
parameters.sourceOrigin = &document->securityOrigin();
}

NetworkResourceLoadParameters parameters;
parameters.request = WTFMove(request);
if (parameters.request.httpUserAgent().isEmpty()) {
// FIXME: we add user-agent to the preconnect request because otherwise the preconnect

0 comments on commit 2969827

Please sign in to comment.