Skip to content

Commit

Permalink
Switch cookie accept policy when using managed domains
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=262415
<rdar://116025019>

Reviewed by Pascoe.

The ITP features block third party cookie access, and purge local state regularly.
When an MDM application is running with managed domains, we should adjust cookie
acceptance policy to support those managed origins.

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setManagedDomainsForResourceLoadStatistics):

Canonical link: https://commits.webkit.org/268871@main
  • Loading branch information
brentfulgham authored and Brent Fulgham committed Oct 4, 2023
1 parent ae65b1c commit 8d0a1a9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Source/WebKit/NetworkProcess/NetworkProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,13 +1327,19 @@ void NetworkProcess::setAppBoundDomainsForResourceLoadStatistics(PAL::SessionID
#endif

#if ENABLE(MANAGED_DOMAINS)
void NetworkProcess::setManagedDomainsForResourceLoadStatistics(PAL::SessionID sessionID, HashSet<WebCore::RegistrableDomain>&& appBoundDomains, CompletionHandler<void()>&& completionHandler)
void NetworkProcess::setManagedDomainsForResourceLoadStatistics(PAL::SessionID sessionID, HashSet<WebCore::RegistrableDomain>&& managedDomains, CompletionHandler<void()>&& completionHandler)
{
if (auto* session = networkSession(sessionID)) {
if (auto* resourceLoadStatistics = session->resourceLoadStatistics()) {
resourceLoadStatistics->setManagedDomains(WTFMove(appBoundDomains), WTFMove(completionHandler));
return;
}
supplement<WebCookieManager>()->setHTTPCookieAcceptPolicy(sessionID, WebCore::HTTPCookieAcceptPolicy::AlwaysAccept, [session = WeakPtr { *session }, managedDomains = WTFMove(managedDomains), completionHandler = WTFMove(completionHandler)]() mutable {
if (session) {
if (auto* resourceLoadStatistics = session->resourceLoadStatistics()) {
resourceLoadStatistics->setManagedDomains(WTFMove(managedDomains), WTFMove(completionHandler));
return;
}
}
completionHandler();
});
return;
}
ASSERT_NOT_REACHED();
completionHandler();
Expand Down

0 comments on commit 8d0a1a9

Please sign in to comment.