Title: [201081] trunk
Revision
201081
Author
[email protected]
Date
2016-05-18 09:30:30 -0700 (Wed, 18 May 2016)

Log Message

Modern IDB: Make TestRunner.clearAllDatabases also delete IndexedDB databases (once doing so is supported).
https://bugs.webkit.org/show_bug.cgi?id=157823

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No current behavior change, will be tested with b/157626's resolution).

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): Stub this out for now.
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/shared/InProcessIDBServer.h:

Source/WebKit:

* Storage/WebDatabaseProvider.cpp:
(WebDatabaseProvider::deleteAllDatabases):
* Storage/WebDatabaseProvider.h:

Source/WebKit/mac:

* Storage/WebDatabaseManager.mm:
(-[WebDatabaseManager deleteAllIndexedDatabases]):
* Storage/WebDatabaseManagerPrivate.h:

Source/WebKit2:

* CMakeLists.txt:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreRemoveAllIndexedDatabases):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:

Tools:

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::clearAllDatabases):

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::clearAllDatabases):

* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201080 => 201081)


--- trunk/Source/WebCore/ChangeLog	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebCore/ChangeLog	2016-05-18 16:30:30 UTC (rev 201081)
@@ -1,3 +1,17 @@
+2016-05-18  Brady Eidson  <[email protected]>
+
+        Modern IDB: Make TestRunner.clearAllDatabases also delete IndexedDB databases (once doing so is supported).
+        https://bugs.webkit.org/show_bug.cgi?id=157823
+
+        Reviewed by Alex Christensen.
+
+        No new tests (No current behavior change, will be tested with b/157626's resolution).
+
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): Stub this out for now.
+        * Modules/indexeddb/server/IDBServer.h:
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
 2016-05-18  Youenn Fablet  <[email protected]>
 
         Sync DOM exception types with WebIDL and update promise rejections

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (201080 => 201081)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2016-05-18 16:30:30 UTC (rev 201081)
@@ -468,6 +468,12 @@
         task->performTask();
 }
 
+void IDBServer::closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point, std::function<void ()> completionHandler)
+{
+    // FIXME: Implement (https://bugs.webkit.org/show_bug.cgi?id=157626)
+    completionHandler();
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (201080 => 201081)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2016-05-18 16:30:30 UTC (rev 201081)
@@ -96,6 +96,8 @@
 
     std::unique_ptr<IDBBackingStore> createBackingStore(const IDBDatabaseIdentifier&);
 
+    WEBCORE_EXPORT void closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point, std::function<void ()> completionHandler);
+
 private:
     IDBServer(IDBBackingStoreTemporaryFileHandler&);
     IDBServer(const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler&);

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (201080 => 201081)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2016-05-18 16:30:30 UTC (rev 201081)
@@ -53,6 +53,8 @@
     WEBCORE_EXPORT IDBClient::IDBConnectionToServer& connectionToServer() const;
     IDBServer::IDBConnectionToClient& connectionToClient() const;
 
+    IDBServer::IDBServer& idbServer() { return m_server.get(); }
+
     // IDBConnectionToServer
     void deleteDatabase(const IDBRequestData&) final;
     void openDatabase(const IDBRequestData&) final;

Modified: trunk/Source/WebKit/ChangeLog (201080 => 201081)


--- trunk/Source/WebKit/ChangeLog	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit/ChangeLog	2016-05-18 16:30:30 UTC (rev 201081)
@@ -1,3 +1,14 @@
+2016-05-18  Brady Eidson  <[email protected]>
+
+        Modern IDB: Make TestRunner.clearAllDatabases also delete IndexedDB databases (once doing so is supported).
+        https://bugs.webkit.org/show_bug.cgi?id=157823
+
+        Reviewed by Alex Christensen.
+
+        * Storage/WebDatabaseProvider.cpp:
+        (WebDatabaseProvider::deleteAllDatabases):
+        * Storage/WebDatabaseProvider.h:
+
 2016-04-25  Per Arne Vollan  <[email protected]>
 
         [Win][IndexedDB] Fix build errors.

Modified: trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp (201080 => 201081)


--- trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit/Storage/WebDatabaseProvider.cpp	2016-05-18 16:30:30 UTC (rev 201081)
@@ -56,4 +56,10 @@
 
     return result.iterator->value->connectionToServer();
 }
+
+void WebDatabaseProvider::deleteAllDatabases()
+{
+    for (auto& server : m_idbServerMap.values())
+        server->idbServer().closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point::min(), [] { });
+}
 #endif

Modified: trunk/Source/WebKit/Storage/WebDatabaseProvider.h (201080 => 201081)


--- trunk/Source/WebKit/Storage/WebDatabaseProvider.h	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit/Storage/WebDatabaseProvider.h	2016-05-18 16:30:30 UTC (rev 201081)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebDatabaseProvider_h
-#define WebDatabaseProvider_h
+#pragma once
 
 #include <WebCore/DatabaseProvider.h>
 #include <wtf/Forward.h>
@@ -43,6 +42,8 @@
 
 #if ENABLE(INDEXED_DATABASE)
     WebCore::IDBClient::IDBConnectionToServer& idbConnectionToServerForSession(const WebCore::SessionID&) override;
+
+    void deleteAllDatabases();
 #endif
 
 private:
@@ -54,5 +55,3 @@
     HashMap<uint64_t, RefPtr<WebCore::InProcessIDBServer>> m_idbServerMap;
 #endif
 };
-
-#endif // WebDatabaseProvider_h

Modified: trunk/Source/WebKit/mac/ChangeLog (201080 => 201081)


--- trunk/Source/WebKit/mac/ChangeLog	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-05-18 16:30:30 UTC (rev 201081)
@@ -1,3 +1,14 @@
+2016-05-18  Brady Eidson  <[email protected]>
+
+        Modern IDB: Make TestRunner.clearAllDatabases also delete IndexedDB databases (once doing so is supported).
+        https://bugs.webkit.org/show_bug.cgi?id=157823
+
+        Reviewed by Alex Christensen.
+
+        * Storage/WebDatabaseManager.mm:
+        (-[WebDatabaseManager deleteAllIndexedDatabases]):
+        * Storage/WebDatabaseManagerPrivate.h:
+
 2016-05-17  Beth Dakin  <[email protected]>
 
         Make handleAcceptedCandidate a public function

Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm (201080 => 201081)


--- trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm	2016-05-18 16:30:30 UTC (rev 201081)
@@ -36,6 +36,10 @@
 #import <WebCore/SecurityOrigin.h>
 #import <wtf/NeverDestroyed.h>
 
+#if ENABLE(INDEXED_DATABASE)
+#import "WebDatabaseProvider.h"
+#endif
+
 #if PLATFORM(IOS)
 #import "WebDatabaseManagerInternal.h"
 #import <WebCore/DatabaseTracker.h>
@@ -151,6 +155,14 @@
     return DatabaseManager::singleton().deleteDatabase([origin _core], databaseIdentifier);
 }
 
+// For DumpRenderTree support only
+- (void)deleteAllIndexedDatabases
+{
+#if ENABLE(INDEXED_DATABASE)
+    WebDatabaseProvider::singleton().deleteAllDatabases();
+#endif
+}
+
 #if PLATFORM(IOS)
 static bool isFileHidden(NSString *file)
 {

Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManagerPrivate.h (201080 => 201081)


--- trunk/Source/WebKit/mac/Storage/WebDatabaseManagerPrivate.h	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManagerPrivate.h	2016-05-18 16:30:30 UTC (rev 201081)
@@ -68,6 +68,9 @@
 - (BOOL)deleteOrigin:(WebSecurityOrigin *)origin;
 - (BOOL)deleteDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin;
 
+// For DumpRenderTree support only
+- (void)deleteAllIndexedDatabases;
+
 #if TARGET_OS_IPHONE
 + (void)scheduleEmptyDatabaseRemoval;
 #endif

Modified: trunk/Source/WebKit2/CMakeLists.txt (201080 => 201081)


--- trunk/Source/WebKit2/CMakeLists.txt	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit2/CMakeLists.txt	2016-05-18 16:30:30 UTC (rev 201081)
@@ -462,6 +462,7 @@
     UIProcess/API/C/WKUserMediaPermissionRequest.cpp
     UIProcess/API/C/WKVibration.cpp
     UIProcess/API/C/WKViewportAttributes.cpp
+    UIProcess/API/C/WKWebsiteDataStoreRef.cpp
     UIProcess/API/C/WKWindowFeaturesRef.cpp
 
     UIProcess/Authentication/AuthenticationChallengeProxy.cpp

Modified: trunk/Source/WebKit2/ChangeLog (201080 => 201081)


--- trunk/Source/WebKit2/ChangeLog	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-18 16:30:30 UTC (rev 201081)
@@ -1,3 +1,15 @@
+2016-05-18  Brady Eidson  <[email protected]>
+
+        Modern IDB: Make TestRunner.clearAllDatabases also delete IndexedDB databases (once doing so is supported).
+        https://bugs.webkit.org/show_bug.cgi?id=157823
+
+        Reviewed by Alex Christensen.
+
+        * CMakeLists.txt:
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreRemoveAllIndexedDatabases):
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+
 2016-05-18  Brian Burg  <[email protected]>
 
         REGRESSION(r200959): "Start Timeline Recording" menu item doesn't start recording

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (201080 => 201081)


--- trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp	2016-05-18 16:30:30 UTC (rev 201081)
@@ -28,6 +28,7 @@
 
 #include "APIWebsiteDataStore.h"
 #include "WKAPICast.h"
+#include "WebsiteDataType.h"
 
 WKTypeID WKWebsiteDataStoreGetTypeID()
 {
@@ -54,3 +55,8 @@
     return WebKit::toImpl(dataStoreRef)->resourceLoadStatisticsEnabled();
 }
 
+void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef)
+{
+    OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::IndexedDBDatabases;
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::time_point::min(), [] { });
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.h (201080 => 201081)


--- trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.h	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.h	2016-05-18 16:30:30 UTC (rev 201081)
@@ -39,6 +39,7 @@
 
 WK_EXPORT bool WKWebsiteDataStoreGetResourceLoadStatisticsEnabled(WKWebsiteDataStoreRef dataStoreRef);
 WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(WKWebsiteDataStoreRef dataStoreRef, bool enable);
+WK_EXPORT void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef);
 
 #ifdef __cplusplus
 }

Modified: trunk/Tools/ChangeLog (201080 => 201081)


--- trunk/Tools/ChangeLog	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Tools/ChangeLog	2016-05-18 16:30:30 UTC (rev 201081)
@@ -1,3 +1,19 @@
+2016-05-18  Brady Eidson  <[email protected]>
+
+        Modern IDB: Make TestRunner.clearAllDatabases also delete IndexedDB databases (once doing so is supported).
+        https://bugs.webkit.org/show_bug.cgi?id=157823
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::clearAllDatabases):
+        
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::clearAllDatabases):
+        
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
 2016-05-18  Joanmarie Diggs  <[email protected]>
 
         AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject name and description

Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (201080 => 201081)


--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2016-05-18 16:30:30 UTC (rev 201081)
@@ -197,6 +197,7 @@
 void TestRunner::clearAllDatabases()
 {
     [[WebDatabaseManager sharedWebDatabaseManager] deleteAllDatabases];
+    [[WebDatabaseManager sharedWebDatabaseManager] deleteAllIndexedDatabases];
 }
 
 void TestRunner::setStorageDatabaseIdleInterval(double interval)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (201080 => 201081)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-05-18 16:30:30 UTC (rev 201081)
@@ -252,6 +252,11 @@
 void TestRunner::clearAllDatabases()
 {
     WKBundleClearAllDatabases(InjectedBundle::singleton().bundle());
+
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("DeleteAllIndexedDatabases"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(true));
+
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
 }
 
 void TestRunner::setDatabaseQuota(uint64_t quota)
@@ -683,7 +688,7 @@
 
     WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(accept));
 
-    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), 0);
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
 }
 
 double TestRunner::preciseTime()

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (201080 => 201081)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-05-18 15:22:37 UTC (rev 201080)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-05-18 16:30:30 UTC (rev 201081)
@@ -38,6 +38,7 @@
 #include <WebKit/WKInspector.h>
 #include <WebKit/WKPagePrivate.h>
 #include <WebKit/WKRetainPtr.h>
+#include <WebKit/WKWebsiteDataStoreRef.h>
 #include <climits>
 #include <cstdio>
 #include <wtf/StdLibExtras.h>
@@ -714,6 +715,11 @@
         return result;
     }
     
+    if (WKStringIsEqualToUTF8CString(messageName, "DeleteAllIndexedDatabases")) {
+        WKWebsiteDataStoreRemoveAllIndexedDatabases(WKContextGetWebsiteDataStore(TestController::singleton().context()));
+        return nullptr;
+    }
+
     ASSERT_NOT_REACHED();
     return nullptr;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to