Resource Load Statistics: Add timing information to WebPageProxy::logFrameNavigation...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jan 2020 22:01:46 +0000 (22:01 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jan 2020 22:01:46 +0000 (22:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205522
<rdar://problem/58125759>

Reviewed by Chris Dumez.

Source/WebKit:

The purpose of this patch is to capture navigations that happen programmatically
after the document has loaded. These are delayed redirects and should be counted
as redirects in ITP.

To achieve this, a timestamp is captured in
WebPageProxy::didFinishDocumentLoadForFrame() to be able to calculate how much time
has passed since that timestamp in the IPC sent from
WebPageProxy::logFrameNavigation(). The IPC also gets information on whether
userInitiatedActivity exists so that ITP can decide whether to treat the navigation
as triggered by the user or not.

A new test was added and existing test expectations were updated.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
    Now takes the extra parameters delayAfterMainFrameDocumentLoad
    and wasPotentiallyInitiatedByUser.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
    Now takes the extra parameters delayAfterMainFrameDocumentLoad
    and wasPotentiallyInitiatedByUser.
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
    Now takes the extra parameters delayAfterMainFrameDocumentLoad
    and wasPotentiallyInitiatedByUser.
    The deleted WebResourceLoadStatisticsStore::logFrameNavigation() was dead code.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::logFrameNavigation):
    Now takes the extra parameters delayAfterMainFrameDocumentLoad
    and wasPotentiallyInitiatedByUser.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:]): Deleted.
    Dead code.
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
    Now captures a timestamp.
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
    Removed dead code.
(WebKit::WebPageProxy::logFrameNavigation):
    Now sends the diff between now and the timestamp captured in
    WebPageProxy::didFinishDocumentLoadForFrame().
* UIProcess/WebPageProxy.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformInitialize):
    Removed dead code.
(WebKit::WebsiteDataStore::platformDestroy):
    Removed dead code.
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resourceLoadStatistics const): Deleted.
    Dead code.

Tools:

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::initializeWebViewConfiguration):
    Removed dead code.

LayoutTests:

Results updated with additional data now that delayed redirects are captured.

* http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-database-expected.txt:
* http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt:
* http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database-expected.txt: Added.
* http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database.html: Added.
* http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt: Added.
* http/tests/resourceLoadStatistics/log-delayed-client-side-redirects.html: Added.
* http/tests/storageAccess/aggregate-sorted-data-with-storage-access-database-expected.txt:
* http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt:

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

28 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-database-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database.html [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/aggregate-sorted-data-with-storage-access-database-expected.txt
LayoutTests/http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Tools/ChangeLog
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

index ba86316..6d10da1 100644 (file)
@@ -1,3 +1,22 @@
+2020-01-09  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Add timing information to WebPageProxy::logFrameNavigation() to detect delayed client-side redirects
+        https://bugs.webkit.org/show_bug.cgi?id=205522
+        <rdar://problem/58125759>
+
+        Reviewed by Chris Dumez.
+
+        Results updated with additional data now that delayed redirects are captured.
+
+        * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-database-expected.txt:
+        * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt:
+        * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database-expected.txt: Added.
+        * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database.html: Added.
+        * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt: Added.
+        * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects.html: Added.
+        * http/tests/storageAccess/aggregate-sorted-data-with-storage-access-database-expected.txt:
+        * http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt:
+
 2020-01-09  Pablo Saavedra  <psaavedra@igalia.com>
 
         Bad baseline for Catalina on xhr web-platform-tests imported in r254154
index 947250d..67f865b 100644 (file)
@@ -6,6 +6,8 @@ Registrable domain: 127.0.0.1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    TopFrameUniqueRedirectsTo:
+        localhost
     IsScheduledForAllButCookieDataRemoval: No
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
@@ -22,6 +24,8 @@ Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    TopFrameUniqueRedirectsFrom:
+        127.0.0.1
     TopFrameLinkDecorationsFrom:
         127.0.0.1
         127.0.0.2
index 5ccd124..99d33ad 100644 (file)
@@ -6,6 +6,8 @@ Registrable domain: localhost
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    topFrameUniqueRedirectsFrom:
+        127.0.0.1
     topFrameLinkDecorationsFrom:
         127.0.0.1
     gotLinkDecorationFromPrevalentResource: Yes
@@ -16,6 +18,8 @@ Registrable domain: 127.0.0.1
     hadUserInteraction: No
     mostRecentUserInteraction: -1
     grandfathered: No
+    topFrameUniqueRedirectsTo:
+        localhost
     gotLinkDecorationFromPrevalentResource: No
     isPrevalentResource: Yes
     isVeryPrevalentResource: No
diff --git a/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database-expected.txt
new file mode 100644 (file)
index 0000000..40f81c7
--- /dev/null
@@ -0,0 +1,24 @@
+Non-user initiated, delayed cross-site navigations done client-side should be detected as top frame redirects by ITP.
+
+Resource load statistics:
+
+Registrable domain: 127.0.0.1
+    hadUserInteraction: No
+    mostRecentUserInteraction: -1
+    grandfathered: No
+    TopFrameUniqueRedirectsTo:
+        localhost
+    IsScheduledForAllButCookieDataRemoval: No
+    isPrevalentResource: No
+    isVeryPrevalentResource: No
+    dataRecordsRemoved: 0
+Registrable domain: localhost
+    hadUserInteraction: No
+    mostRecentUserInteraction: -1
+    grandfathered: No
+    TopFrameUniqueRedirectsFrom:
+        127.0.0.1
+    IsScheduledForAllButCookieDataRemoval: No
+    isPrevalentResource: No
+    isVeryPrevalentResource: No
+    dataRecordsRemoved: 0
diff --git a/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database.html b/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-database.html
new file mode 100644 (file)
index 0000000..a89a105
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 100)">
+<div id="description">Non-user initiated, delayed cross-site navigations done client-side should be detected as top frame redirects by ITP.</div>
+<div id="output"></div>
+<script>
+    if (window.testRunner) {
+        testRunner.setUseITPDatabase(true);
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    }
+
+    const navigationEndOrigin = "http://localhost:8000";
+    const navigationStartOrigin = "http://127.0.0.1:8000";
+
+    function navigateCrossSite() {
+        document.location.href = navigationEndOrigin + "/resourceLoadStatistics/log-delayed-client-side-redirects.html?dummyParam=" + Math.random();
+    }
+
+    function runTest() {
+        if (document.location.origin === navigationStartOrigin) {
+            setEnableFeature(true, navigateCrossSite);
+        } else {
+            testRunner.dumpResourceLoadStatistics();
+            setEnableFeature(false, function () {
+                testRunner.notifyDone();
+            });
+        }
+    }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt
new file mode 100644 (file)
index 0000000..700061b
--- /dev/null
@@ -0,0 +1,24 @@
+Non-user initiated, delayed cross-site navigations done client-side should be detected as top frame redirects by ITP.
+
+Resource load statistics:
+
+Registrable domain: localhost
+    hadUserInteraction: No
+    mostRecentUserInteraction: -1
+    grandfathered: No
+    topFrameUniqueRedirectsFrom:
+        127.0.0.1
+    gotLinkDecorationFromPrevalentResource: No
+    isPrevalentResource: No
+    isVeryPrevalentResource: No
+    dataRecordsRemoved: 0
+Registrable domain: 127.0.0.1
+    hadUserInteraction: No
+    mostRecentUserInteraction: -1
+    grandfathered: No
+    topFrameUniqueRedirectsTo:
+        localhost
+    gotLinkDecorationFromPrevalentResource: No
+    isPrevalentResource: No
+    isVeryPrevalentResource: No
+    dataRecordsRemoved: 0
diff --git a/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects.html b/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects.html
new file mode 100644 (file)
index 0000000..29d03e0
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 100)">
+<div id="description">Non-user initiated, delayed cross-site navigations done client-side should be detected as top frame redirects by ITP.</div>
+<div id="output"></div>
+<script>
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    }
+
+    const navigationEndOrigin = "http://localhost:8000";
+    const navigationStartOrigin = "http://127.0.0.1:8000";
+
+    function navigateCrossSite() {
+        document.location.href = navigationEndOrigin + "/resourceLoadStatistics/log-delayed-client-side-redirects.html?dummyParam=" + Math.random();
+    }
+
+    function runTest() {
+        if (document.location.origin === navigationStartOrigin) {
+            setEnableFeature(true, navigateCrossSite);
+        } else {
+            testRunner.dumpResourceLoadStatistics();
+            setEnableFeature(false, function () {
+                testRunner.notifyDone();
+            });
+        }
+    }
+</script>
+</body>
+</html>
index 2f96b28..8ebd26b 100644 (file)
@@ -14,8 +14,12 @@ Registrable domain: 127.0.0.1
     hadUserInteraction: Yes
     mostRecentUserInteraction: within 24 hours
     grandfathered: No
+    TopFrameUniqueRedirectsTo:
+        localhost
+    TopFrameUniqueRedirectsFrom:
+        localhost
     IsScheduledForAllButCookieDataRemoval: No
-    isPrevalentResource: No
+    isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
 Registrable domain: localhost
@@ -24,6 +28,10 @@ Registrable domain: localhost
     grandfathered: No
     StorageAccessUnderTopFrameDomains:
         127.0.0.1
+    TopFrameUniqueRedirectsTo:
+        127.0.0.1
+    TopFrameUniqueRedirectsFrom:
+        127.0.0.1
     IsScheduledForAllButCookieDataRemoval: No
     SubframeUnderTopFrameDomains:
         127.0.0.1
index 26a7c39..e737ec5 100644 (file)
@@ -16,6 +16,10 @@ Registrable domain: localhost
     grandfathered: No
     storageAccessUnderTopFrameDomains:
         127.0.0.1
+    topFrameUniqueRedirectsTo:
+        127.0.0.1
+    topFrameUniqueRedirectsFrom:
+        127.0.0.1
     gotLinkDecorationFromPrevalentResource: No
     subframeUnderTopFrameDomains:
         127.0.0.1
@@ -26,8 +30,12 @@ Registrable domain: 127.0.0.1
     hadUserInteraction: Yes
     mostRecentUserInteraction: within 24 hours
     grandfathered: No
+    topFrameUniqueRedirectsTo:
+        localhost
+    topFrameUniqueRedirectsFrom:
+        localhost
     gotLinkDecorationFromPrevalentResource: No
-    isPrevalentResource: No
+    isPrevalentResource: Yes
     isVeryPrevalentResource: No
     dataRecordsRemoved: 0
 
index c0b0586..b4d6c5c 100644 (file)
@@ -1,3 +1,69 @@
+2020-01-09  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Add timing information to WebPageProxy::logFrameNavigation() to detect delayed client-side redirects
+        https://bugs.webkit.org/show_bug.cgi?id=205522
+        <rdar://problem/58125759>
+
+        Reviewed by Chris Dumez.
+
+        The purpose of this patch is to capture navigations that happen programmatically
+        after the document has loaded. These are delayed redirects and should be counted
+        as redirects in ITP.
+
+        To achieve this, a timestamp is captured in
+        WebPageProxy::didFinishDocumentLoadForFrame() to be able to calculate how much time
+        has passed since that timestamp in the IPC sent from
+        WebPageProxy::logFrameNavigation(). The IPC also gets information on whether
+        userInitiatedActivity exists so that ITP can decide whether to treat the navigation
+        as triggered by the user or not.
+
+        A new test was added and existing test expectations were updated.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
+            Now takes the extra parameters delayAfterMainFrameDocumentLoad
+            and wasPotentiallyInitiatedByUser.
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
+        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+        (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
+            Now takes the extra parameters delayAfterMainFrameDocumentLoad
+            and wasPotentiallyInitiatedByUser.
+        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
+            Now takes the extra parameters delayAfterMainFrameDocumentLoad
+            and wasPotentiallyInitiatedByUser.
+            The deleted WebResourceLoadStatisticsStore::logFrameNavigation() was dead code.
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::logFrameNavigation):
+            Now takes the extra parameters delayAfterMainFrameDocumentLoad
+            and wasPotentiallyInitiatedByUser.
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:]): Deleted.
+            Dead code.
+        * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
+            Now captures a timestamp.
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+            Removed dead code.
+        (WebKit::WebPageProxy::logFrameNavigation):
+            Now sends the diff between now and the timestamp captured in
+            WebPageProxy::didFinishDocumentLoadForFrame().
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::platformInitialize):
+            Removed dead code.
+        (WebKit::WebsiteDataStore::platformDestroy):
+            Removed dead code.
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::resourceLoadStatistics const): Deleted.
+            Dead code.
+
 2020-01-09  Andres Gonzalez  <andresg_22@apple.com>
 
         WKAccessibilityWebPageObject should use Accessibility::retrieveValueFromMainThread.
index 6541a4c..b5ab27f 100644 (file)
@@ -1508,7 +1508,7 @@ Vector<RegistrableDomain> ResourceLoadStatisticsDatabaseStore::ensurePrevalentRe
     return primaryDomainsToBlock;
 }
 
-void ResourceLoadStatisticsDatabaseStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
+void ResourceLoadStatisticsDatabaseStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser)
 {
     ASSERT(!RunLoop::isMain());
 
@@ -1523,19 +1523,23 @@ void ResourceLoadStatisticsDatabaseStore::logFrameNavigation(const RegistrableDo
         statisticsWereUpdated = true;
     }
 
-    if (isRedirect && !areTargetAndSourceDomainsSameSite) {
+    if (!areTargetAndSourceDomainsSameSite) {
         if (isMainFrame) {
-            auto redirectingDomainResult = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
-            auto targetResult = ensureResourceStatisticsForRegistrableDomain(targetDomain);
-            insertDomainRelationshipList(topFrameUniqueRedirectsToQuery, HashSet<RegistrableDomain>({ targetDomain }), redirectingDomainResult.second);
-            insertDomainRelationshipList(topFrameUniqueRedirectsFromQuery, HashSet<RegistrableDomain>({ sourceDomain }), targetResult.second);
-        } else {
+            bool wasNavigatedAfterShortDelayWithoutUserInteraction = !wasPotentiallyInitiatedByUser && delayAfterMainFrameDocumentLoad < parameters().minDelayAfterMainFrameDocumentLoadToNotBeARedirect;
+            if (isRedirect || wasNavigatedAfterShortDelayWithoutUserInteraction) {
+                auto redirectingDomainResult = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
+                auto targetResult = ensureResourceStatisticsForRegistrableDomain(targetDomain);
+                insertDomainRelationshipList(topFrameUniqueRedirectsToQuery, HashSet<RegistrableDomain>({ targetDomain }), redirectingDomainResult.second);
+                insertDomainRelationshipList(topFrameUniqueRedirectsFromQuery, HashSet<RegistrableDomain>({ sourceDomain }), targetResult.second);
+                statisticsWereUpdated = true;
+            }
+        } else if (isRedirect) {
             auto redirectingDomainResult = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
             auto targetResult = ensureResourceStatisticsForRegistrableDomain(targetDomain);
             insertDomainRelationshipList(subresourceUniqueRedirectsToQuery, HashSet<RegistrableDomain>({ targetDomain }), redirectingDomainResult.second);
             insertDomainRelationshipList(subresourceUniqueRedirectsFromQuery, HashSet<RegistrableDomain>({ sourceDomain }), targetResult.second);
+            statisticsWereUpdated = true;
         }
-        statisticsWereUpdated = true;
     }
 
     if (statisticsWereUpdated)
index 9b310ec..90831d8 100644 (file)
@@ -124,7 +124,7 @@ public:
     void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(StorageAccessStatus)>&&) override;
     void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) override;
 
-    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override;
+    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser) override;
     void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&) override;
     void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) override;
 
index 89385a9..20ae7c4 100644 (file)
@@ -428,7 +428,7 @@ Vector<RegistrableDomain> ResourceLoadStatisticsMemoryStore::ensurePrevalentReso
     return domainsToBlock;
 }
 
-void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
+void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser)
 {
     ASSERT(!RunLoop::isMain());
 
@@ -443,15 +443,18 @@ void ResourceLoadStatisticsMemoryStore::logFrameNavigation(const RegistrableDoma
             statisticsWereUpdated = true;
     }
 
-    if (isRedirect && !areTargetAndSourceDomainsSameSite) {
+    if (!areTargetAndSourceDomainsSameSite) {
         if (isMainFrame) {
             auto& redirectingDomainStatistics = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
-            if (redirectingDomainStatistics.topFrameUniqueRedirectsTo.add(targetDomain).isNewEntry)
-                statisticsWereUpdated = true;
-            auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
-            if (targetStatistics.topFrameUniqueRedirectsFrom.add(sourceDomain).isNewEntry)
-                statisticsWereUpdated = true;
-        } else {
+            bool wasNavigatedAfterShortDelayWithoutUserInteraction = !wasPotentiallyInitiatedByUser && delayAfterMainFrameDocumentLoad < parameters().minDelayAfterMainFrameDocumentLoadToNotBeARedirect;
+            if (isRedirect || wasNavigatedAfterShortDelayWithoutUserInteraction) {
+                if (redirectingDomainStatistics.topFrameUniqueRedirectsTo.add(targetDomain).isNewEntry)
+                    statisticsWereUpdated = true;
+                auto& targetStatistics = ensureResourceStatisticsForRegistrableDomain(targetDomain);
+                if (targetStatistics.topFrameUniqueRedirectsFrom.add(sourceDomain).isNewEntry)
+                    statisticsWereUpdated = true;
+            }
+        } else if (isRedirect) {
             auto& redirectingDomainStatistics = ensureResourceStatisticsForRegistrableDomain(sourceDomain);
             if (redirectingDomainStatistics.subresourceUniqueRedirectsTo.add(targetDomain).isNewEntry)
                 statisticsWereUpdated = true;
index 0b0e6d8..baf8b16 100644 (file)
@@ -104,7 +104,7 @@ public:
     void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(StorageAccessStatus)>&&) override;
     void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) override;
 
-    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override;
+    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser) override;
     void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&) override;
     void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) override;
 
index c07d929..c2b4393 100644 (file)
@@ -171,7 +171,7 @@ public:
     virtual void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(StorageAccessStatus)>&&) = 0;
     virtual void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) = 0;
 
-    virtual void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) = 0;
+    virtual void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser) = 0;
     virtual void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&) = 0;
     virtual void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) = 0;
 
@@ -222,6 +222,7 @@ protected:
         Seconds grandfatheringTime { 24_h * 7 };
         Seconds cacheMaxAgeCapTime { 24_h * 7 };
         Seconds clientSideCookiesAgeCapTime { 24_h * 7 };
+        Seconds minDelayAfterMainFrameDocumentLoadToNotBeARedirect { 5_s };
         bool shouldNotifyPagesWhenDataRecordsWereScanned { false };
         bool shouldClassifyResourcesBeforeDataRecordsRemoval { true };
         bool shouldSubmitTelemetry { true };
index 8239d6d..23ffdc8 100644 (file)
@@ -554,43 +554,13 @@ void WebResourceLoadStatisticsStore::submitTelemetry(CompletionHandler<void()>&&
     });
 }
 
-void WebResourceLoadStatisticsStore::logFrameNavigation(const WebFrameProxy& frame, const URL& pageURL, const WebCore::ResourceRequest& request, const URL& redirectURL)
+void WebResourceLoadStatisticsStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser)
 {
     ASSERT(RunLoop::isMain());
 
-    auto sourceURL = redirectURL;
-    bool isRedirect = !redirectURL.isNull();
-    if (!isRedirect) {
-        sourceURL = frame.url();
-        if (sourceURL.isNull())
-            sourceURL = pageURL;
-    }
-
-    auto& targetURL = request.url();
-
-    if (!targetURL.isValid() || !pageURL.isValid())
-        return;
-
-    auto targetHost = targetURL.host();
-    auto mainFrameHost = pageURL.host();
-
-    if (targetHost.isEmpty() || mainFrameHost.isEmpty() || targetHost == sourceURL.host())
-        return;
-
-    RegistrableDomain targetDomain { targetURL };
-    RegistrableDomain topFrameDomain { pageURL };
-    RegistrableDomain sourceDomain { sourceURL };
-
-    logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, frame.isMainFrame());
-}
-
-void WebResourceLoadStatisticsStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
-{
-    ASSERT(RunLoop::isMain());
-
-    postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), sourceDomain = sourceDomain.isolatedCopy(), isRedirect, isMainFrame] {
+    postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), sourceDomain = sourceDomain.isolatedCopy(), isRedirect, isMainFrame, delayAfterMainFrameDocumentLoad, wasPotentiallyInitiatedByUser] {
         if (m_statisticsStore)
-            m_statisticsStore->logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, isMainFrame);
+            m_statisticsStore->logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, isMainFrame, delayAfterMainFrameDocumentLoad, wasPotentiallyInitiatedByUser);
     });
 }
 
index 2e6a93f..9e60ce1 100644 (file)
@@ -210,8 +210,7 @@ struct ThirdPartyData {
 
     void applicationWillTerminate();
 
-    void logFrameNavigation(const WebFrameProxy&, const URL& pageURL, const WebCore::ResourceRequest&, const URL& redirectURL);
-    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame);
+    void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser);
     void logUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&);
     void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&, CompletionHandler<void()>&&);
     void clearUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&);
index 4da04ad..39926eb 100644 (file)
@@ -984,11 +984,11 @@ void NetworkProcess::getAllStorageAccessEntries(PAL::SessionID sessionID, Comple
     }
 }
 
-void NetworkProcess::logFrameNavigation(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame)
+void NetworkProcess::logFrameNavigation(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser)
 {
     if (auto* networkSession = this->networkSession(sessionID)) {
         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
-            resourceLoadStatistics->logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, isMainFrame);
+            resourceLoadStatistics->logFrameNavigation(targetDomain, topFrameDomain, sourceDomain, isRedirect, isMainFrame, delayAfterMainFrameDocumentLoad, wasPotentiallyInitiatedByUser);
     } else
         ASSERT_NOT_REACHED();
 }
index e08d582..3ef86ec 100644 (file)
@@ -224,7 +224,7 @@ public:
     void isRelationshipOnlyInDatabaseOnce(PAL::SessionID, const RegistrableDomain& subDomain, const RegistrableDomain& topDomain, CompletionHandler<void(bool)>&&);
     void hasLocalStorage(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&);
     void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String> domains)>&&);
-    void logFrameNavigation(PAL::SessionID, const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame);
+    void logFrameNavigation(PAL::SessionID, const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser);
     void logUserInteraction(PAL::SessionID, const TopFrameDomain&, CompletionHandler<void()>&&);
     void removePrevalentDomains(PAL::SessionID, const Vector<RegistrableDomain>&);
     void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
index 2ad9881..a56613c 100644 (file)
@@ -102,7 +102,7 @@ messages -> NetworkProcess LegacyReceiver {
     IsRegisteredAsRedirectingTo(PAL::SessionID sessionID, WebCore::RegistrableDomain redirectedFromDomain, WebCore::RegistrableDomain redirectedToDomain) -> (bool isRedirectingTo) Async
     IsRegisteredAsSubFrameUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubframeUnder) Async
     IsRegisteredAsSubresourceUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subresourceDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubresourceUnder) Async
-    LogFrameNavigation(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain sourceDomain, bool isRedirect, bool isMainFrame)
+    LogFrameNavigation(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain sourceDomain, bool isRedirect, bool isMainFrame, Seconds delayAfterMainFrameDocumentLoad, bool wasPotentiallyInitiatedByUser)
     LogUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain) -> () Async
     RemovePrevalentDomains(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsWithInteraction)
     ResetParametersToDefaultValues(PAL::SessionID sessionID) -> () Async
index 89a4ca2..46b8504 100644 (file)
@@ -395,17 +395,6 @@ static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecor
     return [NSURL fileURLWithPath:_websiteDataStore->configuration().indexedDBDatabaseDirectory() isDirectory:YES];
 }
 
-- (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value
-{
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-    auto* store = _websiteDataStore->resourceLoadStatistics();
-    if (!store)
-        return;
-
-    store->setShouldSubmitTelemetry(value);
-#endif
-}
-
 - (void)_setResourceLoadStatisticsTestingCallback:(void (^)(WKWebsiteDataStore *, NSString *))callback
 {
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
index 2c3753f..7292493 100644 (file)
@@ -61,7 +61,6 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
 
 @property (nonatomic, readonly) NSURL *_indexedDBDatabaseDirectory;
 
-- (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value WK_API_AVAILABLE(macos(10.13), ios(11.0));
 - (void)_setResourceLoadStatisticsTestingCallback:(nullable void (^)(WKWebsiteDataStore *, NSString *))callback WK_API_AVAILABLE(macos(10.13), ios(11.0));
 - (void)_getAllStorageAccessEntriesFor:(WKWebView *)webView completionHandler:(void (^)(NSArray<NSString *> *domains))completionHandler WK_API_AVAILABLE(macos(10.14), ios(12.0));
 + (void)_allowWebsiteDataRecordsForAllOrigins WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
index ef45a8c..bd0affd 100644 (file)
@@ -4572,8 +4572,12 @@ void WebPageProxy::didFinishDocumentLoadForFrame(FrameIdentifier frameID, uint64
     if (frame->isMainFrame() && navigationID)
         navigation = navigationState().navigation(navigationID);
 
-    if (frame->isMainFrame())
+    if (frame->isMainFrame()) {
         m_navigationClient->didFinishDocumentLoad(*this, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+        m_didFinishDocumentLoadForMainFrameTimestamp = MonotonicTime::now();
+#endif
+    }
 }
 
 void WebPageProxy::didFinishLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, const UserData& userData)
@@ -4986,10 +4990,9 @@ void WebPageProxy::decidePolicyForNavigationAction(Ref<WebProcessProxy>&& proces
     API::Navigation* mainFrameNavigation = frame.isMainFrame() ? navigation.get() : nullptr;
     WebFrameProxy* originatingFrame = originatingFrameInfoData.frameID ? process->webFrame(*originatingFrameInfoData.frameID) : nullptr;
 
+    auto userInitiatedActivity = process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    if (auto* resourceLoadStatisticsStore = websiteDataStore().resourceLoadStatistics())
-        resourceLoadStatisticsStore->logFrameNavigation(frame, URL(URL(), m_pageLoadState.url()), request, redirectResponse.url());
-    logFrameNavigation(frame, URL(URL(), m_pageLoadState.url()), request, redirectResponse.url());
+    logFrameNavigation(frame, URL(URL(), m_pageLoadState.url()), request, redirectResponse.url(), !!userInitiatedActivity);
 #endif
 
     if (m_policyClient)
@@ -5004,7 +5007,6 @@ void WebPageProxy::decidePolicyForNavigationAction(Ref<WebProcessProxy>&& proces
             sourceFrameInfo = API::FrameInfo::create(WTFMove(originatingFrameInfoData), originatingPage);
         }
 
-        auto userInitiatedActivity = process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
         bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision
             && destinationFrameInfo->isMainFrame()
             && (m_mainFrame ? !hostsAreEqual(m_mainFrame->url(), request.url()) : false)
@@ -5048,7 +5050,7 @@ WebPageProxy* WebPageProxy::nonEphemeralWebPageProxy()
 }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-void WebPageProxy::logFrameNavigation(const WebFrameProxy& frame, const URL& pageURL, const WebCore::ResourceRequest& request, const URL& redirectURL)
+void WebPageProxy::logFrameNavigation(const WebFrameProxy& frame, const URL& pageURL, const WebCore::ResourceRequest& request, const URL& redirectURL, bool wasPotentiallyInitiatedByUser)
 {
     ASSERT(RunLoop::isMain());
     
@@ -5071,7 +5073,7 @@ void WebPageProxy::logFrameNavigation(const WebFrameProxy& frame, const URL& pag
     if (targetHost.isEmpty() || mainFrameHost.isEmpty() || targetHost == sourceURL.host())
         return;
 
-    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::LogFrameNavigation(m_websiteDataStore->sessionID(), RegistrableDomain { targetURL }, RegistrableDomain { pageURL }, RegistrableDomain { sourceURL }, isRedirect, frame.isMainFrame()));
+    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::LogFrameNavigation(m_websiteDataStore->sessionID(), RegistrableDomain { targetURL }, RegistrableDomain { pageURL }, RegistrableDomain { sourceURL }, isRedirect, frame.isMainFrame(), MonotonicTime::now() - m_didFinishDocumentLoadForMainFrameTimestamp, wasPotentiallyInitiatedByUser));
 }
 #endif
 
index 1f0e6b6..3c9b215 100644 (file)
@@ -2156,7 +2156,7 @@ private:
     void didAttachToRunningProcess();
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    void logFrameNavigation(const WebFrameProxy&, const URL& pageURL, const WebCore::ResourceRequest&, const URL& redirectURL);
+    void logFrameNavigation(const WebFrameProxy&, const URL& pageURL, const WebCore::ResourceRequest&, const URL& redirectURL, bool wasPotentiallyInitiatedByUser);
 #endif
 
     // WebPaymentCoordinatorProxy::Client
@@ -2660,6 +2660,10 @@ private:
 #if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
     std::unique_ptr<WebDeviceOrientationUpdateProviderProxy> m_webDeviceOrientationUpdateProviderProxy;
 #endif
+
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    MonotonicTime m_didFinishDocumentLoadForMainFrameTimestamp;
+#endif
 };
 
 } // namespace WebKit
index 6e25a6f..a3cc72d 100644 (file)
@@ -52,8 +52,6 @@
 
 namespace WebKit {
 
-static id terminationObserver;
-
 static HashSet<WebsiteDataStore*>& dataStores()
 {
     static NeverDestroyed<HashSet<WebsiteDataStore*>> dataStores;
@@ -229,42 +227,14 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
 
 void WebsiteDataStore::platformInitialize()
 {
-    if (!terminationObserver) {
-        ASSERT(dataStores().isEmpty());
-
-#if PLATFORM(MAC)
-        NSString *notificationName = NSApplicationWillTerminateNotification;
-#else
-        NSString *notificationName = UIApplicationWillTerminateNotification;
-#endif
-        terminationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:notificationName object:nil queue:nil usingBlock:^(NSNotification *note) {
-            for (auto& dataStore : dataStores()) {
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-                if (dataStore->m_resourceLoadStatistics)
-                    dataStore->m_resourceLoadStatistics->applicationWillTerminate();
-#endif
-            }
-        }];
-    }
-
     ASSERT(!dataStores().contains(this));
     dataStores().add(this);
 }
 
 void WebsiteDataStore::platformDestroy()
 {
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
-    if (m_resourceLoadStatistics)
-        m_resourceLoadStatistics->applicationWillTerminate();
-#endif
-
     ASSERT(dataStores().contains(this));
     dataStores().remove(this);
-
-    if (dataStores().isEmpty()) {
-        [[NSNotificationCenter defaultCenter] removeObserver:terminationObserver];
-        terminationObserver = nil;
-    }
 }
 
 void WebsiteDataStore::platformRemoveRecentSearches(WallTime oldestTimeToRemove)
index 351f62e..c65a067 100644 (file)
@@ -129,7 +129,6 @@ public:
     void setCacheStorageDirectory(String&& directory) { m_resolvedConfiguration->setCacheStorageDirectory(WTFMove(directory)); }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    WebResourceLoadStatisticsStore* resourceLoadStatistics() const { return m_resourceLoadStatistics.get(); }
     void clearResourceLoadStatisticsInWebProcesses(CompletionHandler<void()>&&);
 #endif
 
@@ -334,7 +333,6 @@ private:
     const Ref<DeviceIdHashSaltStorage> m_deviceIdHashSaltStorage;
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    RefPtr<WebResourceLoadStatisticsStore> m_resourceLoadStatistics;
     bool m_resourceLoadStatisticsDebugMode { false };
     bool m_resourceLoadStatisticsEnabled { false };
     WTF::Function<void(const String&)> m_statisticsTestingCallback;
index 0cb1822..40f5804 100644 (file)
@@ -1,3 +1,15 @@
+2020-01-09  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Add timing information to WebPageProxy::logFrameNavigation() to detect delayed client-side redirects
+        https://bugs.webkit.org/show_bug.cgi?id=205522
+        <rdar://problem/58125759>
+
+        Reviewed by Chris Dumez.
+
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::initializeWebViewConfiguration):
+            Removed dead code.
+
 2020-01-09  Paulo Matos  <pmatos@igalia.com>
 
         Race condition in run-jsc-stress-tests chdir
index f513a41..f5e3f29 100644 (file)
@@ -78,7 +78,6 @@ void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injecte
     }
 
     [globalWebViewConfiguration.websiteDataStore _setResourceLoadStatisticsEnabled:YES];
-    [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:NO];
 
     [globalWebsiteDataStoreDelegateClient release];
     globalWebsiteDataStoreDelegateClient = [[TestWebsiteDataStoreDelegate alloc] init];