Diff
Modified: trunk/Source/WebCore/ChangeLog (270911 => 270912)
--- trunk/Source/WebCore/ChangeLog 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebCore/ChangeLog 2020-12-16 23:14:20 UTC (rev 270912)
@@ -1,3 +1,56 @@
+2020-12-16 Kate Cheney <[email protected]>
+
+ Still can't login to my.playstation.com
+ https://bugs.webkit.org/show_bug.cgi?id=219900
+ <rdar://problem/72062985>
+
+ Reviewed by John Wilander.
+
+ Adapted from an original patch by John Wilander.
+
+ This is a temporary quirk to assist a high-traffic website while they
+ complete the large task of migrating away from login flows that
+ require third party cookies. This quirk will be removed when the site
+ is updated.
+
+ Create a quirk to call the Storage Access API on behalf of Sony. This
+ case is unique because playstation.com requires storage access for 2
+ login domains: sony.com and sonyentertainmentnetwork.com. This patch
+ handles this by requesting storage access for both domains if either
+ domain is requested to avoid massive changes to the Storage Access
+ code to handle multiple domains at once.
+
+ This patch adjusts the quirk code in NetworkStorageSession to handle
+ multiple login domains for a single first party domain.
+
+ No new tests, site specific quirk.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::responseReceived):
+ * page/Quirks.cpp:
+ (WebCore::isPlaystationLoginElement):
+ (WebCore::Quirks::hasStorageAccessForAllLoginDomains):
+ (WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
+ Adjust the existing quirks to handle the new format of a HashSet of
+ login domains, and add the new playstation.com case.
+
+ * page/Quirks.h:
+ * platform/network/NetworkStorageSession.cpp:
+ (WebCore::NetworkStorageSession::grantCrossPageStorageAccess):
+ (WebCore::NetworkStorageSession::hasStorageAccess const):
+ (WebCore::NetworkStorageSession::storageAccessQuirks):
+ (WebCore::NetworkStorageSession::loginDomainMatchesRequestingDomain):
+ (WebCore::NetworkStorageSession::loginDomainsForFirstParty):
+ (WebCore::NetworkStorageSession::findAdditionalLoginDomain):
+ Function to match up Sony login domains with one another at storage
+ endpoints and for prompting so we don't need to thread them through
+ all of the existing storage access code.
+
+ (WebCore::NetworkStorageSession::loginDomainForFirstParty): Renamed to be plural.
+ * platform/network/NetworkStorageSession.h:
+ Adjusted existing quirk code to handle a HashSet of login domains
+ instead of a single domain.
+
2020-12-16 Chris Dumez <[email protected]>
[GPUProcess] Avoid doing an IPC per rendering quantum when using WebAudio
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (270911 => 270912)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2020-12-16 23:14:20 UTC (rev 270912)
@@ -804,8 +804,8 @@
auto& document = *m_frame->document();
if (Quirks::isMicrosoftTeamsRedirectURL(response.url())) {
auto firstPartyDomain = RegistrableDomain(response.url());
- if (auto loginDomain = NetworkStorageSession::loginDomainForFirstParty(firstPartyDomain)) {
- if (!ResourceLoadObserver::shared().hasCrossPageStorageAccess(*loginDomain, firstPartyDomain)) {
+ if (auto loginDomains = NetworkStorageSession::loginDomainsForFirstParty(firstPartyDomain)) {
+ if (!Quirks::hasStorageAccessForAllLoginDomains(*loginDomains, firstPartyDomain)) {
m_frame->navigationScheduler().scheduleRedirect(document, 0, microsoftTeamsRedirectURL());
return;
}
Modified: trunk/Source/WebCore/page/Quirks.cpp (270911 => 270912)
--- trunk/Source/WebCore/page/Quirks.cpp 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebCore/page/Quirks.cpp 2020-12-16 23:14:20 UTC (rev 270912)
@@ -983,6 +983,25 @@
{
return url.host() == "teams.microsoft.com"_s && url.query().toString().contains("Retried+3+times+without+success");
}
+
+static bool isPlaystationLoginElement(const Element& element)
+{
+ if (!element.hasClass())
+ return false;
+
+ auto& classNames = element.classNames();
+ return classNames.contains("web-toolbar__signin-button") || classNames.contains("sb-signin-button");
+}
+
+bool Quirks::hasStorageAccessForAllLoginDomains(const HashSet<RegistrableDomain>& loginDomains, const RegistrableDomain& topFrameDomain)
+{
+ for (auto& loginDomain : loginDomains) {
+ if (!ResourceLoadObserver::shared().hasCrossPageStorageAccess(loginDomain, topFrameDomain))
+ return false;
+ }
+ return true;
+}
+
#endif
Quirks::StorageAccessResult Quirks::triggerOptionalStorageAccessQuirk(Element& element, const PlatformMouseEvent& platformEvent, const AtomString& eventType, int detail, Element* relatedTarget) const
@@ -1060,11 +1079,12 @@
// FIXME(218779): Remove this quirk once microsoft.com completes their login flow redesign.
if (isMicrosoftDomain(domain) && isMicrosoftLoginElement(element)) {
auto firstPartyDomain = NetworkStorageSession::mapToTopDomain(RegistrableDomain::uncheckedCreateFromHost(m_document->topDocument().securityOrigin().host()));
- if (auto loginDomain = NetworkStorageSession::loginDomainForFirstParty(firstPartyDomain)) {
- if (!ResourceLoadObserver::shared().hasCrossPageStorageAccess(*loginDomain, firstPartyDomain)) {
- DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*m_document, WTFMove(*loginDomain), [firstPartyDomain, loginDomain, &element, platformEvent, eventType, detail, relatedTarget](StorageAccessWasGranted storageAccessGranted) mutable {
+ if (auto loginDomains = NetworkStorageSession::loginDomainsForFirstParty(firstPartyDomain)) {
+ if (!hasStorageAccessForAllLoginDomains(*loginDomains, firstPartyDomain)) {
+ auto loginDomain = RegistrableDomain(*loginDomains.value().begin().get());
+ DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*m_document, WTFMove(loginDomain), [firstPartyDomain, loginDomain, &element, platformEvent, eventType, detail, relatedTarget](StorageAccessWasGranted storageAccessGranted) mutable {
if (storageAccessGranted == StorageAccessWasGranted::Yes) {
- ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess({{ firstPartyDomain, *loginDomain }}, [&element, platformEvent, eventType, detail, relatedTarget] {
+ ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess({{ firstPartyDomain, loginDomain }}, [&element, platformEvent, eventType, detail, relatedTarget] {
element.dispatchMouseEvent(platformEvent, eventType, detail, relatedTarget);
});
}
@@ -1074,6 +1094,29 @@
}
return Quirks::StorageAccessResult::ShouldNotCancelEvent;
}
+
+ // Sony Network Entertainment login case.
+ // FIXME(218760): Remove this quirk once playstation.com completes their login flow redesign.
+ static NeverDestroyed<RegistrableDomain> playStationDomain = RegistrableDomain::uncheckedCreateFromRegistrableDomainString("playstation.com"_s);
+ if (domain == playStationDomain && isPlaystationLoginElement(element)) {
+ auto firstPartyDomain = RegistrableDomain(m_document->topDocument().url());
+ if (auto loginDomains = NetworkStorageSession::loginDomainsForFirstParty(firstPartyDomain)) {
+ if (!hasStorageAccessForAllLoginDomains(*loginDomains, firstPartyDomain)) {
+ // Send only one login domain to avoid changing existing Storage Access code, which can only handle a single domain.
+ // We will match Sony login domains up when prompting the user and storing the domains.
+ auto loginDomain = RegistrableDomain(*loginDomains.value().begin().get());
+ DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*m_document, WTFMove(loginDomain), [firstPartyDomain, loginDomain, &element, platformEvent, eventType, detail, relatedTarget](StorageAccessWasGranted storageAccessGranted) mutable {
+ if (storageAccessGranted == StorageAccessWasGranted::Yes) {
+ ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess({{ firstPartyDomain, loginDomain }}, [&element, platformEvent, eventType, detail, relatedTarget] {
+ element.dispatchMouseEvent(platformEvent, eventType, detail, relatedTarget);
+ });
+ }
+ });
+ return Quirks::StorageAccessResult::ShouldCancelEvent;
+ }
+ }
+ return Quirks::StorageAccessResult::ShouldNotCancelEvent;
+ }
}
#else
UNUSED_PARAM(element);
Modified: trunk/Source/WebCore/page/Quirks.h (270911 => 270912)
--- trunk/Source/WebCore/page/Quirks.h 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebCore/page/Quirks.h 2020-12-16 23:14:20 UTC (rev 270912)
@@ -124,6 +124,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
static bool isMicrosoftTeamsRedirectURL(const URL&);
+ static bool hasStorageAccessForAllLoginDomains(const HashSet<RegistrableDomain>&, const RegistrableDomain&);
#endif
private:
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (270911 => 270912)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp 2020-12-16 23:14:20 UTC (rev 270912)
@@ -218,7 +218,14 @@
void NetworkStorageSession::grantCrossPageStorageAccess(const TopFrameDomain& topFrameDomain, const SubResourceDomain& resourceDomain)
{
- m_pairsGrantedCrossPageStorageAccess.add(topFrameDomain, resourceDomain);
+ m_pairsGrantedCrossPageStorageAccess.ensure(topFrameDomain, [] { return HashSet<RegistrableDomain> { };
+ }).iterator->value.add(resourceDomain);
+
+ // Some sites have quirks where multiple login domains require storage access.
+ if (auto additionalLoginDomain = findAdditionalLoginDomain(topFrameDomain, resourceDomain)) {
+ m_pairsGrantedCrossPageStorageAccess.ensure(topFrameDomain, [] { return HashSet<RegistrableDomain> { };
+ }).iterator->value.add(*additionalLoginDomain);
+ }
}
bool NetworkStorageSession::hasStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<FrameIdentifier> frameID, PageIdentifier pageID) const
@@ -241,7 +248,7 @@
}
auto it = m_pairsGrantedCrossPageStorageAccess.find(firstPartyDomain);
- if (it != m_pairsGrantedCrossPageStorageAccess.end() && it->value == resourceDomain)
+ if (it != m_pairsGrantedCrossPageStorageAccess.end() && it->value.contains(resourceDomain))
return true;
}
@@ -374,12 +381,15 @@
return m_ageCapForClientSideCookies;
}
-HashMap<RegistrableDomain, RegistrableDomain>& NetworkStorageSession::storageAccessQuirks()
+HashMap<RegistrableDomain, HashSet<RegistrableDomain>>& NetworkStorageSession::storageAccessQuirks()
{
- static NeverDestroyed<HashMap<RegistrableDomain, RegistrableDomain>> map = [] {
- HashMap<RegistrableDomain, RegistrableDomain> map;
+ static NeverDestroyed<HashMap<RegistrableDomain, HashSet<RegistrableDomain>>> map = [] {
+ HashMap<RegistrableDomain, HashSet<RegistrableDomain>> map;
map.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoft.com"),
- RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoftonline.com"_s));
+ HashSet { RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoftonline.com"_s) });
+ map.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("playstation.com"), HashSet {
+ RegistrableDomain::uncheckedCreateFromRegistrableDomainString("sonyentertainmentnetwork.com"_s),
+ RegistrableDomain::uncheckedCreateFromRegistrableDomainString("sony.com"_s) });
return map;
}();
return map.get();
@@ -387,8 +397,8 @@
bool NetworkStorageSession::loginDomainMatchesRequestingDomain(const TopFrameDomain& topFrameDomain, const SubResourceDomain& resourceDomain)
{
- auto loginDomain = WebCore::NetworkStorageSession::loginDomainForFirstParty(topFrameDomain);
- return loginDomain && resourceDomain == loginDomain;
+ auto loginDomains = WebCore::NetworkStorageSession::loginDomainsForFirstParty(topFrameDomain);
+ return loginDomains && loginDomains.value().contains(resourceDomain);
}
bool NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(const SubResourceDomain& resourceDomain, const TopFrameDomain& topFrameDomain)
@@ -396,7 +406,7 @@
return loginDomainMatchesRequestingDomain(topFrameDomain, resourceDomain);
}
-Optional<RegistrableDomain> NetworkStorageSession::loginDomainForFirstParty(const RegistrableDomain& topFrameDomain)
+Optional<HashSet<RegistrableDomain>> NetworkStorageSession::loginDomainsForFirstParty(const RegistrableDomain& topFrameDomain)
{
auto it = storageAccessQuirks().find(topFrameDomain);
if (it != storageAccessQuirks().end())
@@ -404,6 +414,17 @@
return WTF::nullopt;
}
+Optional<RegistrableDomain> NetworkStorageSession::findAdditionalLoginDomain(const TopFrameDomain& topDomain, const SubResourceDomain& subDomain)
+{
+ if (subDomain.string() == "sony.com"_s && topDomain.string() == "playstation.com"_s)
+ return RegistrableDomain::uncheckedCreateFromRegistrableDomainString("sonyentertainmentnetwork.com"_s);
+
+ if (subDomain.string() == "sonyentertainmentnetwork.com"_s && topDomain.string() == "playstation.com"_s)
+ return RegistrableDomain::uncheckedCreateFromRegistrableDomainString("sony.com"_s);
+
+ return WTF::nullopt;
+}
+
RegistrableDomain NetworkStorageSession::mapToTopDomain(const RegistrableDomain& domainToMap)
{
static NeverDestroyed<HashMap<RegistrableDomain, RegistrableDomain>> map = [] {
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (270911 => 270912)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2020-12-16 23:14:20 UTC (rev 270912)
@@ -215,11 +215,13 @@
WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting();
WEBCORE_EXPORT void setThirdPartyCookieBlockingMode(ThirdPartyCookieBlockingMode);
- WEBCORE_EXPORT static HashMap<RegistrableDomain, RegistrableDomain>& storageAccessQuirks();
+ WEBCORE_EXPORT static HashMap<RegistrableDomain, HashSet<RegistrableDomain>>& storageAccessQuirks();
WEBCORE_EXPORT static bool canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(const SubResourceDomain&, const TopFrameDomain&);
- WEBCORE_EXPORT static Optional<RegistrableDomain> loginDomainForFirstParty(const RegistrableDomain&);
+ WEBCORE_EXPORT static Optional<HashSet<RegistrableDomain>> loginDomainsForFirstParty(const RegistrableDomain&);
WEBCORE_EXPORT static bool loginDomainMatchesRequestingDomain(const TopFrameDomain&, const SubResourceDomain&);
WEBCORE_EXPORT static RegistrableDomain mapToTopDomain(const RegistrableDomain&);
+ WEBCORE_EXPORT static Optional<RegistrableDomain> findAdditionalLoginDomain(const TopFrameDomain&, const SubResourceDomain&);
+
#endif
#if ENABLE(APP_BOUND_DOMAINS)
@@ -279,7 +281,7 @@
HashSet<RegistrableDomain> m_registrableDomainsWithUserInteractionAsFirstParty;
HashMap<PageIdentifier, HashMap<FrameIdentifier, RegistrableDomain>> m_framesGrantedStorageAccess;
HashMap<PageIdentifier, HashMap<RegistrableDomain, RegistrableDomain>> m_pagesGrantedStorageAccess;
- HashMap<TopFrameDomain, SubResourceDomain> m_pairsGrantedCrossPageStorageAccess;
+ HashMap<TopFrameDomain, HashSet<SubResourceDomain>> m_pairsGrantedCrossPageStorageAccess;
Optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { };
Optional<Seconds> m_ageCapForClientSideCookies { };
Optional<Seconds> m_ageCapForClientSideCookiesShort { };
Modified: trunk/Source/WebKit/ChangeLog (270911 => 270912)
--- trunk/Source/WebKit/ChangeLog 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/ChangeLog 2020-12-16 23:14:20 UTC (rev 270912)
@@ -1,3 +1,39 @@
+2020-12-16 Kate Cheney <[email protected]>
+
+ Still can't login to my.playstation.com
+ https://bugs.webkit.org/show_bug.cgi?id=219900
+ <rdar://problem/72062985>
+
+ Reviewed by John Wilander.
+
+ Adapted from an original patch by John Wilander.
+
+ This is a temporary quirk to assist a high-traffic website while they
+ complete the large task of migrating away from login flows that
+ require third party cookies. This quirk will be removed when the site
+ is updated.
+
+ Create a quirk to call the Storage Access API on behalf of Sony.
+
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::buildList):
+ (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
+ * UIProcess/Cocoa/WKStorageAccessAlert.mm:
+ (WebKit::presentStorageAccessAlert):
+ Prompt for multiple domains if site-specific quirks are enabled and
+ either Sony login domain is being requested.
+
+ * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
+ (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const):
+ (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess):
+ * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::addDomainWithPageLevelStorageAccess):
+ Store both Sony login domains as having page level storage access if
+ quirks are enabled and the domain passed is one of the Sony login
+ domains. In this case we know that both login domains were prompted
+ for.
+
2020-12-16 Chris Dumez <[email protected]>
[GPUProcess] Avoid doing an IPC per rendering quantum when using WebAudio
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (270911 => 270912)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2020-12-16 23:14:20 UTC (rev 270912)
@@ -345,8 +345,17 @@
}).get()];
}
-void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy&, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler)
+static String buildListForStorageAccessPrompt(const WebCore::RegistrableDomain subDomainOne, const WebCore::RegistrableDomain subDomainTwo)
{
+ StringBuilder builder;
+ builder.append(subDomainOne.string());
+ builder.append(String([NSString stringWithFormat:@"“ and “"]));
+ builder.append(subDomainTwo.string());
+ return builder.toString();
+}
+
+void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy& webPageProxy, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler)
+{
auto delegate = m_uiDelegate.m_delegate.get();
if (!delegate) {
completionHandler(false);
@@ -353,15 +362,22 @@
return;
}
+ String requestingString;
+ // Some sites have quirks where multiple login domains require storage access.
+ if (auto additionalLoginDomain = WebCore::NetworkStorageSession::findAdditionalLoginDomain(currentDomain, requestingDomain))
+ requestingString = buildListForStorageAccessPrompt(requestingDomain, *additionalLoginDomain);
+ else
+ requestingString = requestingDomain.string();
+
if (!m_uiDelegate.m_delegateMethods.webViewRequestStorageAccessPanelUnderFirstPartyCompletionHandler) {
#if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
- presentStorageAccessAlert(m_uiDelegate.m_webView, requestingDomain, currentDomain, WTFMove(completionHandler));
+ presentStorageAccessAlert(m_uiDelegate.m_webView, requestingString, currentDomain, WTFMove(completionHandler));
#endif
return;
}
auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:));
- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingDomain.string() underCurrentDomain:currentDomain.string() completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingString underCurrentDomain:currentDomain.string() completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
if (checker->completionHandlerHasBeenCalled())
return;
completionHandler(result);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.h (270911 => 270912)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.h 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.h 2020-12-16 23:14:20 UTC (rev 270912)
@@ -41,7 +41,7 @@
namespace WebKit {
-void presentStorageAccessAlert(WKWebView *, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&&);
+void presentStorageAccessAlert(WKWebView *, const String& requestingString, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&&);
}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.mm (270911 => 270912)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.mm 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.mm 2020-12-16 23:14:20 UTC (rev 270912)
@@ -30,18 +30,19 @@
#import "WKWebViewInternal.h"
#import <WebCore/LocalizedStrings.h>
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/RegistrableDomain.h>
#import <wtf/BlockPtr.h>
namespace WebKit {
-void presentStorageAccessAlert(WKWebView *webView, const WebCore::RegistrableDomain& requesting, const WebCore::RegistrableDomain& current, CompletionHandler<void(bool)>&& completionHandler)
+void presentStorageAccessAlert(WKWebView *webView, const String& requesting, const WebCore::RegistrableDomain& current, CompletionHandler<void(bool)>&& completionHandler)
{
auto completionBlock = makeBlockPtr([completionHandler = WTFMove(completionHandler)](bool shouldAllow) mutable {
completionHandler(shouldAllow);
});
- auto requestingDomain = requesting.string().createCFString();
+ auto requestingDomain = requesting.createCFString();
auto currentDomain = current.string().createCFString();
#if PLATFORM(MAC)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp (270911 => 270912)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp 2020-12-16 23:14:20 UTC (rev 270912)
@@ -423,7 +423,7 @@
auto it = m_domainsWithCrossPageStorageAccess.find(topDomain);
if (it != m_domainsWithCrossPageStorageAccess.end())
- return it->value == subDomain;
+ return it->value.contains(subDomain);
return false;
}
@@ -430,9 +430,16 @@
void WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubFrameDomain>&& domains, CompletionHandler<void()>&& completionHandler)
{
- for (auto& topDomain : domains.keys())
- m_domainsWithCrossPageStorageAccess.add(topDomain, domains.get(topDomain));
+ for (auto& topDomain : domains.keys()) {
+ m_domainsWithCrossPageStorageAccess.ensure(topDomain, [] { return HashSet<RegistrableDomain> { };
+ }).iterator->value.add(domains.get(topDomain));
+ // Some sites have quirks where multiple login domains require storage access.
+ if (auto additionalLoginDomain = WebCore::NetworkStorageSession::findAdditionalLoginDomain(topDomain, domains.get(topDomain))) {
+ m_domainsWithCrossPageStorageAccess.ensure(topDomain, [] { return HashSet<RegistrableDomain> { };
+ }).iterator->value.add(*additionalLoginDomain);
+ }
+ }
completionHandler();
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h (270911 => 270912)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h 2020-12-16 23:14:20 UTC (rev 270912)
@@ -87,7 +87,7 @@
WebCore::Timer m_notificationTimer;
HashSet<WebCore::RegistrableDomain> m_domainsWithUserInteraction;
- HashMap<TopFrameDomain, SubFrameDomain> m_domainsWithCrossPageStorageAccess;
+ HashMap<TopFrameDomain, HashSet<SubFrameDomain>> m_domainsWithCrossPageStorageAccess;
#if !RELEASE_LOG_DISABLED
uint64_t m_loggingCounter { 0 };
static bool shouldLogUserInteraction;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (270911 => 270912)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-12-16 21:35:25 UTC (rev 270911)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-12-16 23:14:20 UTC (rev 270912)
@@ -6694,6 +6694,10 @@
void WebPage::addDomainWithPageLevelStorageAccess(const RegistrableDomain& topLevelDomain, const RegistrableDomain& resourceDomain)
{
m_domainsWithPageLevelStorageAccess.add(topLevelDomain, resourceDomain);
+
+ // Some sites have quirks where multiple login domains require storage access.
+ if (auto additionalLoginDomain = NetworkStorageSession::findAdditionalLoginDomain(topLevelDomain, resourceDomain))
+ m_domainsWithPageLevelStorageAccess.add(topLevelDomain, *additionalLoginDomain);
}
bool WebPage::hasPageLevelStorageAccess(const RegistrableDomain& topLevelDomain, const RegistrableDomain& resourceDomain) const