Title: [181837] trunk
Revision
181837
Author
[email protected]
Date
2015-03-22 15:50:23 -0700 (Sun, 22 Mar 2015)

Log Message

_WKWebsiteDataStore should clear WebSQL databases
https://bugs.webkit.org/show_bug.cgi?id=142947
Source/WebCore:

Reviewed by Sam Weinig.

* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::trackerWithDatabasePath):
Add a hack so we can get at a tracker from the UI process.

(WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
New function that deletes all databases modified after a given time.

* Modules/webdatabase/DatabaseTracker.h:
Add new members and export the ones we want to call from WebKit2.

* Modules/webdatabase/OriginLock.h:
Export the destructor.

Source/WebKit2:

rdar://problem/20242174

Reviewed by Sam Weinig.

* Shared/WebsiteData/WebsiteDataTypes.h:
Add WebsiteDataTypeWebSQLDatabases.

* UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
(API::WebsiteDataStore::defaultDataStoreConfiguration):
Initialize configuration.webSQLDatabaseDirectory.

* UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
Add WKWebsiteDataTypeWebSQLDatabases.

* UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
(dataTypesToString):
Handle WKWebsiteDataTypeWebSQLDatabases.

* UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
(WebKit::toWebsiteDataTypes):
(WebKit::toWKWebsiteDataTypes):
Handle WKWebsiteDataTypeWebSQLDatabases and WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
Initialize m_webSQLDatabaseDirectory and add a queue member variable.

(WebKit::WebsiteDataStore::fetchData):
Fetch database origins.

(WebKit::WebsiteDataStore::removeData):
Remove databases.

* UIProcess/WebsiteData/WebsiteDataStore.h:
Add new members.

Tools:

Reviewed by Sam Weinig.

Add a variable that keeps track of the types of data we want to operate on, for easier debugging.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController fetchWebsiteData:]):
(-[WK2BrowserWindowController fetchAndClearWebsiteData:]):
(-[WK2BrowserWindowController clearWebsiteData:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181836 => 181837)


--- trunk/Source/WebCore/ChangeLog	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebCore/ChangeLog	2015-03-22 22:50:23 UTC (rev 181837)
@@ -1,3 +1,23 @@
+2015-03-22  Anders Carlsson  <[email protected]>
+
+        _WKWebsiteDataStore should clear WebSQL databases
+        https://bugs.webkit.org/show_bug.cgi?id=142947
+
+        Reviewed by Sam Weinig.
+
+        * Modules/webdatabase/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::trackerWithDatabasePath):
+        Add a hack so we can get at a tracker from the UI process.
+
+        (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
+        New function that deletes all databases modified after a given time.
+
+        * Modules/webdatabase/DatabaseTracker.h:
+        Add new members and export the ones we want to call from WebKit2.
+
+        * Modules/webdatabase/OriginLock.h:
+        Export the destructor.
+
 2015-03-21  Dean Jackson  <[email protected]>
 
         Remove the prefix for CSS Transforms

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (181836 => 181837)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp	2015-03-22 22:50:23 UTC (rev 181837)
@@ -56,6 +56,11 @@
 
 namespace WebCore {
 
+std::unique_ptr<DatabaseTracker> DatabaseTracker::trackerWithDatabasePath(const String& databasePath)
+{
+    return std::unique_ptr<DatabaseTracker>(new DatabaseTracker(databasePath));
+}
+
 static DatabaseTracker* staticTracker = 0;
 
 void DatabaseTracker::initializeTracker(const String& databasePath)
@@ -825,6 +830,31 @@
         deleteOrigin(originsCopy[i].get());
 }
 
+void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::time_point time)
+{
+    Vector<RefPtr<SecurityOrigin>> originsCopy;
+    origins(originsCopy);
+
+    for (auto& origin : originsCopy) {
+        Vector<String> databaseNames;
+        if (!databaseNamesForOrigin(origin.get(), databaseNames))
+            continue;
+
+        for (auto& databaseName : databaseNames) {
+            auto fullPath = fullPathForDatabase(origin.get(), databaseName, false);
+
+            time_t modificationTime;
+            if (!getFileModificationTime(fullPath, modificationTime))
+                continue;
+
+            if (modificationTime < std::chrono::system_clock::to_time_t(time))
+                continue;
+
+            deleteDatabase(origin.get(), databaseName);
+        }
+    }
+}
+
 // It is the caller's responsibility to make sure that nobody is trying to create, delete, open, or close databases in this origin while the deletion is
 // taking place.
 bool DatabaseTracker::deleteOrigin(SecurityOrigin* origin)

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h (181836 => 181837)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2015-03-22 22:50:23 UTC (rev 181837)
@@ -49,6 +49,9 @@
 class DatabaseTracker {
     WTF_MAKE_NONCOPYABLE(DatabaseTracker); WTF_MAKE_FAST_ALLOCATED;
 public:
+    // FIXME: This is a hack so we can easily delete databases from the UI process in WebKit2.
+    WEBCORE_EXPORT static std::unique_ptr<DatabaseTracker> trackerWithDatabasePath(const String& databasePath);
+
     static void initializeTracker(const String& databasePath);
 
     WEBCORE_EXPORT static DatabaseTracker& tracker();
@@ -82,7 +85,7 @@
     void setDatabaseDirectoryPath(const String&);
     String databaseDirectoryPath() const;
 
-    void origins(Vector<RefPtr<SecurityOrigin>>& result);
+    WEBCORE_EXPORT void origins(Vector<RefPtr<SecurityOrigin>>& result);
     bool databaseNamesForOrigin(SecurityOrigin*, Vector<String>& result);
 
     DatabaseDetails detailsForNameAndOrigin(const String&, SecurityOrigin*);
@@ -93,7 +96,8 @@
     PassRefPtr<OriginLock> originLockFor(SecurityOrigin*);
 
     void deleteAllDatabases();
-    bool deleteOrigin(SecurityOrigin*);
+    WEBCORE_EXPORT void deleteDatabasesModifiedSince(std::chrono::system_clock::time_point);
+    WEBCORE_EXPORT bool deleteOrigin(SecurityOrigin*);
     bool deleteDatabase(SecurityOrigin*, const String& name);
 
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/Modules/webdatabase/OriginLock.h (181836 => 181837)


--- trunk/Source/WebCore/Modules/webdatabase/OriginLock.h	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebCore/Modules/webdatabase/OriginLock.h	2015-03-22 22:50:23 UTC (rev 181837)
@@ -37,7 +37,7 @@
     WTF_MAKE_NONCOPYABLE(OriginLock); WTF_MAKE_FAST_ALLOCATED;
 public:
     OriginLock(String originPath);
-    ~OriginLock();
+    WEBCORE_EXPORT ~OriginLock();
 
     void lock();
     void unlock();

Modified: trunk/Source/WebKit2/ChangeLog (181836 => 181837)


--- trunk/Source/WebKit2/ChangeLog	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/ChangeLog	2015-03-22 22:50:23 UTC (rev 181837)
@@ -1,3 +1,43 @@
+2015-03-22  Anders Carlsson  <[email protected]>
+
+        _WKWebsiteDataStore should clear WebSQL databases
+        https://bugs.webkit.org/show_bug.cgi?id=142947
+        rdar://problem/20242174
+
+        Reviewed by Sam Weinig.
+
+        * Shared/WebsiteData/WebsiteDataTypes.h:
+        Add WebsiteDataTypeWebSQLDatabases.
+
+        * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
+        (API::WebsiteDataStore::defaultDataStoreConfiguration):
+        Initialize configuration.webSQLDatabaseDirectory.
+
+        * UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
+        Add WKWebsiteDataTypeWebSQLDatabases.
+
+        * UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
+        (dataTypesToString):
+        Handle WKWebsiteDataTypeWebSQLDatabases.
+
+        * UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
+        (WebKit::toWebsiteDataTypes):
+        (WebKit::toWKWebsiteDataTypes):
+        Handle WKWebsiteDataTypeWebSQLDatabases and WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases.
+
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::WebsiteDataStore):
+        Initialize m_webSQLDatabaseDirectory and add a queue member variable.
+
+        (WebKit::WebsiteDataStore::fetchData):
+        Fetch database origins.
+    
+        (WebKit::WebsiteDataStore::removeData):
+        Remove databases.
+
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        Add new members.
+
 2015-03-22  Dan Bernstein  <[email protected]>
 
         [iOS] Expose WebPageProxy::setInitialFocus as SPI

Modified: trunk/Source/WebKit2/Shared/WebsiteData/WebsiteDataTypes.h (181836 => 181837)


--- trunk/Source/WebKit2/Shared/WebsiteData/WebsiteDataTypes.h	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/Shared/WebsiteData/WebsiteDataTypes.h	2015-03-22 22:50:23 UTC (rev 181837)
@@ -33,6 +33,7 @@
     WebsiteDataTypeDiskCache = 1 << 1,
     WebsiteDataTypeMemoryCache = 1 << 2,
     WebsiteDataTypeLocalStorage = 1 << 3,
+    WebsiteDataTypeWebSQLDatabases = 1 << 4,
 };
 
 };

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm (181836 => 181837)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm	2015-03-22 22:50:23 UTC (rev 181837)
@@ -65,6 +65,7 @@
     WebKit::WebsiteDataStore::Configuration configuration;
 
     configuration.localStorageDirectory = websiteDataDirectoryFileSystemRepresentation("LocalStorage");
+    configuration.webSQLDatabaseDirectory = websiteDataDirectoryFileSystemRepresentation("WebSQL");
 
     return configuration;
 }

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h (181836 => 181837)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.h	2015-03-22 22:50:23 UTC (rev 181837)
@@ -35,6 +35,8 @@
     WKWebsiteDataTypeMemoryCache = 1 << 2,
 
     WKWebsiteDataTypeLocalStorage = 1 << 3,
+    WKWebsiteDataTypeWebSQLDatabases = 1 << 4,
+
     WKWebsiteDataTypeAll = NSUIntegerMax,
 } WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm (181836 => 181837)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm	2015-03-22 22:50:23 UTC (rev 181837)
@@ -49,6 +49,8 @@
         [array addObject:@"Memory Cache"];
     if (dataTypes & WKWebsiteDataTypeLocalStorage)
         [array addObject:@"Local Storage"];
+    if (dataTypes & WKWebsiteDataTypeWebSQLDatabases)
+        [array addObject:@"Web SQL"];
 
     return [array componentsJoinedByString:@", "];
 }

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h (181836 => 181837)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h	2015-03-22 22:50:23 UTC (rev 181837)
@@ -52,6 +52,8 @@
         websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeMemoryCache;
     if (wkWebsiteDataTypes & WKWebsiteDataTypeLocalStorage)
         websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeLocalStorage;
+    if (wkWebsiteDataTypes & WKWebsiteDataTypeWebSQLDatabases)
+        websiteDataTypes |= WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases;
 
     return static_cast<WebsiteDataTypes>(websiteDataTypes);
 }
@@ -70,6 +72,8 @@
         wkWebsiteDataTypes |= WKWebsiteDataTypeMemoryCache;
     if (websiteDataTypes & WebsiteDataTypes::WebsiteDataTypeLocalStorage)
         wkWebsiteDataTypes |= WKWebsiteDataTypeLocalStorage;
+    if (websiteDataTypes & WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases)
+        wkWebsiteDataTypes |= WKWebsiteDataTypeWebSQLDatabases;
 
     return wkWebsiteDataTypes;
 }

Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (181836 => 181837)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp	2015-03-22 22:50:23 UTC (rev 181837)
@@ -30,6 +30,8 @@
 #include "StorageManager.h"
 #include "WebProcessPool.h"
 #include "WebsiteData.h"
+#include <WebCore/DatabaseTracker.h>
+#include <WebCore/OriginLock.h>
 #include <wtf/RunLoop.h>
 
 namespace WebKit {
@@ -62,7 +64,9 @@
 WebsiteDataStore::WebsiteDataStore(Configuration configuration)
     : m_identifier(generateIdentifier())
     , m_sessionID(WebCore::SessionID::defaultSessionID())
+    , m_webSQLDatabaseDirectory(WTF::move(configuration.webSQLDatabaseDirectory))
     , m_storageManager(StorageManager::create(WTF::move(configuration.localStorageDirectory)))
+    , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
 {
     platformInitialize();
 }
@@ -70,6 +74,7 @@
 WebsiteDataStore::WebsiteDataStore(WebCore::SessionID sessionID)
     : m_identifier(generateIdentifier())
     , m_sessionID(sessionID)
+    , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
 {
     platformInitialize();
 }
@@ -270,6 +275,25 @@
         });
     }
 
+    if (dataTypes & WebsiteDataTypeWebSQLDatabases && !isNonPersistent()) {
+        StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
+
+        callbackAggregator->addPendingCallback();
+
+        m_queue->dispatch([webSQLDatabaseDirectory, callbackAggregator] {
+            Vector<RefPtr<WebCore::SecurityOrigin>> origins;
+            WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string())->origins(origins);
+
+            RunLoop::main().dispatch([webSQLDatabaseDirectory, callbackAggregator, origins]() mutable {
+                WebsiteData websiteData;
+                for (auto& origin : origins)
+                    websiteData.entries.append(WebsiteData::Entry { WTF::move(origin), WebsiteDataTypeWebSQLDatabases });
+
+                callbackAggregator->removePendingCallback(WTF::move(websiteData));
+            });
+        });
+    }
+
     callbackAggregator->callIfNeeded();
 }
 
@@ -396,6 +420,20 @@
         });
     }
 
+    if (dataTypes & WebsiteDataTypeWebSQLDatabases && !isNonPersistent()) {
+        StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
+
+        callbackAggregator->addPendingCallback();
+
+        m_queue->dispatch([webSQLDatabaseDirectory, callbackAggregator, modifiedSince] {
+            WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string())->deleteDatabasesModifiedSince(modifiedSince);
+
+            RunLoop::main().dispatch([callbackAggregator] {
+                callbackAggregator->removePendingCallback();
+            });
+        });
+    }
+
     // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
     callbackAggregator->callIfNeeded();
 }
@@ -409,7 +447,7 @@
             origins.append(origin);
     }
 
-    struct CallbackAggregator : public RefCounted<CallbackAggregator> {
+    struct CallbackAggregator : public ThreadSafeRefCounted<CallbackAggregator> {
         explicit CallbackAggregator (std::function<void ()> completionHandler)
             : completionHandler(WTF::move(completionHandler))
         {
@@ -508,6 +546,28 @@
         });
     }
 
+    if (dataTypes & WebsiteDataTypeWebSQLDatabases && !isNonPersistent()) {
+        StringCapture webSQLDatabaseDirectory { m_webSQLDatabaseDirectory };
+
+        HashSet<RefPtr<WebCore::SecurityOrigin>> origins;
+        for (const auto& dataRecord : dataRecords) {
+            for (const auto& origin : dataRecord.origins)
+                origins.add(origin);
+        }
+
+        callbackAggregator->addPendingCallback();
+        m_queue->dispatch([origins, callbackAggregator, webSQLDatabaseDirectory] {
+            auto databaseTracker = WebCore::DatabaseTracker::trackerWithDatabasePath(webSQLDatabaseDirectory.string());
+
+            for (const auto& origin : origins)
+                databaseTracker->deleteOrigin(origin.get());
+
+            RunLoop::main().dispatch([callbackAggregator] {
+                callbackAggregator->removePendingCallback();
+            });
+        });
+    }
+
     // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away.
     callbackAggregator->callIfNeeded();
 }

Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (181836 => 181837)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2015-03-22 22:50:23 UTC (rev 181837)
@@ -33,6 +33,7 @@
 #include <wtf/HashSet.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
+#include <wtf/WorkQueue.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -44,6 +45,7 @@
 class WebsiteDataStore : public RefCounted<WebsiteDataStore>, public WebProcessLifetimeObserver {
 public:
     struct Configuration {
+        String webSQLDatabaseDirectory;
         String localStorageDirectory;
     };
     static RefPtr<WebsiteDataStore> createNonPersistent();
@@ -81,7 +83,10 @@
     const uint64_t m_identifier;
     const WebCore::SessionID m_sessionID;
 
+    const String m_webSQLDatabaseDirectory;
     const RefPtr<StorageManager> m_storageManager;
+
+    Ref<WorkQueue> m_queue;
 };
 
 }

Modified: trunk/Tools/ChangeLog (181836 => 181837)


--- trunk/Tools/ChangeLog	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Tools/ChangeLog	2015-03-22 22:50:23 UTC (rev 181837)
@@ -1,3 +1,17 @@
+2015-03-22  Anders Carlsson  <[email protected]>
+
+        _WKWebsiteDataStore should clear WebSQL databases
+        https://bugs.webkit.org/show_bug.cgi?id=142947
+
+        Reviewed by Sam Weinig.
+
+        Add a variable that keeps track of the types of data we want to operate on, for easier debugging.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController fetchWebsiteData:]):
+        (-[WK2BrowserWindowController fetchAndClearWebsiteData:]):
+        (-[WK2BrowserWindowController clearWebsiteData:]):
+
 2015-03-20  Mark Hahnenberg  <[email protected]>
 
         GCTimer should know keep track of nested GC phases

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (181836 => 181837)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2015-03-22 21:44:50 UTC (rev 181836)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2015-03-22 22:50:23 UTC (rev 181837)
@@ -407,18 +407,20 @@
 {
 }
 
+static const WKWebsiteDataTypes dataTypes = WKWebsiteDataTypeAll;
+
 - (IBAction)fetchWebsiteData:(id)sender
 {
-    [_configuration._websiteDataStore fetchDataRecordsOfTypes:WKWebsiteDataTypeAll completionHandler:^(NSArray *websiteDataRecords) {
+    [_configuration._websiteDataStore fetchDataRecordsOfTypes:dataTypes completionHandler:^(NSArray *websiteDataRecords) {
         NSLog(@"did fetch website data %@.", websiteDataRecords);
     }];
 }
 
 - (IBAction)fetchAndClearWebsiteData:(id)sender
 {
-    [_configuration._websiteDataStore fetchDataRecordsOfTypes:WKWebsiteDataTypeAll completionHandler:^(NSArray *websiteDataRecords) {
-        [_configuration._websiteDataStore removeDataOfTypes:WKWebsiteDataTypeAll forDataRecords:websiteDataRecords completionHandler:^{
-            [_configuration._websiteDataStore fetchDataRecordsOfTypes:WKWebsiteDataTypeAll completionHandler:^(NSArray *websiteDataRecords) {
+    [_configuration._websiteDataStore fetchDataRecordsOfTypes:dataTypes completionHandler:^(NSArray *websiteDataRecords) {
+        [_configuration._websiteDataStore removeDataOfTypes:dataTypes forDataRecords:websiteDataRecords completionHandler:^{
+            [_configuration._websiteDataStore fetchDataRecordsOfTypes:dataTypes completionHandler:^(NSArray *websiteDataRecords) {
                 NSLog(@"did clear website data, after clearing data is %@.", websiteDataRecords);
             }];
         }];
@@ -427,7 +429,7 @@
 
 - (IBAction)clearWebsiteData:(id)sender
 {
-    [_configuration._websiteDataStore removeDataOfTypes:WKWebsiteDataTypeAll modifiedSince:[NSDate distantPast] completionHandler:^{
+    [_configuration._websiteDataStore removeDataOfTypes:dataTypes modifiedSince:[NSDate distantPast] completionHandler:^{
         NSLog(@"Did clear website data.");
     }];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to