StorageProcess::deleteWebsiteData() should ensure there is a SWServer for the given...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 19:13:56 +0000 (19:13 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 19:13:56 +0000 (19:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180784

Reviewed by Youenn Fablet.

StorageProcess::deleteWebsiteData() should ensure there is a SWServer for the given sessionID
instead of not clearing anything when no such SWServer exists.

This will be useful on iOS once <rdar://problem/36034667> is fully fixed.

* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::deleteWebsiteData):
(WebKit::StorageProcess::deleteWebsiteDataForOrigins):
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):

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

Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/StorageProcess.cpp

index f9baa1b..801fabd 100644 (file)
@@ -1,5 +1,23 @@
 2017-12-14  Chris Dumez  <cdumez@apple.com>
 
+        StorageProcess::deleteWebsiteData() should ensure there is a SWServer for the given sessionID
+        https://bugs.webkit.org/show_bug.cgi?id=180784
+
+        Reviewed by Youenn Fablet.
+
+        StorageProcess::deleteWebsiteData() should ensure there is a SWServer for the given sessionID
+        instead of not clearing anything when no such SWServer exists.
+
+        This will be useful on iOS once <rdar://problem/36034667> is fully fixed.
+
+        * StorageProcess/StorageProcess.cpp:
+        (WebKit::StorageProcess::deleteWebsiteData):
+        (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
+
+2017-12-14  Chris Dumez  <cdumez@apple.com>
+
         WebsiteDataStore::defaultDataStoreConfiguration() fails to set default value for serviceWorkerRegistrationDirectory
         https://bugs.webkit.org/show_bug.cgi?id=180794
         <rdar://problem/36034667>
index ed7d650..fe452b6 100644 (file)
@@ -301,10 +301,8 @@ void StorageProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<Websi
     });
 
 #if ENABLE(SERVICE_WORKER)
-    if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) {
-        if (auto* server = m_swServers.get(sessionID))
-            server->clearAll([callbackAggregator = callbackAggregator.copyRef()] { });
-    }
+    if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations))
+        swServerForSession(sessionID).clearAll([callbackAggregator = callbackAggregator.copyRef()] { });
 #endif
 
 #if ENABLE(INDEXED_DATABASE)
@@ -321,10 +319,9 @@ void StorageProcess::deleteWebsiteDataForOrigins(PAL::SessionID sessionID, Optio
 
 #if ENABLE(SERVICE_WORKER)
     if (websiteDataTypes.contains(WebsiteDataType::ServiceWorkerRegistrations)) {
-        if (auto* server = m_swServers.get(sessionID)) {
-            for (auto& originData : securityOriginDatas)
-                server->clear(originData.securityOrigin(), [callbackAggregator = callbackAggregator.copyRef()] { });
-        }
+        auto& server = swServerForSession(sessionID);
+        for (auto& originData : securityOriginDatas)
+            server.clear(originData.securityOrigin(), [callbackAggregator = callbackAggregator.copyRef()] { });
     }
 #endif