Unreviewed test fix after r240243
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2019 01:55:47 +0000 (01:55 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2019 01:55:47 +0000 (01:55 +0000)
Nhttps://bugs.webkit.org/show_bug.cgi?id=193660
<rdar://problem/47433602>

The new ResourceLoadStatistics section of 'removeData' was incrementing the
pending callback count before deciding whether to send a message to delete
data. This left the count out-of-balance leading to the operation never
completing.

This patch also prevents sending a second message to the NetworkProcess
requesting data be deleted if the message was already sent in an earlier
section of the method (e.g., as typically happens when all website data
is being deleted).

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

index a5a4321..b4932d3 100644 (file)
@@ -1,5 +1,24 @@
 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
 
+        Unreviewed test fix after r240243
+        Nhttps://bugs.webkit.org/show_bug.cgi?id=193660
+        <rdar://problem/47433602>
+
+        The new ResourceLoadStatistics section of 'removeData' was incrementing the
+        pending callback count before deciding whether to send a message to delete
+        data. This left the count out-of-balance leading to the operation never
+        completing.
+
+        This patch also prevents sending a second message to the NetworkProcess
+        requesting data be deleted if the message was already sent in an earlier
+        section of the method (e.g., as typically happens when all website data
+        is being deleted).
+
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::removeData):
+
+2019-01-21  Brent Fulgham  <bfulgham@apple.com>
+
         Implement message handlers for NetworkProcess-based ResourceLoadStatistics
         https://bugs.webkit.org/show_bug.cgi?id=193556
         <rdar://problem/47368501>
index 21c27b8..2a14a5c 100644 (file)
@@ -757,6 +757,7 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, WallTime
     }
 #endif
 
+    bool didNotifyNetworkProcessToDeleteWebsiteData = false;
     auto networkProcessAccessType = computeNetworkProcessAccessTypeForDataRemoval(dataTypes, !isPersistent());
     if (networkProcessAccessType != ProcessAccessType::None) {
         for (auto& processPool : processPools()) {
@@ -778,6 +779,7 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, WallTime
             processPool->networkProcess()->deleteWebsiteData(m_sessionID, dataTypes, modifiedSince, [callbackAggregator, processPool] {
                 callbackAggregator->removePendingCallback();
             });
+            didNotifyNetworkProcessToDeleteWebsiteData = true;
         }
     }
 
@@ -938,15 +940,15 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, WallTime
         // we do not need to re-grandfather old data.
         auto shouldGrandfather = ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw) ? ShouldGrandfather::No : ShouldGrandfather::Yes;
         
-        callbackAggregator->addPendingCallback();
-
         if (m_resourceLoadStatistics) {
+            callbackAggregator->addPendingCallback();
             m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, shouldGrandfather, [callbackAggregator] {
                 callbackAggregator->removePendingCallback();
             });
-        } else {
+        } else if (!didNotifyNetworkProcessToDeleteWebsiteData) {
             for (auto& processPool : processPools()) {
                 if (auto* process = processPool->networkProcess()) {
+                    callbackAggregator->addPendingCallback();
                     process->deleteWebsiteData(m_sessionID, dataTypes, modifiedSince, [callbackAggregator] {
                         callbackAggregator->removePendingCallback();
                     });