Changeset 269807 in webkit
- Timestamp:
- Nov 13, 2020, 4:55:05 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 25 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/DocumentStorageAccess.cpp (modified) (2 diffs)
-
WebCore/dom/Element.cpp (modified) (1 diff)
-
WebCore/loader/ResourceLoadObserver.h (modified) (2 diffs)
-
WebCore/page/Quirks.cpp (modified) (3 diffs)
-
WebCore/page/Quirks.h (modified) (3 diffs)
-
WebCore/platform/network/NetworkStorageSession.cpp (modified) (5 diffs)
-
WebCore/platform/network/NetworkStorageSession.h (modified) (3 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (modified) (6 diffs)
-
WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h (modified) (1 diff)
-
WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (modified) (2 diffs)
-
WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (modified) (2 diffs)
-
WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (modified) (2 diffs)
-
WebKit/Shared/WebProcessDataStoreParameters.h (modified) (5 diffs)
-
WebKit/UIProcess/Network/NetworkProcessProxy.cpp (modified) (2 diffs)
-
WebKit/UIProcess/Network/NetworkProcessProxy.h (modified) (1 diff)
-
WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (modified) (1 diff)
-
WebKit/UIProcess/WebProcessPool.cpp (modified) (2 diffs)
-
WebKit/UIProcess/WebProcessPool.h (modified) (2 diffs)
-
WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h (modified) (3 diffs)
-
WebKit/WebProcess/WebProcess.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebProcess.h (modified) (2 diffs)
-
WebKit/WebProcess/WebProcess.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269806 r269807 1 2020-11-13 Kate Cheney <katherine_cheney@apple.com> 2 3 Can't login to Microsoft Teams 4 https://bugs.webkit.org/show_bug.cgi?id=218778 5 <rdar://problem/36331568> 6 7 Reviewed by John Wilander. 8 9 This is a temporary quirk to assist a high-traffic website while they 10 complete the large task of migrating away from login flows that 11 require third party cookies. This quirk will be removed when the site 12 is updated. 13 14 Create a quirk to call the Storage Access API on behalf of Microsoft. 15 16 No new tests, site-specific quirk. 17 18 * dom/Element.cpp: 19 (WebCore::Element::dispatchMouseEvent): 20 Pass additional parameters to be able to dispatch a synthetic click 21 if storage access is granted. 22 23 * loader/ResourceLoadObserver.h: 24 (WebCore::ResourceLoadObserver::setDomainsWithCrossPageStorageAccess): 25 (WebCore::ResourceLoadObserver::hasCrossPageStorageAccess const): 26 Store domains in the web process to avoid async calls to the network 27 process. 28 29 (WebCore::isMicrosoftLoginElement): 30 (WebCore::isMicrosoftDomain): 31 * page/Quirks.cpp: 32 (WebCore::Quirks::triggerOptionalStorageAccessQuirk const): 33 This is the quirk. 34 35 * page/Quirks.h: 36 * platform/network/NetworkStorageSession.cpp: 37 (WebCore::NetworkStorageSession::setDomainsWithCrossPageStorageAccess): 38 (WebCore::NetworkStorageSession::grantCrossPageStorageAccess): 39 (WebCore::NetworkStorageSession::hasStorageAccess const): 40 (WebCore::NetworkStorageSession::grantStorageAccess): 41 (WebCore::NetworkStorageSession::removeAllStorageAccess): 42 (WebCore::NetworkStorageSession::storageAccessQuirks): 43 (WebCore::NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction): 44 (WebCore::NetworkStorageSession::loginDomainForFirstParty): 45 (WebCore::NetworkStorageSession::mapToTopDomain): 46 The user might go directly to login.live.com to sign in to Microsoft 47 Teams, but may not have seen the Storage Access prompt. In this case, 48 we should map live.com to microsoft.com and request storage access for 49 microsoftonline.com under microsoft.com. Since login.live.com is used 50 for other Microsoft login flows besides Teams, a user may have to 51 grant storage access to microsoftonline.com even when it is not needed 52 to complete the login. But this guarantees they will always be 53 successfully logged into all Microsoft accounts. 54 55 * platform/network/NetworkStorageSession.h: 56 In order for the user to stay logged in between sessions, we should 57 update NetworkStorageSession to grant storage access based on values 58 stored in the ITP database for quirk domains. 59 1 60 2020-11-13 Brian Burg <bburg@apple.com> 2 61 -
trunk/Source/WebCore/dom/DocumentStorageAccess.cpp
r267973 r269807 37 37 #include "FrameLoaderClient.h" 38 38 #include "JSDOMPromiseDeferred.h" 39 #include "NetworkStorageSession.h" 39 40 #include "Page.h" 40 41 #include "RegistrableDomain.h" … … 266 267 RELEASE_ASSERT(m_document.frame() && m_document.frame()->page()); 267 268 268 m_document.frame()->page()->chrome().client().requestStorageAccess(WTFMove(requestingDomain), RegistrableDomain::uncheckedCreateFromHost(m_document.topDocument().securityOrigin().host()), *m_document.frame(), m_storageAccessScope, [this, weakThis = makeWeakPtr(*this), completionHandler = WTFMove(completionHandler)] (RequestStorageAccessResult result) mutable { 269 auto topFrameDomain = NetworkStorageSession::mapToTopDomain(RegistrableDomain(m_document.topDocument().url())); 270 271 m_document.frame()->page()->chrome().client().requestStorageAccess(WTFMove(requestingDomain), WTFMove(topFrameDomain), *m_document.frame(), m_storageAccessScope, [this, weakThis = makeWeakPtr(*this), completionHandler = WTFMove(completionHandler)] (RequestStorageAccessResult result) mutable { 269 272 if (!weakThis) 270 273 return; -
trunk/Source/WebCore/dom/Element.cpp
r269587 r269807 390 390 return false; 391 391 392 if (Quirks::StorageAccessResult::ShouldCancelEvent == document().quirks().triggerOptionalStorageAccessQuirk(*this, eventType))392 if (Quirks::StorageAccessResult::ShouldCancelEvent == document().quirks().triggerOptionalStorageAccessQuirk(*this, platformEvent, eventType, detail, relatedTarget)) 393 393 return false; 394 394 -
trunk/Source/WebCore/loader/ResourceLoadObserver.h
r266214 r269807 40 40 WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 using TopFrameDomain = WebCore::RegistrableDomain; 43 using SubResourceDomain = WebCore::RegistrableDomain; 44 42 45 // https://fetch.spec.whatwg.org/#request-destination-script-like 43 46 enum class FetchDestinationIsScriptLike : bool { Yes, No }; … … 66 69 67 70 virtual void setDomainsWithUserInteraction(HashSet<RegistrableDomain>&&) { } 71 virtual void setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&&, CompletionHandler<void()>&& completionHandler) { completionHandler(); } 72 virtual bool hasCrossPageStorageAccess(const SubResourceDomain&, const TopFrameDomain&) const { return false; } 68 73 virtual bool hasHadUserInteraction(const RegistrableDomain&) const { return false; } 69 74 }; -
trunk/Source/WebCore/page/Quirks.cpp
r269780 r269807 43 43 #include "LayoutUnit.h" 44 44 #include "NamedNodeMap.h" 45 #include "NetworkStorageSession.h" 45 46 #include "ResourceLoadObserver.h" 46 47 #include "RuntimeEnabledFeatures.h" … … 962 963 return false; 963 964 } 964 #endif 965 966 Quirks::StorageAccessResult Quirks::triggerOptionalStorageAccessQuirk(const Element& element, const AtomString& eventType) const 965 966 static bool isMicrosoftLoginElement(const Element& element) 967 { 968 if (!element.hasClass()) 969 return false; 970 971 auto& classNames = element.classNames(); 972 return classNames.contains("glyph_signIn_circle") || classNames.contains("mectrl_headertext") || classNames.contains("mectrl_header") || classNames.contains("ext-button primary") || classNames.contains("ext-primary"); 973 } 974 975 static bool isMicrosoftDomain(const RegistrableDomain& domain) 976 { 977 static NeverDestroyed<RegistrableDomain> microsoftDotCom = RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoft.com"_s); 978 static NeverDestroyed<RegistrableDomain> liveDotCom = RegistrableDomain::uncheckedCreateFromRegistrableDomainString("live.com"_s); 979 980 return domain == microsoftDotCom || domain == liveDotCom; 981 } 982 #endif 983 984 Quirks::StorageAccessResult Quirks::triggerOptionalStorageAccessQuirk(Element& element, const PlatformMouseEvent& platformEvent, const AtomString& eventType, int detail, Element* relatedTarget) const 967 985 { 968 986 #if ENABLE(RESOURCE_LOAD_STATISTICS) … … 1034 1052 } 1035 1053 } 1054 1055 // Microsoft Teams login case. 1056 // FIXME(218779): Remove this quirk once microsoft.com completes their login flow redesign. 1057 if (isMicrosoftDomain(domain) && isMicrosoftLoginElement(element)) { 1058 auto firstPartyDomain = NetworkStorageSession::mapToTopDomain(RegistrableDomain::uncheckedCreateFromHost(m_document->topDocument().securityOrigin().host())); 1059 if (auto loginDomain = NetworkStorageSession::loginDomainForFirstParty(firstPartyDomain)) { 1060 if (!ResourceLoadObserver::shared().hasCrossPageStorageAccess(*loginDomain, firstPartyDomain)) { 1061 DocumentStorageAccess::requestStorageAccessForNonDocumentQuirk(*m_document, WTFMove(*loginDomain), [firstPartyDomain, loginDomain, &element, platformEvent, eventType, detail, relatedTarget](StorageAccessWasGranted storageAccessGranted) mutable { 1062 if (storageAccessGranted == StorageAccessWasGranted::Yes) { 1063 ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess({{ firstPartyDomain, *loginDomain }}, [&element, platformEvent, eventType, detail, relatedTarget] { 1064 element.dispatchMouseEvent(platformEvent, eventType, detail, relatedTarget); 1065 }); 1066 } 1067 }); 1068 return Quirks::StorageAccessResult::ShouldCancelEvent; 1069 } 1070 } 1071 return Quirks::StorageAccessResult::ShouldNotCancelEvent; 1072 } 1036 1073 } 1037 1074 #else 1038 1075 UNUSED_PARAM(element); 1076 UNUSED_PARAM(platformEvent); 1039 1077 UNUSED_PARAM(eventType); 1078 UNUSED_PARAM(detail); 1079 UNUSED_PARAM(relatedTarget); 1040 1080 #endif 1041 1081 return Quirks::StorageAccessResult::ShouldNotCancelEvent; -
trunk/Source/WebCore/page/Quirks.h
r268114 r269807 38 38 class HTMLVideoElement; 39 39 class LayoutUnit; 40 class PlatformMouseEvent; 40 41 41 42 class Quirks { … … 113 114 114 115 enum StorageAccessResult : bool { ShouldNotCancelEvent, ShouldCancelEvent }; 115 StorageAccessResult triggerOptionalStorageAccessQuirk( const Element&, const AtomString& eventType) const;116 StorageAccessResult triggerOptionalStorageAccessQuirk(Element&, const PlatformMouseEvent&, const AtomString& eventType, int, Element*) const; 116 117 117 118 bool needsVP9FullRangeFlagQuirk() const; … … 155 156 }; 156 157 157 } 158 } // namespace WebCore -
trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp
r266829 r269807 210 210 } 211 211 212 void NetworkStorageSession::setDomainsWithCrossPageStorageAccess(const HashMap<TopFrameDomain, SubResourceDomain>& domains) 213 { 214 m_pairsGrantedCrossPageStorageAccess.clear(); 215 for (auto& topFrameDomain : domains.keys()) 216 grantCrossPageStorageAccess(topFrameDomain, domains.get(topFrameDomain)); 217 } 218 219 void NetworkStorageSession::grantCrossPageStorageAccess(const TopFrameDomain& topFrameDomain, const SubResourceDomain& resourceDomain) 220 { 221 m_pairsGrantedCrossPageStorageAccess.add(topFrameDomain, resourceDomain); 222 } 223 212 224 bool NetworkStorageSession::hasStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<FrameIdentifier> frameID, PageIdentifier pageID) const 213 225 { … … 228 240 return true; 229 241 } 242 243 auto it = m_pairsGrantedCrossPageStorageAccess.find(firstPartyDomain); 244 if (it != m_pairsGrantedCrossPageStorageAccess.end() && it->value == resourceDomain) 245 return true; 230 246 } 231 247 … … 245 261 void NetworkStorageSession::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<FrameIdentifier> frameID, PageIdentifier pageID) 246 262 { 263 if (NetworkStorageSession::loginDomainMatchesRequestingDomain(firstPartyDomain, resourceDomain)) { 264 grantCrossPageStorageAccess(firstPartyDomain, resourceDomain); 265 return; 266 } 267 247 268 if (!frameID) { 248 269 if (firstPartyDomain.isEmpty()) … … 298 319 m_pagesGrantedStorageAccess.clear(); 299 320 m_framesGrantedStorageAccess.clear(); 321 m_pairsGrantedCrossPageStorageAccess.clear(); 300 322 } 301 323 … … 352 374 return m_ageCapForClientSideCookies; 353 375 } 376 377 HashMap<RegistrableDomain, RegistrableDomain>& NetworkStorageSession::storageAccessQuirks() 378 { 379 static NeverDestroyed<HashMap<RegistrableDomain, RegistrableDomain>> map = [] { 380 HashMap<RegistrableDomain, RegistrableDomain> map; 381 map.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoft.com"), 382 RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoftonline.com"_s)); 383 return map; 384 }(); 385 return map.get(); 386 } 387 388 bool NetworkStorageSession::loginDomainMatchesRequestingDomain(const TopFrameDomain& topFrameDomain, const SubResourceDomain& resourceDomain) 389 { 390 auto loginDomain = WebCore::NetworkStorageSession::loginDomainForFirstParty(topFrameDomain); 391 return loginDomain && resourceDomain == loginDomain; 392 } 393 394 bool NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(const SubResourceDomain& resourceDomain, const TopFrameDomain& topFrameDomain) 395 { 396 return loginDomainMatchesRequestingDomain(topFrameDomain, resourceDomain); 397 } 398 399 Optional<RegistrableDomain> NetworkStorageSession::loginDomainForFirstParty(const RegistrableDomain& topFrameDomain) 400 { 401 auto it = storageAccessQuirks().find(topFrameDomain); 402 if (it != storageAccessQuirks().end()) 403 return it->value; 404 return WTF::nullopt; 405 } 406 407 RegistrableDomain NetworkStorageSession::mapToTopDomain(const RegistrableDomain& domainToMap) 408 { 409 static NeverDestroyed<HashMap<RegistrableDomain, RegistrableDomain>> map = [] { 410 HashMap<RegistrableDomain, RegistrableDomain> map; 411 map.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString("live.com"), 412 RegistrableDomain::uncheckedCreateFromRegistrableDomainString("microsoft.com"_s)); 413 return map; 414 }(); 415 416 auto it = map.get().find(domainToMap); 417 if (it != map.get().end()) 418 return it->value; 419 return domainToMap; 420 } 421 354 422 #endif // ENABLE(RESOURCE_LOAD_STATISTICS) 355 423 -
trunk/Source/WebCore/platform/network/NetworkStorageSession.h
r269512 r269807 200 200 WEBCORE_EXPORT void setPrevalentDomainsToBlockButKeepCookiesFor(const Vector<RegistrableDomain>&); 201 201 WEBCORE_EXPORT void setDomainsWithUserInteractionAsFirstParty(const Vector<RegistrableDomain>&); 202 WEBCORE_EXPORT void setDomainsWithCrossPageStorageAccess(const HashMap<TopFrameDomain, SubResourceDomain>&); 203 WEBCORE_EXPORT void grantCrossPageStorageAccess(const TopFrameDomain&, const SubResourceDomain&); 202 204 WEBCORE_EXPORT void setAgeCapForClientSideCookies(Optional<Seconds>); 203 205 WEBCORE_EXPORT bool hasStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<FrameIdentifier>, PageIdentifier) const; … … 213 215 WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting(); 214 216 WEBCORE_EXPORT void setThirdPartyCookieBlockingMode(ThirdPartyCookieBlockingMode); 217 218 WEBCORE_EXPORT static HashMap<RegistrableDomain, RegistrableDomain>& storageAccessQuirks(); 219 WEBCORE_EXPORT static bool canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(const SubResourceDomain&, const TopFrameDomain&); 220 WEBCORE_EXPORT static Optional<RegistrableDomain> loginDomainForFirstParty(const RegistrableDomain&); 221 WEBCORE_EXPORT static bool loginDomainMatchesRequestingDomain(const TopFrameDomain&, const SubResourceDomain&); 222 WEBCORE_EXPORT static RegistrableDomain mapToTopDomain(const RegistrableDomain&); 215 223 #endif 216 224 … … 272 280 HashMap<PageIdentifier, HashMap<FrameIdentifier, RegistrableDomain>> m_framesGrantedStorageAccess; 273 281 HashMap<PageIdentifier, HashMap<RegistrableDomain, RegistrableDomain>> m_pagesGrantedStorageAccess; 282 HashMap<TopFrameDomain, SubResourceDomain> m_pairsGrantedCrossPageStorageAccess; 274 283 Optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { }; 275 284 Optional<Seconds> m_ageCapForClientSideCookies { }; -
trunk/Source/WebKit/ChangeLog
r269805 r269807 1 2020-11-13 Kate Cheney <katherine_cheney@apple.com> 2 3 Can't login to Microsoft Teams 4 https://bugs.webkit.org/show_bug.cgi?id=218778 5 <rdar://problem/36331568> 6 7 Reviewed by John Wilander. 8 9 This is a temporary quirk to assist a high-traffic website while they 10 complete the large task of migrating away from login flows that 11 require third party cookies. This quirk will be removed when the site 12 is updated. 13 14 Create a quirk to call the Storage Access API on behalf of Microsoft. 15 16 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 17 (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): 18 (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): 19 Relax the requirement for user interaction for a specific third party 20 needing cookies for authentication purposes. 21 22 (WebKit::ResourceLoadStatisticsDatabaseStore::clear): 23 (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): 24 Relax the requirement for user interaction for a specific third party 25 needing cookies for authentication purposes. 26 27 (WebKit::ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess const): 28 (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking): 29 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 30 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 31 (WebKit::ResourceLoadStatisticsMemoryStore::clear): 32 (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): 33 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 34 (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral): 35 Relax user interaction for reasons above. 36 37 (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): 38 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 39 (WebKit::RegistrableDomainsToBlockCookiesFor::isolatedCopy const): 40 * Shared/WebProcessDataStoreParameters.h: 41 (WebKit::WebProcessDataStoreParameters::encode const): 42 (WebKit::WebProcessDataStoreParameters::decode): 43 * UIProcess/Network/NetworkProcessProxy.cpp: 44 (WebKit::NetworkProcessProxy::setDomainsWithCrossPageStorageAccess): 45 * UIProcess/Network/NetworkProcessProxy.h: 46 * UIProcess/Network/NetworkProcessProxy.messages.in: 47 * UIProcess/WebProcessPool.cpp: 48 (WebKit::WebProcessPool::webProcessDataStoreParameters): 49 (WebKit::WebProcessPool::setDomainsWithCrossPageStorageAccess): 50 * UIProcess/WebProcessPool.h: 51 * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp: 52 (WebKit::WebResourceLoadObserver::hasCrossPageStorageAccess const): 53 (WebKit::WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess): 54 * WebProcess/WebCoreSupport/WebResourceLoadObserver.h: 55 * WebProcess/WebProcess.cpp: 56 (WebKit::WebProcess::setWebsiteDataStoreParameters): 57 (WebKit::WebProcess::setDomainsWithCrossPageStorageAccess): 58 Add quirk'd domains to have page level storage access to be able to 59 use document.cookie. 60 61 * WebProcess/WebProcess.h: 62 * WebProcess/WebProcess.messages.in: 63 Forward domains with the storage access quirk to the web process to 64 avoid an async call to the network process. 65 1 66 2020-11-13 Sam Weinig <weinig@apple.com> 2 67 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r268458 r269807 1325 1325 } 1326 1326 ASSERT(subFrameStatus.first == AddedRecord::No); 1327 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 1327 #if ASSERT_ENABLED 1328 if (!NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(subFrameDomain, topFrameDomain)) 1329 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 1330 #endif 1328 1331 insertDomainRelationshipList(storageAccessUnderTopFrameDomainsQuery, HashSet<RegistrableDomain>({ topFrameDomain }), *subFrameStatus.second); 1329 1332 } … … 1349 1352 } 1350 1353 ASSERT(subFrameStatus.first == AddedRecord::No); 1351 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 1354 #if ASSERT_ENABLED 1355 if (!NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(subFrameDomain, topFrameDomain)) 1356 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 1357 #endif 1352 1358 ASSERT(hasUserGrantedStorageAccessThroughPrompt(*subFrameStatus.second, topFrameDomain) == StorageAccessPromptWasShown::Yes); 1353 1359 #endif … … 2004 2010 2005 2011 auto registrableDomainsToBlockAndDeleteCookiesFor = ensurePrevalentResourcesForDebugMode(); 2006 RegistrableDomainsToBlockCookiesFor domainsToBlock { registrableDomainsToBlockAndDeleteCookiesFor, { }, { } };2012 RegistrableDomainsToBlockCookiesFor domainsToBlock { registrableDomainsToBlockAndDeleteCookiesFor, { }, { }, { } }; 2007 2013 updateCookieBlockingForDomains(domainsToBlock, [callbackAggregator] { }); 2008 2014 } … … 2037 2043 return CookieAccess::BasedOnCookiePolicy; 2038 2044 2039 if (! hadUserInteraction)2045 if (!NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(subresourceDomain, topFrameDomain) && !hadUserInteraction) 2040 2046 return CookieAccess::CannotRequest; 2041 2047 … … 2104 2110 } 2105 2111 2112 HashMap<TopFrameDomain, SubResourceDomain> ResourceLoadStatisticsDatabaseStore::domainsWithStorageAccess() const 2113 { 2114 ASSERT(!RunLoop::isMain()); 2115 2116 HashMap<WebCore::RegistrableDomain, WebCore::RegistrableDomain> results; 2117 SQLiteStatement statement(m_database, "SELECT subFrameDomain, registrableDomain FROM (SELECT o.registrableDomain as subFrameDomain, s.topLevelDomainID as topLevelDomainID FROM ObservedDomains as o INNER JOIN StorageAccessUnderTopFrameDomains as s WHERE o.domainID = s.domainID) as z INNER JOIN ObservedDomains ON domainID = z.topLevelDomainID;"_s); 2118 2119 if (statement.prepare() != SQLITE_OK) 2120 return results; 2121 2122 while (statement.step() == SQLITE_ROW) 2123 results.add(RegistrableDomain::uncheckedCreateFromRegistrableDomainString(statement.getColumnText(1)), RegistrableDomain::uncheckedCreateFromRegistrableDomainString(statement.getColumnText(0))); 2124 2125 return results; 2126 } 2127 2106 2128 void ResourceLoadStatisticsDatabaseStore::updateCookieBlocking(CompletionHandler<void()>&& completionHandler) 2107 2129 { … … 2111 2133 auto domainsToBlockButKeepCookiesFor = this->domainsToBlockButKeepCookiesFor(); 2112 2134 auto domainsWithUserInteractionAsFirstParty = this->domainsWithUserInteractionAsFirstParty(); 2113 2114 if (domainsToBlockAndDeleteCookiesFor.isEmpty() && domainsToBlockButKeepCookiesFor.isEmpty() && domainsWithUserInteractionAsFirstParty.isEmpty()) { 2135 auto domainsWithStorageAccess = this->domainsWithStorageAccess(); 2136 2137 if (domainsToBlockAndDeleteCookiesFor.isEmpty() && domainsToBlockButKeepCookiesFor.isEmpty() && domainsWithUserInteractionAsFirstParty.isEmpty() && domainsWithStorageAccess.isEmpty()) { 2115 2138 completionHandler(); 2116 2139 return; 2117 2140 } 2118 2141 2119 RegistrableDomainsToBlockCookiesFor domainsToBlock { domainsToBlockAndDeleteCookiesFor, domainsToBlockButKeepCookiesFor, domainsWithUserInteractionAsFirstParty };2142 RegistrableDomainsToBlockCookiesFor domainsToBlock { domainsToBlockAndDeleteCookiesFor, domainsToBlockButKeepCookiesFor, domainsWithUserInteractionAsFirstParty, domainsWithStorageAccess }; 2120 2143 2121 2144 if (debugLoggingEnabled() && (!domainsToBlockAndDeleteCookiesFor.isEmpty() || !domainsToBlockButKeepCookiesFor.isEmpty())) -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r268458 r269807 160 160 Vector<RegistrableDomain> domainsToBlockButKeepCookiesFor() const; 161 161 Vector<RegistrableDomain> domainsWithUserInteractionAsFirstParty() const; 162 HashMap<TopFrameDomain, SubResourceDomain> domainsWithStorageAccess() const; 162 163 163 164 struct DomainData { -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r268458 r269807 786 786 787 787 auto registrableDomainsToBlockAndDeleteCookiesFor = ensurePrevalentResourcesForDebugMode(); 788 RegistrableDomainsToBlockCookiesFor domainsToBlock { registrableDomainsToBlockAndDeleteCookiesFor, { }, { } };788 RegistrableDomainsToBlockCookiesFor domainsToBlock { registrableDomainsToBlockAndDeleteCookiesFor, { }, { }, { }}; 789 789 updateCookieBlockingForDomains(domainsToBlock, [callbackAggregator] { }); 790 790 } … … 839 839 } 840 840 841 RegistrableDomainsToBlockCookiesFor domainsToBlock { domainsToBlockAndDeleteCookiesFor, domainsToBlockButKeepCookiesFor, domainsWithUserInteractionAsFirstParty };841 RegistrableDomainsToBlockCookiesFor domainsToBlock { domainsToBlockAndDeleteCookiesFor, domainsToBlockButKeepCookiesFor, domainsWithUserInteractionAsFirstParty, { } }; 842 842 843 843 if (debugLoggingEnabled() && (!domainsToBlockAndDeleteCookiesFor.isEmpty() || !domainsToBlockButKeepCookiesFor.isEmpty())) -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r268458 r269807 471 471 ASSERT(isEphemeral()); 472 472 473 if (!m_networkSession || !m_domainsWithEphemeralUserInteraction.contains(subFrameDomain))473 if (!m_networkSession || (!m_domainsWithEphemeralUserInteraction.contains(subFrameDomain) && !NetworkStorageSession::canRequestStorageAccessForLoginPurposesWithoutPriorUserInteraction(subFrameDomain, topFrameDomain))) 474 474 return completionHandler({ StorageAccessWasGranted::No, StorageAccessPromptWasShown::No, scope, topFrameDomain, subFrameDomain }); 475 475 … … 1258 1258 m_networkSession->networkProcess().parentProcessConnection()->send(Messages::NetworkProcessProxy::SetDomainsWithUserInteraction(domainsWithUserInteractionQuirk), 0); 1259 1259 } 1260 1261 HashMap<TopFrameDomain, SubResourceDomain> domainsWithStorageAccessQuirk; 1262 for (auto& firstPartyDomain : domainsToBlock.domainsWithStorageAccess.keys()) { 1263 auto requestingDomain = domainsToBlock.domainsWithStorageAccess.get(firstPartyDomain); 1264 if (NetworkStorageSession::loginDomainMatchesRequestingDomain(firstPartyDomain, requestingDomain)) 1265 domainsWithStorageAccessQuirk.add(firstPartyDomain, requestingDomain); 1266 } 1267 1268 if (m_domainsWithCrossPageStorageAccessQuirk != domainsWithStorageAccessQuirk) { 1269 if (m_networkSession) { 1270 if (auto* storageSession = m_networkSession->networkStorageSession()) 1271 storageSession->setDomainsWithCrossPageStorageAccess(domainsWithStorageAccessQuirk); 1272 m_networkSession->networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::SetDomainsWithCrossPageStorageAccess(domainsWithStorageAccessQuirk), [this, domainsWithStorageAccessQuirk] () mutable { 1273 m_domainsWithCrossPageStorageAccessQuirk = domainsWithStorageAccessQuirk; 1274 }); 1275 } 1276 } 1260 1277 } 1261 1278 -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r268458 r269807 69 69 enum class ShouldIncludeLocalhost : bool { No, Yes }; 70 70 enum class EnableResourceLoadStatisticsDebugMode : bool { No, Yes }; 71 72 using TopFrameDomain = WebCore::RegistrableDomain; 73 using SubResourceDomain = WebCore::RegistrableDomain; 74 71 75 struct RegistrableDomainsToBlockCookiesFor { 72 76 Vector<WebCore::RegistrableDomain> domainsToBlockAndDeleteCookiesFor; 73 77 Vector<WebCore::RegistrableDomain> domainsToBlockButKeepCookiesFor; 74 78 Vector<WebCore::RegistrableDomain> domainsWithUserInteractionAsFirstParty; 75 RegistrableDomainsToBlockCookiesFor isolatedCopy() const { return { domainsToBlockAndDeleteCookiesFor.isolatedCopy(), domainsToBlockButKeepCookiesFor.isolatedCopy(), domainsWithUserInteractionAsFirstParty.isolatedCopy() }; } 79 HashMap<TopFrameDomain, SubResourceDomain> domainsWithStorageAccess; 80 RegistrableDomainsToBlockCookiesFor isolatedCopy() const { return { domainsToBlockAndDeleteCookiesFor.isolatedCopy(), domainsToBlockButKeepCookiesFor.isolatedCopy(), domainsWithUserInteractionAsFirstParty.isolatedCopy(), domainsWithStorageAccess }; } 76 81 }; 77 82 struct RegistrableDomainsToDeleteOrRestrictWebsiteDataFor { … … 331 336 332 337 HashSet<RegistrableDomain> m_domainsWithUserInteractionQuirk; 338 HashMap<TopFrameDomain, SubResourceDomain> m_domainsWithCrossPageStorageAccessQuirk; 333 339 334 340 bool m_hasScheduledProcessStats { false }; -
trunk/Source/WebKit/Shared/WebProcessDataStoreParameters.h
r269785 r269807 34 34 35 35 struct WebProcessDataStoreParameters { 36 using TopFrameDomain = WebCore::RegistrableDomain; 37 using SubResourceDomain = WebCore::RegistrableDomain; 38 36 39 PAL::SessionID sessionID; 37 40 String applicationCacheDirectory; … … 49 52 WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::All }; 50 53 HashSet<WebCore::RegistrableDomain> domainsWithUserInteraction; 54 HashMap<TopFrameDomain, SubResourceDomain> domainsWithStorageAccessQuirk; 55 51 56 #endif 52 57 bool resourceLoadStatisticsEnabled { false }; … … 74 79 encoder << thirdPartyCookieBlockingMode; 75 80 encoder << domainsWithUserInteraction; 81 encoder << domainsWithStorageAccessQuirk; 76 82 #endif 77 83 encoder << resourceLoadStatisticsEnabled; … … 145 151 if (!domainsWithUserInteraction) 146 152 return WTF::nullopt; 153 154 Optional<HashMap<TopFrameDomain, SubResourceDomain>> domainsWithStorageAccessQuirk; 155 decoder >> domainsWithStorageAccessQuirk; 156 if (!domainsWithStorageAccessQuirk) 157 return WTF::nullopt; 147 158 #endif 148 159 … … 167 178 *thirdPartyCookieBlockingMode, 168 179 WTFMove(*domainsWithUserInteraction), 180 WTFMove(*domainsWithStorageAccessQuirk), 169 181 #endif 170 182 resourceLoadStatisticsEnabled -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r269712 r269807 1266 1266 sendWithAsyncReply(Messages::NetworkProcess::SetThirdPartyCNAMEDomainForTesting(sessionID, domain), WTFMove(completionHandler)); 1267 1267 } 1268 1268 1269 void NetworkProcessProxy::setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&& domains) 1269 1270 { … … 1271 1272 processPool->setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain> { domains }); 1272 1273 } 1274 1275 void NetworkProcessProxy::setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&& domains, CompletionHandler<void()>&& completionHandler) 1276 { 1277 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1278 1279 for (auto* processPool : WebProcessPool::allProcessPools()) 1280 processPool->setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain> { domains }, [callbackAggregator] { }); 1281 } 1282 1273 1283 #endif // ENABLE(RESOURCE_LOAD_STATISTICS) 1274 1284 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r269712 r269807 201 201 void setThirdPartyCNAMEDomainForTesting(PAL::SessionID, const WebCore::RegistrableDomain&, CompletionHandler<void()>&&); 202 202 void setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&&); 203 void setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&&, CompletionHandler<void()>&&); 203 204 #endif 204 205 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r268458 r269807 49 49 DidCommitCrossSiteLoadWithDataTransferFromPrevalentResource(WebKit::WebPageProxyIdentifier pageID) 50 50 SetDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain> domains) 51 SetDomainsWithCrossPageStorageAccess(HashMap<WebCore::RegistrableDomain, WebCore::RegistrableDomain> domains) -> () Async 51 52 #endif 52 53 #if ENABLE(CONTENT_EXTENSIONS) -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r269785 r269807 757 757 websiteDataStore.thirdPartyCookieBlockingMode(), 758 758 m_domainsWithUserInteraction, 759 m_domainsWithCrossPageStorageAccessQuirk, 759 760 #endif 760 761 websiteDataStore.resourceLoadStatisticsEnabled() … … 1956 1957 } 1957 1958 1959 void WebProcessPool::setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&& domains, CompletionHandler<void()>&& completionHandler) 1960 { 1961 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1962 1963 for (auto& process : processes()) 1964 process->sendWithAsyncReply(Messages::WebProcess::SetDomainsWithCrossPageStorageAccess(domains), [callbackAggregator] { }); 1965 1966 for (auto& topDomain : domains.keys()) 1967 m_domainsWithCrossPageStorageAccessQuirk.add(topDomain, domains.get(topDomain)); 1968 } 1969 1958 1970 void WebProcessPool::seedResourceLoadStatisticsForTesting(const RegistrableDomain& firstPartyDomain, const RegistrableDomain& thirdPartyDomain, bool shouldScheduleNotification, CompletionHandler<void()>&& completionHandler) 1959 1971 { -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r269785 r269807 455 455 #if ENABLE(RESOURCE_LOAD_STATISTICS) 456 456 void setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&&); 457 void setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&&, CompletionHandler<void()>&&); 457 458 void seedResourceLoadStatisticsForTesting(const WebCore::RegistrableDomain& firstPartyDomain, const WebCore::RegistrableDomain& thirdPartyDomain, bool shouldScheduleNotification, CompletionHandler<void()>&&); 458 459 void sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&&); … … 764 765 #if ENABLE(RESOURCE_LOAD_STATISTICS) 765 766 HashSet<WebCore::RegistrableDomain> m_domainsWithUserInteraction; 767 HashMap<TopFrameDomain, SubResourceDomain> m_domainsWithCrossPageStorageAccessQuirk; 766 768 #endif 767 769 }; -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp
r266214 r269807 419 419 } 420 420 421 bool WebResourceLoadObserver::hasCrossPageStorageAccess(const SubFrameDomain& subDomain, const TopFrameDomain& topDomain) const 422 { 423 auto it = m_domainsWithCrossPageStorageAccess.find(topDomain); 424 425 if (it != m_domainsWithCrossPageStorageAccess.end()) 426 return it->value == subDomain; 427 428 return false; 429 } 430 431 void WebResourceLoadObserver::setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubFrameDomain>&& domains, CompletionHandler<void()>&& completionHandler) 432 { 433 for (auto& topDomain : domains.keys()) 434 m_domainsWithCrossPageStorageAccess.add(topDomain, domains.get(topDomain)); 435 436 completionHandler(); 437 } 438 421 439 } // namespace WebKit 422 440 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.h
r266214 r269807 40 40 class WebResourceLoadObserver final : public WebCore::ResourceLoadObserver { 41 41 public: 42 using TopFrameDomain = WebCore::RegistrableDomain; 43 using SubFrameDomain = WebCore::RegistrableDomain; 44 42 45 WebResourceLoadObserver(WebCore::ResourceLoadStatistics::IsEphemeral); 43 46 ~WebResourceLoadObserver(); … … 64 67 65 68 void setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&& domains) final { m_domainsWithUserInteraction = WTFMove(domains); } 69 void setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubFrameDomain>&&, CompletionHandler<void()>&&) final; 66 70 bool hasHadUserInteraction(const WebCore::RegistrableDomain&) const final; 71 bool hasCrossPageStorageAccess(const SubFrameDomain&, const TopFrameDomain&) const final; 72 67 73 private: 68 74 WebCore::ResourceLoadStatistics& ensureResourceStatisticsForRegistrableDomain(const WebCore::RegistrableDomain&); … … 82 88 83 89 HashSet<WebCore::RegistrableDomain> m_domainsWithUserInteraction; 90 HashMap<TopFrameDomain, SubFrameDomain> m_domainsWithCrossPageStorageAccess; 84 91 #if !RELEASE_LOG_DISABLED 85 92 uint64_t m_loggingCounter { 0 }; -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r269785 r269807 522 522 ResourceLoadObserver::setShared(*new WebResourceLoadObserver(parameters.sessionID.isEphemeral() ? WebCore::ResourceLoadStatistics::IsEphemeral::Yes : WebCore::ResourceLoadStatistics::IsEphemeral::No)); 523 523 ResourceLoadObserver::shared().setDomainsWithUserInteraction(WTFMove(parameters.domainsWithUserInteraction)); 524 if (!parameters.sessionID.isEphemeral()) 525 ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess(WTFMove(parameters.domainsWithStorageAccessQuirk), [] { }); 524 526 } 525 527 … … 1866 1868 } 1867 1869 1870 void WebProcess::setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&& domains, CompletionHandler<void()>&& completionHandler) 1871 { 1872 for (auto& domain : domains.keys()) { 1873 for (auto& webPage : m_pageMap.values()) 1874 webPage->addDomainWithPageLevelStorageAccess(domain, domains.get(domain)); 1875 } 1876 ResourceLoadObserver::shared().setDomainsWithCrossPageStorageAccess(WTFMove(domains), WTFMove(completionHandler)); 1877 } 1878 1868 1879 void WebProcess::sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&& completionHandler) 1869 1880 { -
trunk/Source/WebKit/WebProcess/WebProcess.h
r269785 r269807 147 147 WTF_MAKE_FAST_ALLOCATED; 148 148 public: 149 using TopFrameDomain = WebCore::RegistrableDomain; 150 using SubResourceDomain = WebCore::RegistrableDomain; 151 149 152 static WebProcess& singleton(); 150 153 static constexpr ProcessType processType = ProcessType::WebContent; … … 488 491 void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&); 489 492 void setDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain>&&); 493 void setDomainsWithCrossPageStorageAccess(HashMap<TopFrameDomain, SubResourceDomain>&&, CompletionHandler<void()>&&); 490 494 void sendResourceLoadStatisticsDataImmediately(CompletionHandler<void()>&&); 491 495 #endif -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r269785 r269807 159 159 SetThirdPartyCookieBlockingMode(enum:uint8_t WebCore::ThirdPartyCookieBlockingMode blockingMode) -> () Async 160 160 SetDomainsWithUserInteraction(HashSet<WebCore::RegistrableDomain> domains) 161 SetDomainsWithCrossPageStorageAccess(HashMap<WebCore::RegistrableDomain, WebCore::RegistrableDomain> domains) -> () Async 161 162 SendResourceLoadStatisticsDataImmediately() -> () Async 162 163 #endif
Note:
See TracChangeset
for help on using the changeset viewer.