Remove experimental affiliated domain code now that StorageAccess API is available
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2018 20:37:27 +0000 (20:37 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2018 20:37:27 +0000 (20:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188756
<rdar://problem/43527848>

Reviewed by Alex Christensen.

In Bug 174661 we added a compatibility quirk to support wsj.com authentication. This quirk is no longer needed,
since the StorageAccess API provides the necessary tools to do this type of interaction without needing global
cross-site access.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::areDomainsAssociated): Deleted.
(WebCore::shouldEnableSiteSpecificQuirks): Deleted.
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::areDomainsAssociated): Deleted.
* loader/ResourceLoadStatistics.h:

Source/WebKit:

* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
* UIProcess/ResourceLoadStatisticsMemoryStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
(WebKit::areDomainsAssociated): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235132 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadStatistics.cpp
Source/WebCore/loader/ResourceLoadStatistics.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

index 76cbd0e..2ff9090 100644 (file)
@@ -1,3 +1,24 @@
+2018-08-21  Brent Fulgham  <bfulgham@apple.com>
+
+        Remove experimental affiliated domain code now that StorageAccess API is available
+        https://bugs.webkit.org/show_bug.cgi?id=188756
+        <rdar://problem/43527848>
+
+        Reviewed by Alex Christensen.
+
+        In Bug 174661 we added a compatibility quirk to support wsj.com authentication. This quirk is no longer needed,
+        since the StorageAccess API provides the necessary tools to do this type of interaction without needing global
+        cross-site access.
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::logSubresourceLoading):
+        (WebCore::ResourceLoadObserver::logWebSocketLoading):
+        (WebCore::areDomainsAssociated): Deleted.
+        (WebCore::shouldEnableSiteSpecificQuirks): Deleted.
+        * loader/ResourceLoadStatistics.cpp:
+        (WebCore::ResourceLoadStatistics::areDomainsAssociated): Deleted.
+        * loader/ResourceLoadStatistics.h:
+
 2018-08-21  Antti Koivisto  <antti@apple.com>
 
         Allow creating WeakPtrs to const objects
index 3a447c7..8d03ba0 100644 (file)
@@ -56,24 +56,6 @@ ResourceLoadObserver& ResourceLoadObserver::shared()
     return resourceLoadObserver;
 }
 
-static bool shouldEnableSiteSpecificQuirks(Page* page)
-{
-#if PLATFORM(IOS)
-    UNUSED_PARAM(page);
-
-    // There is currently no way to toggle the needsSiteSpecificQuirks setting on iOS so we always enable
-    // the site-specific quirks on iOS.
-    return true;
-#else
-    return page && page->settings().needsSiteSpecificQuirks();
-#endif
-}
-
-static bool areDomainsAssociated(Page* page, const String& firstDomain, const String& secondDomain)
-{
-    return ResourceLoadStatistics::areDomainsAssociated(shouldEnableSiteSpecificQuirks(page), firstDomain, secondDomain);
-}
-
 void ResourceLoadObserver::setNotificationCallback(WTF::Function<void (Vector<ResourceLoadStatistics>&&)>&& notificationCallback)
 {
     ASSERT(!m_notificationCallback);
@@ -123,8 +105,8 @@ void ResourceLoadObserver::logSubresourceLoading(const Frame* frame, const Resou
     auto targetPrimaryDomain = primaryDomain(targetURL);
     auto mainFramePrimaryDomain = primaryDomain(mainFrameURL);
     auto sourcePrimaryDomain = primaryDomain(sourceURL);
-    
-    if (areDomainsAssociated(page, targetPrimaryDomain, mainFramePrimaryDomain) || (isRedirect && areDomainsAssociated(page, targetPrimaryDomain, sourcePrimaryDomain)))
+
+    if (targetPrimaryDomain == mainFramePrimaryDomain || (isRedirect && targetPrimaryDomain == sourcePrimaryDomain))
         return;
 
     bool shouldCallNotificationCallback = false;
@@ -163,6 +145,9 @@ void ResourceLoadObserver::logWebSocketLoading(const URL& targetURL, const URL&
     auto targetPrimaryDomain = primaryDomain(targetURL);
     auto mainFramePrimaryDomain = primaryDomain(mainFrameURL);
 
+    if (targetPrimaryDomain == mainFramePrimaryDomain)
+        return;
+
     auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
     targetStatistics.lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
     if (targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry)
index d75639c..9e2b7cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -353,40 +353,6 @@ String ResourceLoadStatistics::primaryDomain(StringView host)
     return hostString;
 }
 
-// FIXME: Temporary fix for <rdar://problem/32343256> until content can be updated.
-bool ResourceLoadStatistics::areDomainsAssociated(bool needsSiteSpecificQuirks, const String& firstDomain, const String& secondDomain)
-{
-    ASSERT(isMainThread());
-
-    static NeverDestroyed<HashMap<String, unsigned>> metaDomainIdentifiers = [] {
-        HashMap<String, unsigned> map;
-
-        // Domains owned by Dow Jones & Company, Inc.
-        const unsigned dowJonesIdentifier = 1;
-        map.add("dowjones.com"_s, dowJonesIdentifier);
-        map.add("wsj.com"_s, dowJonesIdentifier);
-        map.add("barrons.com"_s, dowJonesIdentifier);
-        map.add("marketwatch.com"_s, dowJonesIdentifier);
-        map.add("wsjplus.com"_s, dowJonesIdentifier);
-
-        return map;
-    }();
-
-    if (firstDomain == secondDomain)
-        return true;
-
-    ASSERT(!equalIgnoringASCIICase(firstDomain, secondDomain));
-
-    if (!needsSiteSpecificQuirks)
-        return false;
-
-    unsigned firstMetaDomainIdentifier = metaDomainIdentifiers.get().get(firstDomain);
-    if (!firstMetaDomainIdentifier)
-        return false;
-
-    return firstMetaDomainIdentifier == metaDomainIdentifiers.get().get(secondDomain);
-}
-
 WallTime ResourceLoadStatistics::reduceTimeResolution(WallTime time)
 {
     return WallTime::fromRawSeconds(std::floor(time.secondsSinceEpoch() / timestampResolution) * timestampResolution.seconds());
index eb9c7b6..8c9ed4c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,7 +53,6 @@ struct ResourceLoadStatistics {
     WEBCORE_EXPORT static String primaryDomain(const URL&);
     WEBCORE_EXPORT static String primaryDomain(StringView host);
 
-    WEBCORE_EXPORT static bool areDomainsAssociated(bool needsSiteSpecificQuirks, const String&, const String&);
     WEBCORE_EXPORT static WallTime reduceTimeResolution(WallTime);
 
     WEBCORE_EXPORT void encode(KeyedEncoder&) const;
index 0654d89..57b3451 100644 (file)
@@ -1,3 +1,22 @@
+2018-08-21  Brent Fulgham  <bfulgham@apple.com>
+
+        Remove experimental affiliated domain code now that StorageAccess API is available
+        https://bugs.webkit.org/show_bug.cgi?id=188756
+        <rdar://problem/43527848>
+
+        Reviewed by Alex Christensen.
+
+        In Bug 174661 we added a compatibility quirk to support wsj.com authentication. This quirk is no longer needed,
+        since the StorageAccess API provides the necessary tools to do this type of interaction without needing global
+        cross-site access.
+
+        * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+        (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
+        * UIProcess/ResourceLoadStatisticsMemoryStore.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
+        (WebKit::areDomainsAssociated): Deleted.
+
 2018-08-21  Alex Christensen  <achristensen@webkit.org>
 
         Add _WKWebsiteDataStoreConfiguration. sourceApplicationBundleIdentifier and sourceApplicationSecondaryIdentifier
index c2534fd..64f9db7 100644 (file)
@@ -602,10 +602,13 @@ void ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest
     m_pendingStatisticsProcessingRequestIdentifier = std::nullopt;
 }
 
-void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool areTargetAndMainFrameDomainsAssociated, bool areTargetAndSourceDomainsAssociated, bool isRedirect, bool isMainFrame)
+void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame)
 {
     ASSERT(!RunLoop::isMain());
 
+    bool areTargetAndMainFrameDomainsAssociated = targetPrimaryDomain == mainFramePrimaryDomain;
+    bool areTargetAndSourceDomainsAssociated = targetPrimaryDomain == sourcePrimaryDomain;
+
     bool statisticsWereUpdated = false;
     if (targetHost != mainFrameHost && !(areTargetAndMainFrameDomainsAssociated || areTargetAndSourceDomainsAssociated)) {
         auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
index 40b394b..b79f0fe 100644 (file)
@@ -120,7 +120,7 @@ public:
     void requestStorageAccess(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
     void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);
 
-    void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool areTargetAndMainFrameDomainsAssociated, bool areTargetAndSourceDomainsAssociated, bool isRedirect, bool isMainFrame);
+    void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame);
     void logUserInteraction(const String& primaryDomain);
 
     void clearUserInteraction(const String& primaryDomain);
index 8d03721..6cd9dc4 100644 (file)
@@ -50,12 +50,6 @@ template<typename T> static inline String isolatedPrimaryDomain(const T& value)
     return ResourceLoadStatistics::primaryDomain(value).isolatedCopy();
 }
 
-static bool areDomainsAssociated(WebPageProxy* page, const String& firstDomain, const String& secondDomain)
-{
-    bool needsSiteSpecificQuirks = page && page->preferences().needsSiteSpecificQuirks();
-    return ResourceLoadStatistics::areDomainsAssociated(needsSiteSpecificQuirks, firstDomain, secondDomain);
-}
-
 const OptionSet<WebsiteDataType>& WebResourceLoadStatisticsStore::monitoredDataTypes()
 {
     static NeverDestroyed<OptionSet<WebsiteDataType>> dataTypes(std::initializer_list<WebsiteDataType>({
@@ -392,17 +386,14 @@ void WebResourceLoadStatisticsStore::logFrameNavigation(const WebFrameProxy& fra
     if (targetHost.isEmpty() || mainFrameHost.isEmpty() || targetHost == sourceURL.host())
         return;
 
-    auto* page = frame.page();
     auto targetPrimaryDomain = ResourceLoadStatistics::primaryDomain(targetURL);
     auto mainFramePrimaryDomain = ResourceLoadStatistics::primaryDomain(pageURL);
     auto sourcePrimaryDomain = ResourceLoadStatistics::primaryDomain(sourceURL);
 
-    bool areTargetAndMainFrameDomainsAssociated = areDomainsAssociated(page, targetPrimaryDomain, mainFramePrimaryDomain);
-    bool areTargetAndSourceDomainsAssociated = areDomainsAssociated(page, targetPrimaryDomain, sourcePrimaryDomain);
-
-    postTask([this, targetPrimaryDomain = targetPrimaryDomain.isolatedCopy(), mainFramePrimaryDomain = mainFramePrimaryDomain.isolatedCopy(), sourcePrimaryDomain = sourcePrimaryDomain.isolatedCopy(), targetHost = targetHost.toString().isolatedCopy(), mainFrameHost = mainFrameHost.toString().isolatedCopy(), areTargetAndMainFrameDomainsAssociated, areTargetAndSourceDomainsAssociated, isRedirect, isMainFrame = frame.isMainFrame()] {
+    postTask([this, targetPrimaryDomain = targetPrimaryDomain.isolatedCopy(), mainFramePrimaryDomain = mainFramePrimaryDomain.isolatedCopy(), sourcePrimaryDomain = sourcePrimaryDomain.isolatedCopy(), targetHost = targetHost.toString().isolatedCopy(), mainFrameHost = mainFrameHost.toString().isolatedCopy(), isRedirect, isMainFrame = frame.isMainFrame()] {
+        
         if (m_memoryStore)
-            m_memoryStore->logFrameNavigation(targetPrimaryDomain, mainFramePrimaryDomain, sourcePrimaryDomain, targetHost, mainFrameHost, areTargetAndMainFrameDomainsAssociated, areTargetAndSourceDomainsAssociated, isRedirect, isMainFrame);
+            m_memoryStore->logFrameNavigation(targetPrimaryDomain, mainFramePrimaryDomain, sourcePrimaryDomain, targetHost, mainFrameHost, isRedirect, isMainFrame);
     });
 }