Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,3 +1,19 @@
+2020-06-16 Darryl Pogue <[email protected]>
+
+ IndexedDB: Support IDBFactory databases method
+ https://bugs.webkit.org/show_bug.cgi?id=211043
+
+ Reviewed by Youenn Fablet.
+
+ Adjust test expectations for `IDBFactory.prototype.databases()`.
+
+ * web-platform-tests/IndexedDB/get-databases.any-expected.txt:
+ * web-platform-tests/IndexedDB/get-databases.any.worker-expected.txt:
+ * web-platform-tests/IndexedDB/idbfactory-databases-opaque-origin-expected.txt:
+ * web-platform-tests/IndexedDB/idbfactory-origin-isolation-expected.txt:
+ * web-platform-tests/IndexedDB/idlharness.any-expected.txt:
+ * web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt:
+
2020-06-15 Tetsuharu Ohzeki <[email protected]>
Update WPT tests for FileAPI
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/get-databases.any-expected.txt (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/get-databases.any-expected.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/get-databases.any-expected.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,7 +1,7 @@
-FAIL Ensure that databases() returns a promise. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Enumerate one database. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Enumerate multiple databases. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Make sure an empty list is returned for the case of no databases. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Ensure that databases() doesn't pick up changes that haven't commited. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
+PASS Ensure that databases() returns a promise.
+PASS Enumerate one database.
+PASS Enumerate multiple databases.
+PASS Make sure an empty list is returned for the case of no databases.
+FAIL Ensure that databases() doesn't pick up changes that haven't commited. assert_equals: The result of databases() should be only those databases which have been created at the time of calling, regardless of versionchange transactions currently running. expected 1 but got 2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/get-databases.any.worker-expected.txt (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/get-databases.any.worker-expected.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/get-databases.any.worker-expected.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,7 +1,7 @@
-FAIL Ensure that databases() returns a promise. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Enumerate one database. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Enumerate multiple databases. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Make sure an empty list is returned for the case of no databases. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
-FAIL Ensure that databases() doesn't pick up changes that haven't commited. promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
+PASS Ensure that databases() returns a promise.
+PASS Enumerate one database.
+PASS Enumerate multiple databases.
+PASS Make sure an empty list is returned for the case of no databases.
+FAIL Ensure that databases() doesn't pick up changes that haven't commited. assert_equals: The result of databases() should be only those databases which have been created at the time of calling, regardless of versionchange transactions currently running. expected 1 but got 2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory-databases-opaque-origin-expected.txt (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory-databases-opaque-origin-expected.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory-databases-opaque-origin-expected.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,4 +1,4 @@
-FAIL IDBFactory.databases() in non-sandboxed iframe should not reject assert_equals: IDBFactory.databases() should not reject expected "no exception" but got "indexedDB.databases undefined"
-FAIL IDBFactory.databases() in sandboxed iframe should reject assert_equals: Promise should be rejected with SecurityError expected "SecurityError" but got "indexedDB.databases undefined"
+PASS IDBFactory.databases() in non-sandboxed iframe should not reject
+PASS IDBFactory.databases() in sandboxed iframe should reject
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory-origin-isolation-expected.txt (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory-origin-isolation-expected.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory-origin-isolation-expected.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,3 +1,3 @@
-FAIL Test to make sure that origins have separate locking schemes promise_test: Unhandled rejection with value: object "TypeError: indexedDB.databases is not a function. (In 'indexedDB.databases()', 'indexedDB.databases' is undefined)"
+PASS Test to make sure that origins have separate locking schemes
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any-expected.txt (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any-expected.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any-expected.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -52,7 +52,7 @@
PASS IDBFactory interface: existence and properties of interface prototype object's @@unscopables property
PASS IDBFactory interface: operation open(DOMString, optional unsigned long long)
PASS IDBFactory interface: operation deleteDatabase(DOMString)
-FAIL IDBFactory interface: operation databases() assert_own_property: interface prototype object missing non-static operation expected property "databases" missing
+PASS IDBFactory interface: operation databases()
PASS IDBFactory interface: operation cmp(any, any)
PASS IDBFactory must be primary interface of [object IDBFactory]
PASS Stringification of [object IDBFactory]
@@ -60,7 +60,7 @@
PASS IDBFactory interface: calling open(DOMString, optional unsigned long long) on [object IDBFactory] with too few arguments must throw TypeError
PASS IDBFactory interface: [object IDBFactory] must inherit property "deleteDatabase(DOMString)" with the proper type
PASS IDBFactory interface: calling deleteDatabase(DOMString) on [object IDBFactory] with too few arguments must throw TypeError
-FAIL IDBFactory interface: [object IDBFactory] must inherit property "databases()" with the proper type assert_inherits: property "databases" not found in prototype chain
+PASS IDBFactory interface: [object IDBFactory] must inherit property "databases()" with the proper type
PASS IDBFactory interface: [object IDBFactory] must inherit property "cmp(any, any)" with the proper type
PASS IDBFactory interface: calling cmp(any, any) on [object IDBFactory] with too few arguments must throw TypeError
PASS IDBDatabase interface: existence and properties of interface object
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt (263078 => 263079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idlharness.any.worker-expected.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -52,7 +52,7 @@
PASS IDBFactory interface: existence and properties of interface prototype object's @@unscopables property
PASS IDBFactory interface: operation open(DOMString, optional unsigned long long)
PASS IDBFactory interface: operation deleteDatabase(DOMString)
-FAIL IDBFactory interface: operation databases() assert_own_property: interface prototype object missing non-static operation expected property "databases" missing
+PASS IDBFactory interface: operation databases()
PASS IDBFactory interface: operation cmp(any, any)
PASS IDBFactory must be primary interface of [object IDBFactory]
PASS Stringification of [object IDBFactory]
@@ -60,7 +60,7 @@
PASS IDBFactory interface: calling open(DOMString, optional unsigned long long) on [object IDBFactory] with too few arguments must throw TypeError
PASS IDBFactory interface: [object IDBFactory] must inherit property "deleteDatabase(DOMString)" with the proper type
PASS IDBFactory interface: calling deleteDatabase(DOMString) on [object IDBFactory] with too few arguments must throw TypeError
-FAIL IDBFactory interface: [object IDBFactory] must inherit property "databases()" with the proper type assert_inherits: property "databases" not found in prototype chain
+PASS IDBFactory interface: [object IDBFactory] must inherit property "databases()" with the proper type
PASS IDBFactory interface: [object IDBFactory] must inherit property "cmp(any, any)" with the proper type
PASS IDBFactory interface: calling cmp(any, any) on [object IDBFactory] with too few arguments must throw TypeError
PASS IDBDatabase interface: existence and properties of interface object
Modified: trunk/Source/WebCore/ChangeLog (263078 => 263079)
--- trunk/Source/WebCore/ChangeLog 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/ChangeLog 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,3 +1,70 @@
+2020-06-16 Darryl Pogue <[email protected]>
+
+ IndexedDB: Support IDBFactory databases method
+ https://bugs.webkit.org/show_bug.cgi?id=211043
+
+ Reviewed by Youenn Fablet.
+
+ Add support for fetching the list of IDB database names and versions
+ from the IDBServer, and expose the functionality as
+ `IDBFactory.prototype.databases()`.
+
+ Spec: https://w3c.github.io/IndexedDB/#dom-idbfactory-databases
+
+ * Headers.cmake:
+ * Modules/indexeddb/IDBActiveDOMObject.h:
+ (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
+ * Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp: Added.
+ (WebCore::IDBDatabaseNameAndVersionRequest::create):
+ (WebCore::IDBDatabaseNameAndVersionRequest::IDBDatabaseNameAndVersionRequest):
+ (WebCore::IDBDatabaseNameAndVersionRequest::~IDBDatabaseNameAndVersionRequest):
+ (WebCore::IDBDatabaseNameAndVersionRequest::complete):
+ (WebCore::IDBDatabaseNameAndVersionRequest::activeDOMObjectName const):
+ (WebCore::IDBDatabaseNameAndVersionRequest::virtualHasPendingActivity const):
+ (WebCore::IDBDatabaseNameAndVersionRequest::stop):
+ * Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h: Added.
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::databases):
+ (WebCore::IDBFactory::getAllDatabaseNames):
+ * Modules/indexeddb/IDBFactory.h:
+ * Modules/indexeddb/IDBFactory.idl:
+ * Modules/indexeddb/client/IDBConnectionProxy.cpp:
+ (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost):
+ (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions):
+ (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions):
+ (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread):
+ (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNames): Deleted.
+ * Modules/indexeddb/client/IDBConnectionProxy.h:
+ * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+ (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNamesAndVersions):
+ (WebCore::IDBClient::IDBConnectionToServer::didGetAllDatabaseNamesAndVersions):
+ (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames): Deleted.
+ (WebCore::IDBClient::IDBConnectionToServer::didGetAllDatabaseNames): Deleted.
+ * Modules/indexeddb/client/IDBConnectionToServer.h:
+ * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+ * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+ (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNamesAndVersions):
+ (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames): Deleted.
+ * Modules/indexeddb/server/IDBConnectionToClient.h:
+ * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+ * Modules/indexeddb/server/IDBServer.cpp:
+ (WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions):
+ (WebCore::IDBServer::IDBServer::getAllDatabaseNames): Deleted.
+ * Modules/indexeddb/server/IDBServer.h:
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile): Deleted.
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
+ * Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h: Added.
+ (WebCore::IDBDatabaseNameAndVersion::encode const):
+ (WebCore::IDBDatabaseNameAndVersion::decode):
+ (WebCore::IDBDatabaseNameAndVersion::isolatedCopy const):
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/agents/InspectorIndexedDBAgent.cpp:
+ (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
+ * loader/EmptyClients.cpp:
+
2020-06-15 ChangSeok Oh <[email protected]>
[GTK] Rename GC3D to GCGL.
Modified: trunk/Source/WebCore/Headers.cmake (263078 => 263079)
--- trunk/Source/WebCore/Headers.cmake 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Headers.cmake 2020-06-16 07:27:14 UTC (rev 263079)
@@ -40,6 +40,7 @@
Modules/indexeddb/IDBActiveDOMObject.h
Modules/indexeddb/IDBDatabaseIdentifier.h
+ Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h
Modules/indexeddb/IDBGetAllResult.h
Modules/indexeddb/IDBGetResult.h
Modules/indexeddb/IDBKey.h
@@ -72,6 +73,7 @@
Modules/indexeddb/shared/IDBCursorInfo.h
Modules/indexeddb/shared/IDBCursorRecord.h
Modules/indexeddb/shared/IDBDatabaseInfo.h
+ Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h
Modules/indexeddb/shared/IDBError.h
Modules/indexeddb/shared/IDBGetAllRecordsData.h
Modules/indexeddb/shared/IDBGetRecordData.h
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBActiveDOMObject.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/IDBActiveDOMObject.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBActiveDOMObject.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -50,7 +50,7 @@
ASSERT(&originThread() == &object.originThread());
if (canCurrentThreadAccessThreadLocalData(object.originThread())) {
- (object.*method)(arguments...);
+ (object.*method)(std::forward<Arguments>(arguments)...);
return;
}
Added: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp (0 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2020 Darryl Pogue ([email protected])
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBDatabaseNameAndVersionRequest.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBConnectionProxy.h"
+#include "ScriptExecutionContext.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(IDBDatabaseNameAndVersionRequest);
+
+Ref<IDBDatabaseNameAndVersionRequest> IDBDatabaseNameAndVersionRequest::create(ScriptExecutionContext& context, IDBClient::IDBConnectionProxy& connectionProxy, InfoCallback&& callback)
+{
+ return adoptRef(*new IDBDatabaseNameAndVersionRequest(context, connectionProxy, WTFMove(callback)));
+}
+
+IDBDatabaseNameAndVersionRequest::IDBDatabaseNameAndVersionRequest(ScriptExecutionContext& context, IDBClient::IDBConnectionProxy& connectionProxy, InfoCallback&& callback)
+ : IDBActiveDOMObject(&context)
+ , m_connectionProxy(connectionProxy)
+ , m_resourceIdentifier(connectionProxy)
+ , m_callback(WTFMove(callback))
+{
+ ASSERT(canCurrentThreadAccessThreadLocalData(originThread()));
+
+ suspendIfNeeded();
+}
+
+IDBDatabaseNameAndVersionRequest::~IDBDatabaseNameAndVersionRequest()
+{
+ ASSERT(canCurrentThreadAccessThreadLocalData(originThread()));
+}
+
+void IDBDatabaseNameAndVersionRequest::complete(Optional<Vector<IDBDatabaseNameAndVersion>>&& databases)
+{
+ ASSERT(canCurrentThreadAccessThreadLocalData(originThread()));
+
+ if (auto callback = WTFMove(m_callback))
+ callback(WTFMove(databases));
+}
+
+const char* IDBDatabaseNameAndVersionRequest::activeDOMObjectName() const
+{
+ ASSERT(canCurrentThreadAccessThreadLocalData(originThread()));
+ return "IDBDatabaseNameAndVersionRequest";
+}
+
+bool IDBDatabaseNameAndVersionRequest::virtualHasPendingActivity() const
+{
+ ASSERT(canCurrentThreadAccessThreadLocalData(originThread()) || Thread::mayBeGCThread());
+ return true;
+}
+
+void IDBDatabaseNameAndVersionRequest::stop()
+{
+ ASSERT(canCurrentThreadAccessThreadLocalData(originThread()));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
Copied: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h (from rev 263078, trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h) (0 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseNameAndVersionRequest.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2020 Darryl Pogue ([email protected])
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBActiveDOMObject.h"
+#include "IDBDatabaseNameAndVersion.h"
+#include "IDBResourceIdentifier.h"
+#include <wtf/Forward.h>
+#include <wtf/Function.h>
+#include <wtf/IsoMalloc.h>
+#include <wtf/Ref.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+
+namespace IDBClient {
+class IDBConnectionProxy;
+}
+
+class IDBDatabaseNameAndVersionRequest final : public ThreadSafeRefCounted<IDBDatabaseNameAndVersionRequest>, public IDBActiveDOMObject {
+ WTF_MAKE_ISO_ALLOCATED(IDBDatabaseNameAndVersionRequest);
+public:
+ using InfoCallback = Function<void(Optional<Vector<IDBDatabaseNameAndVersion>>&&)>;
+
+ static Ref<IDBDatabaseNameAndVersionRequest> create(ScriptExecutionContext&, IDBClient::IDBConnectionProxy&, InfoCallback&&);
+
+ ~IDBDatabaseNameAndVersionRequest();
+
+ const IDBResourceIdentifier& resourceIdentifier() const { return m_resourceIdentifier; }
+
+ using ThreadSafeRefCounted<IDBDatabaseNameAndVersionRequest>::ref;
+ using ThreadSafeRefCounted<IDBDatabaseNameAndVersionRequest>::deref;
+
+ void complete(Optional<Vector<IDBDatabaseNameAndVersion>>&&);
+
+private:
+ IDBDatabaseNameAndVersionRequest(ScriptExecutionContext&, IDBClient::IDBConnectionProxy&, InfoCallback&&);
+
+ // ActiveDOMObject.
+ bool virtualHasPendingActivity() const final;
+ const char* activeDOMObjectName() const final;
+ void stop() final;
+
+ Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
+ IDBResourceIdentifier m_resourceIdentifier;
+ InfoCallback m_callback;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -34,10 +34,10 @@
#include "IDBDatabaseIdentifier.h"
#include "IDBKey.h"
#include "IDBOpenDBRequest.h"
+#include "JSIDBFactory.h"
#include "Logging.h"
#include "Page.h"
#include "ScriptExecutionContext.h"
-#include "SecurityOrigin.h"
namespace WebCore {
@@ -133,11 +133,43 @@
return first->compare(second.get());
}
-void IDBFactory::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, Function<void (const Vector<String>&)>&& callback)
+void IDBFactory::databases(ScriptExecutionContext& context, IDBDatabasesResponsePromise&& promise)
{
- m_connectionProxy->getAllDatabaseNames(mainFrameOrigin, openingOrigin, WTFMove(callback));
+ LOG(IndexedDB, "IDBFactory::databases");
+
+ if (shouldThrowSecurityException(context)) {
+ promise.reject(SecurityError);
+ return;
+ }
+
+ ASSERT(context.securityOrigin());
+
+ m_connectionProxy->getAllDatabaseNamesAndVersions(context, [promise = WTFMove(promise)](auto&& result) mutable {
+ if (!result) {
+ promise.reject(Exception { UnknownError });
+ return;
+ }
+
+ promise.resolve(WTF::map(*result, [](auto&& info) {
+ return IDBFactory::DatabaseInfo { WTFMove(info.name), info.version };
+ }));
+ });
}
+void IDBFactory::getAllDatabaseNames(ScriptExecutionContext& context, Function<void(const Vector<String>&)>&& callback)
+{
+ m_connectionProxy->getAllDatabaseNamesAndVersions(context, [callback = WTFMove(callback)](auto&& result) mutable {
+ if (!result) {
+ callback({ });
+ return;
+ }
+
+ callback(WTF::map(*result, [](auto&& info) {
+ return WTFMove(info.name);
+ }));
+ });
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "ExceptionOr.h"
+#include "JSDOMPromiseDeferred.h"
#include <wtf/Function.h>
#include <wtf/Forward.h>
#include <wtf/Ref.h>
@@ -54,13 +55,22 @@
static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&);
~IDBFactory();
+ struct DatabaseInfo {
+ String name;
+ uint64_t version;
+ };
+
ExceptionOr<Ref<IDBOpenDBRequest>> open(ScriptExecutionContext&, const String& name, Optional<uint64_t> version);
ExceptionOr<Ref<IDBOpenDBRequest>> deleteDatabase(ScriptExecutionContext&, const String& name);
ExceptionOr<short> cmp(JSC::JSGlobalObject&, JSC::JSValue first, JSC::JSValue second);
- WEBCORE_EXPORT void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&);
+ using IDBDatabasesResponsePromise = DOMPromiseDeferred<IDLSequence<IDLDictionary<IDBFactory::DatabaseInfo>>>;
+ void databases(ScriptExecutionContext&, IDBDatabasesResponsePromise&&);
+
+ WEBCORE_EXPORT void getAllDatabaseNames(ScriptExecutionContext&, Function<void(const Vector<String>&)>&&);
+
private:
explicit IDBFactory(IDBClient::IDBConnectionProxy&);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl 2020-06-16 07:27:14 UTC (rev 263079)
@@ -29,5 +29,14 @@
] interface IDBFactory {
[CallWith=ScriptExecutionContext, MayThrowException] IDBOpenDBRequest open(DOMString name, optional [EnforceRange] unsigned long long version);
[CallWith=ScriptExecutionContext, MayThrowException] IDBOpenDBRequest deleteDatabase(DOMString name);
+ [CallWith=ScriptExecutionContext] Promise<sequence<IDBDatabaseInfo>> databases();
[CallWith=GlobalObject, MayThrowException] short cmp(any first, any second);
};
+
+[
+ Conditional=INDEXED_DATABASE,
+ JSGenerateToJSObject,
+] dictionary IDBDatabaseInfo {
+ DOMString name;
+ unsigned long long version;
+};
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -30,6 +30,8 @@
#include "IDBCursorInfo.h"
#include "IDBDatabase.h"
+#include "IDBDatabaseNameAndVersion.h"
+#include "IDBDatabaseNameAndVersionRequest.h"
#include "IDBGetRecordData.h"
#include "IDBIterateCursorData.h"
#include "IDBKeyRangeData.h"
@@ -469,6 +471,15 @@
auto result = IDBResultData::error(requestIdentifier, error);
request->performCallbackOnOriginThread(*request, &IDBOpenDBRequest::requestCompleted, result);
}
+
+ Vector<IDBResourceIdentifier> infoCallbackIdentifiers;
+ {
+ Locker<Lock> lock(m_databaseInfoMapLock);
+ infoCallbackIdentifiers = copyToVector(m_databaseInfoCallbacks.keys());
+ }
+
+ for (auto& requestIdentifier : infoCallbackIdentifiers)
+ didGetAllDatabaseNamesAndVersions(requestIdentifier, { });
}
void IDBConnectionProxy::scheduleMainThreadTasks()
@@ -496,14 +507,38 @@
task->performTask();
}
-void IDBConnectionProxy::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, Function<void (const Vector<String>&)>&& callback)
+void IDBConnectionProxy::getAllDatabaseNamesAndVersions(ScriptExecutionContext& context, Function<void(Optional<Vector<IDBDatabaseNameAndVersion>>&&)>&& callback)
{
- // This method is only meant to be called by the web inspector on the main thread.
- RELEASE_ASSERT(isMainThread());
+ ClientOrigin origin { context.securityOrigin()->data(), context.topOrigin().data() };
- m_connectionToServer.getAllDatabaseNames(mainFrameOrigin, openingOrigin, WTFMove(callback));
+ IDBDatabaseNameAndVersionRequest* request;
+ {
+ Locker<Lock> locker(m_databaseInfoMapLock);
+ auto newRequest = IDBDatabaseNameAndVersionRequest::create(context, *this, WTFMove(callback));
+ ASSERT(!m_databaseInfoCallbacks.contains(newRequest->resourceIdentifier()));
+ request = newRequest.ptr();
+ m_databaseInfoCallbacks.add(newRequest->resourceIdentifier(), WTFMove(newRequest));
+ }
+
+ callConnectionOnMainThread(&IDBConnectionToServer::getAllDatabaseNamesAndVersions, request->resourceIdentifier(), origin);
}
+void IDBConnectionProxy::didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier& requestIdentifier, Optional<Vector<IDBDatabaseNameAndVersion>>&& databases)
+{
+ RefPtr<IDBDatabaseNameAndVersionRequest> request;
+ {
+ Locker<Lock> locker(m_databaseInfoMapLock);
+ auto takenRequest = m_databaseInfoCallbacks.take(requestIdentifier);
+
+ if (!takenRequest)
+ return;
+
+ request = WTFMove(*takenRequest);
+ }
+
+ request->performCallbackOnOriginThread(*request, &IDBDatabaseNameAndVersionRequest::complete, WTFMove(databases));
+}
+
void IDBConnectionProxy::registerDatabaseConnection(IDBDatabase& database)
{
Locker<Lock> locker(m_databaseConnectionMapLock);
@@ -596,6 +631,10 @@
Locker<Lock> lock(m_transactionOperationLock);
removeItemsMatchingCurrentThread(m_activeOperations);
}
+ {
+ Locker<Lock> lock(m_databaseInfoMapLock);
+ removeItemsMatchingCurrentThread(m_databaseInfoCallbacks);
+ }
}
void IDBConnectionProxy::setContextSuspended(ScriptExecutionContext& currentContext, bool isContextSuspended)
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBConnectionToServer.h"
+#include "IDBDatabaseNameAndVersionRequest.h"
#include "IDBResourceIdentifier.h"
#include "TransactionOperation.h"
#include <wtf/CrossThreadQueue.h>
@@ -115,7 +116,8 @@
void ref();
void deref();
- void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&);
+ void getAllDatabaseNamesAndVersions(ScriptExecutionContext&, Function<void(Optional<Vector<IDBDatabaseNameAndVersion>>&&)>&&);
+ void didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, Optional<Vector<IDBDatabaseNameAndVersion>>&&);
void registerDatabaseConnection(IDBDatabase&);
void unregisterDatabaseConnection(IDBDatabase&);
@@ -169,6 +171,9 @@
HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_activeOperations;
Lock m_transactionOperationLock;
+ HashMap<IDBResourceIdentifier, Ref<IDBDatabaseNameAndVersionRequest>> m_databaseInfoCallbacks;
+ Lock m_databaseInfoMapLock;
+
CrossThreadQueue<CrossThreadTask> m_mainThreadQueue;
Lock m_mainThreadTaskLock;
RefPtr<IDBConnectionToServer> m_mainThreadProtector;
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -30,6 +30,7 @@
#include "IDBConnectionProxy.h"
#include "IDBDatabase.h"
+#include "IDBDatabaseNameAndVersion.h"
#include "IDBGetRecordData.h"
#include "IDBKeyRangeData.h"
#include "IDBOpenDBRequest.h"
@@ -494,27 +495,27 @@
m_delegate->abortOpenAndUpgradeNeeded(databaseConnectionIdentifier, transactionIdentifier);
}
-void IDBConnectionToServer::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, Function<void (const Vector<String>&)>&& callback)
+void IDBConnectionToServer::getAllDatabaseNamesAndVersions(const IDBResourceIdentifier& requestIdentifier, const ClientOrigin& origin)
{
- static uint64_t callbackID = 0;
+ LOG(IndexedDB, "IDBConnectionToServer::getAllDatabaseNamesAndVersions");
+ ASSERT(isMainThread());
- m_getAllDatabaseNamesCallbacks.add(++callbackID, WTFMove(callback));
+ if (m_serverConnectionIsValid) {
+ m_delegate->getAllDatabaseNamesAndVersions(requestIdentifier, origin);
+ return;
+ }
- if (m_serverConnectionIsValid)
- m_delegate->getAllDatabaseNames(mainFrameOrigin.data(), openingOrigin.data(), callbackID);
- else {
- callOnMainThread([this, protectedThis = makeRef(*this), callbackID = callbackID] {
- didGetAllDatabaseNames(callbackID, { });
- });
- }
+ callOnMainThread([this, protectedThis = makeRef(*this), requestIdentifier] {
+ didGetAllDatabaseNamesAndVersions(requestIdentifier, { });
+ });
}
-void IDBConnectionToServer::didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames)
+void IDBConnectionToServer::didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier& requestIdentifier, Vector<IDBDatabaseNameAndVersion>&& databases)
{
- auto callback = m_getAllDatabaseNamesCallbacks.take(callbackID);
- ASSERT(callback);
+ LOG(IndexedDB, "IDBConnectionToServer::didGetAllDatabaseNamesAndVersions");
+ ASSERT(isMainThread());
- callback(databaseNames);
+ m_proxy->didGetAllDatabaseNamesAndVersions(requestIdentifier, WTFMove(databases));
}
} // namespace IDBClient
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -45,6 +45,8 @@
class IDBValue;
class SecurityOrigin;
+struct ClientOrigin;
+struct IDBDatabaseNameAndVersion;
struct IDBGetAllRecordsData;
struct IDBGetRecordData;
struct IDBIterateCursorData;
@@ -136,8 +138,8 @@
// versionchange transaction, but the page is already torn down.
void abortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& transactionIdentifier);
- void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&);
- WEBCORE_EXPORT void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames);
+ void getAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, const ClientOrigin&);
+ WEBCORE_EXPORT void didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, Vector<IDBDatabaseNameAndVersion>&&);
private:
IDBConnectionToServer(IDBConnectionToServerDelegate&);
@@ -144,12 +146,10 @@
typedef void (IDBConnectionToServer::*ResultFunction)(const IDBResultData&);
void callResultFunctionWithErrorLater(ResultFunction, const IDBResourceIdentifier& requestIdentifier);
-
+
WeakPtr<IDBConnectionToServerDelegate> m_delegate;
bool m_serverConnectionIsValid { true };
- HashMap<uint64_t, WTF::Function<void (const Vector<String>&)>> m_getAllDatabaseNamesCallbacks;
-
std::unique_ptr<IDBConnectionProxy> m_proxy;
};
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -41,6 +41,7 @@
class IDBTransactionInfo;
class IDBValue;
+struct ClientOrigin;
struct IDBGetAllRecordsData;
struct IDBGetRecordData;
struct IDBIterateCursorData;
@@ -87,7 +88,7 @@
virtual void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, const IndexedDB::ConnectionClosedOnBehalfOfServer) = 0;
virtual void openDBRequestCancelled(const IDBRequestData&) = 0;
- virtual void getAllDatabaseNames(const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID) = 0;
+ virtual void getAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, const ClientOrigin&) = 0;
};
} // namespace IDBClient
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "IDBDatabaseNameAndVersion.h"
#include "UniqueIDBDatabaseConnection.h"
namespace WebCore {
@@ -181,10 +182,10 @@
m_delegate->notifyOpenDBRequestBlocked(requestIdentifier, oldVersion, newVersion);
}
-void IDBConnectionToClient::didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames)
+void IDBConnectionToClient::didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier& requestIdentifier, Vector<IDBDatabaseNameAndVersion>&& databases)
{
if (m_delegate)
- m_delegate->didGetAllDatabaseNames(callbackID, databaseNames);
+ m_delegate->didGetAllDatabaseNamesAndVersions(requestIdentifier, WTFMove(databases));
}
void IDBConnectionToClient::registerDatabaseConnection(UniqueIDBDatabaseConnection& connection)
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -39,6 +39,8 @@
class IDBResourceIdentifier;
class IDBResultData;
+struct IDBDatabaseNameAndVersion;
+
namespace IDBServer {
class UniqueIDBDatabaseConnection;
@@ -74,7 +76,7 @@
void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion);
- void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames);
+ void didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, Vector<IDBDatabaseNameAndVersion>&&);
void registerDatabaseConnection(UniqueIDBDatabaseConnection&);
void unregisterDatabaseConnection(UniqueIDBDatabaseConnection&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -36,6 +36,8 @@
class IDBError;
class IDBResultData;
+struct IDBDatabaseNameAndVersion;
+
namespace IDBServer {
class UniqueIDBDatabaseConnection;
@@ -70,7 +72,7 @@
virtual void didCloseFromServer(UniqueIDBDatabaseConnection&, const IDBError&) = 0;
virtual void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) = 0;
- virtual void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) = 0;
+ virtual void didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, const Vector<IDBDatabaseNameAndVersion>&) = 0;
};
} // namespace IDBServer
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -507,26 +507,27 @@
m_uniqueIDBDatabaseMap.remove(uniqueIDBDatabase->identifier());
}
-void IDBServer::getAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
+void IDBServer::getAllDatabaseNamesAndVersions(IDBConnectionIdentifier serverConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, const ClientOrigin& origin)
{
ASSERT(!isMainThread());
ASSERT(m_lock.isHeld());
auto databaseDirectoryPath = this->databaseDirectoryPathIsolatedCopy();
- String oldDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(mainFrameOrigin, openingOrigin, databaseDirectoryPath, "v0");
+ String oldDirectory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(origin.topOrigin, origin.clientOrigin, databaseDirectoryPath, "v0");
Vector<String> files = FileSystem::listDirectory(oldDirectory, "*"_s);
- Vector<String> databases;
+ Vector<IDBDatabaseNameAndVersion> databases;
for (auto& file : files) {
- String encodedName = FileSystem::lastComponentOfPathIgnoringTrailingSlash(file);
- databases.append(SQLiteIDBBackingStore::databaseNameFromEncodedFilename(encodedName));
+ auto databaseTuple = SQLiteIDBBackingStore::databaseNameAndVersionFromFile(SQLiteIDBBackingStore::fullDatabasePathForDirectory(file));
+ if (databaseTuple)
+ databases.append(WTFMove(*databaseTuple));
}
- String directory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(mainFrameOrigin, openingOrigin, databaseDirectoryPath, "v1");
+ String directory = IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot(origin.topOrigin, origin.clientOrigin, databaseDirectoryPath, "v1");
files = FileSystem::listDirectory(directory, "*"_s);
for (auto& file : files) {
- auto databaseName = SQLiteIDBBackingStore::databaseNameFromFile(SQLiteIDBBackingStore::fullDatabasePathForDirectory(file));
- if (!databaseName.isEmpty())
- databases.append(databaseName);
+ auto databaseTuple = SQLiteIDBBackingStore::databaseNameAndVersionFromFile(SQLiteIDBBackingStore::fullDatabasePathForDirectory(file));
+ if (databaseTuple)
+ databases.append(WTFMove(*databaseTuple));
}
auto connection = m_connectionMap.get(serverConnectionIdentifier);
@@ -533,7 +534,7 @@
if (!connection)
return;
- connection->didGetAllDatabaseNames(callbackID, databases);
+ connection->didGetAllDatabaseNamesAndVersions(requestIdentifier, WTFMove(databases));
}
void IDBServer::closeAndDeleteDatabasesModifiedSince(WallTime modificationTime)
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -89,8 +89,9 @@
WEBCORE_EXPORT void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, IndexedDB::ConnectionClosedOnBehalfOfServer);
WEBCORE_EXPORT void openDBRequestCancelled(const IDBRequestData&);
- WEBCORE_EXPORT void getAllDatabaseNames(IDBConnectionIdentifier serverConnectionIdentifier, const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID);
+ WEBCORE_EXPORT void getAllDatabaseNamesAndVersions(IDBConnectionIdentifier, const IDBResourceIdentifier&, const ClientOrigin&);
+
void registerDatabaseConnection(UniqueIDBDatabaseConnection&);
void unregisterDatabaseConnection(UniqueIDBDatabaseConnection&);
void registerTransaction(UniqueIDBDatabaseTransaction&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -912,19 +912,31 @@
return fullDatabasePathForDirectory(m_databaseDirectory);
}
-String SQLiteIDBBackingStore::databaseNameFromFile(const String& databasePath)
+Optional<IDBDatabaseNameAndVersion> SQLiteIDBBackingStore::databaseNameAndVersionFromFile(const String& databasePath)
{
SQLiteDatabase database;
if (!database.open(databasePath)) {
LOG_ERROR("Failed to open SQLite database at path '%s' when getting database name", databasePath.utf8().data());
- return { };
+ return WTF::nullopt;
}
if (!database.tableExists("IDBDatabaseInfo"_s)) {
LOG_ERROR("Could not find IDBDatabaseInfo table and get database name(%i) - %s", database.lastError(), database.lastErrorMsg());
- return { };
+ return WTF::nullopt;
}
- SQLiteStatement sql(database, "SELECT value FROM IDBDatabaseInfo WHERE key = 'DatabaseName';");
- return sql.getColumnText(0);
+
+ SQLiteStatement namesql(database, "SELECT value FROM IDBDatabaseInfo WHERE key = 'DatabaseName';");
+ auto databaseName = namesql.getColumnText(0);
+
+ SQLiteStatement versql(database, "SELECT value FROM IDBDatabaseInfo WHERE key = 'DatabaseVersion';"_s);
+ String stringVersion = versql.getColumnText(0);
+ bool ok;
+ uint64_t databaseVersion = stringVersion.toUInt64Strict(&ok);
+ if (!ok) {
+ LOG_ERROR("Database version on disk ('%s') does not cleanly convert to an unsigned 64-bit integer version", stringVersion.utf8().data());
+ return WTF::nullopt;
+ }
+
+ return IDBDatabaseNameAndVersion { databaseName, databaseVersion };
}
String SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade()
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h (263078 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -30,6 +30,7 @@
#include "IDBBackingStore.h"
#include "IDBDatabaseIdentifier.h"
#include "IDBDatabaseInfo.h"
+#include "IDBDatabaseNameAndVersion.h"
#include "IDBResourceIdentifier.h"
#include "SQLiteIDBTransaction.h"
#include "SQLiteStatementAutoResetScope.h"
@@ -101,7 +102,7 @@
String databaseDirectory() const { return m_databaseDirectory; };
static String fullDatabasePathForDirectory(const String&);
- static String databaseNameFromFile(const String&);
+ static Optional<IDBDatabaseNameAndVersion> databaseNameAndVersionFromFile(const String&);
PAL::SessionID sessionID() const { return m_sessionID; }
Copied: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h (from rev 263078, trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h) (0 => 263079)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseNameAndVersion.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2020 Darryl Pogue ([email protected])
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct IDBDatabaseNameAndVersion {
+ String name;
+ uint64_t version { 0 };
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<IDBDatabaseNameAndVersion> decode(Decoder&);
+
+ IDBDatabaseNameAndVersion isolatedCopy() const;
+};
+
+template<class Encoder>
+void IDBDatabaseNameAndVersion::encode(Encoder& encoder) const
+{
+ encoder << name << version;
+}
+
+template<class Decoder>
+Optional<IDBDatabaseNameAndVersion> IDBDatabaseNameAndVersion::decode(Decoder& decoder)
+{
+ IDBDatabaseNameAndVersion info;
+
+ if (!decoder.decode(info.name))
+ return WTF::nullopt;
+
+ if (!decoder.decode(info.version))
+ return WTF::nullopt;
+
+ return info;
+}
+
+inline IDBDatabaseNameAndVersion IDBDatabaseNameAndVersion::isolatedCopy() const
+{
+ return { name.isolatedCopy(), version };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/Sources.txt (263078 => 263079)
--- trunk/Source/WebCore/Sources.txt 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/Sources.txt 2020-06-16 07:27:14 UTC (rev 263079)
@@ -88,6 +88,7 @@
Modules/indexeddb/IDBCursorWithValue.cpp
Modules/indexeddb/IDBDatabase.cpp
Modules/indexeddb/IDBDatabaseIdentifier.cpp
+Modules/indexeddb/IDBDatabaseNameAndVersionRequest.cpp
Modules/indexeddb/IDBFactory.cpp
Modules/indexeddb/IDBGetAllResult.cpp
Modules/indexeddb/IDBGetResult.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (263078 => 263079)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-06-16 07:27:14 UTC (rev 263079)
@@ -2584,6 +2584,8 @@
8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6756191288B17B0047ACA3 /* EventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
9001774112E0347800648462 /* OESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001773E12E0347800648462 /* OESStandardDerivatives.h */; };
9001788112E0370700648462 /* JSOESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001787F12E0370700648462 /* JSOESStandardDerivatives.h */; };
+ 9016EA4D2454D8130021D9D1 /* IDBDatabaseNameAndVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9016EA4C2454D8130021D9D1 /* IDBDatabaseNameAndVersion.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 90E351C2247E46E400FBF24F /* IDBDatabaseNameAndVersionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 90E351BD247E3D4800FBF24F /* IDBDatabaseNameAndVersionRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
9109E9C8222CABCA00BB6264 /* InspectorAuditResourcesObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9109E9C5222CABC800BB6264 /* InspectorAuditResourcesObject.h */; };
9109E9C8222CABCA00BB6265 /* JSInspectorAuditResourcesObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9109E9C5222CABC800BB6265 /* JSInspectorAuditResourcesObject.h */; };
91278D5E21DEDAD600B57184 /* PageAuditAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 91278D5C21DEDAD500B57184 /* PageAuditAgent.h */; };
@@ -10714,6 +10716,9 @@
9001773F12E0347800648462 /* OESStandardDerivatives.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OESStandardDerivatives.idl; sourceTree = "<group>"; };
9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESStandardDerivatives.cpp; sourceTree = "<group>"; };
9001787F12E0370700648462 /* JSOESStandardDerivatives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESStandardDerivatives.h; sourceTree = "<group>"; };
+ 9016EA4C2454D8130021D9D1 /* IDBDatabaseNameAndVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseNameAndVersion.h; sourceTree = "<group>"; };
+ 90E351BC247E3D4800FBF24F /* IDBDatabaseNameAndVersionRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBDatabaseNameAndVersionRequest.cpp; sourceTree = "<group>"; };
+ 90E351BD247E3D4800FBF24F /* IDBDatabaseNameAndVersionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseNameAndVersionRequest.h; sourceTree = "<group>"; };
9109E9C5222CABC800BB6264 /* InspectorAuditResourcesObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditResourcesObject.h; sourceTree = "<group>"; };
9109E9C5222CABC800BB6265 /* JSInspectorAuditResourcesObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorAuditResourcesObject.h; sourceTree = "<group>"; };
9109E9C7222CABC900BB6264 /* InspectorAuditResourcesObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditResourcesObject.cpp; sourceTree = "<group>"; };
@@ -19371,6 +19376,7 @@
5110FCFB1E0362A5006F8D0B /* IDBCursorRecord.h */,
51BA4AC11BBB5CBF00DF3D6D /* IDBDatabaseInfo.cpp */,
51BA4AC21BBB5CBF00DF3D6D /* IDBDatabaseInfo.h */,
+ 9016EA4C2454D8130021D9D1 /* IDBDatabaseNameAndVersion.h */,
5148453C1BB9D076006A72ED /* IDBError.cpp */,
5148453D1BB9D076006A72ED /* IDBError.h */,
519DBC6D1DC00FB900329BF5 /* IDBGetAllRecordsData.cpp */,
@@ -22847,6 +22853,8 @@
51D7197E181106DF0016DC51 /* IDBDatabase.idl */,
5103105E1BA8E090003329C0 /* IDBDatabaseIdentifier.cpp */,
5103105F1BA8E090003329C0 /* IDBDatabaseIdentifier.h */,
+ 90E351BC247E3D4800FBF24F /* IDBDatabaseNameAndVersionRequest.cpp */,
+ 90E351BD247E3D4800FBF24F /* IDBDatabaseNameAndVersionRequest.h */,
51645B461B9F889B00F789CE /* IDBFactory.cpp */,
51645B471B9F889B00F789CE /* IDBFactory.h */,
51D7198A181106DF0016DC51 /* IDBFactory.idl */,
@@ -30928,6 +30936,8 @@
5185FC811BB4C4E80012898F /* IDBDatabase.h in Headers */,
5185FC871BB4C4E80012898F /* IDBDatabaseIdentifier.h in Headers */,
51BA4AC41BBB5CD800DF3D6D /* IDBDatabaseInfo.h in Headers */,
+ 9016EA4D2454D8130021D9D1 /* IDBDatabaseNameAndVersion.h in Headers */,
+ 90E351C2247E46E400FBF24F /* IDBDatabaseNameAndVersionRequest.h in Headers */,
5148453F1BB9D07E006A72ED /* IDBError.h in Headers */,
5185FC8D1BB4C4E80012898F /* IDBFactory.h in Headers */,
519DBC6F1DC011A700329BF5 /* IDBGetAllRecordsData.h in Headers */,
Modified: trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp (263078 => 263079)
--- trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/inspector/agents/InspectorIndexedDBAgent.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -596,9 +596,7 @@
if (!getDocumentAndIDBFactoryFromFrameOrSendFailure(frame, document, idbFactory, callback))
return;
- auto& openingOrigin = document->securityOrigin();
- auto& topOrigin = document->topOrigin();
- idbFactory->getAllDatabaseNames(topOrigin, openingOrigin, [callback = WTFMove(callback)](auto& databaseNames) {
+ idbFactory->getAllDatabaseNames(*document, [callback = WTFMove(callback)](auto& databaseNames) {
if (!callback->isActive())
return;
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (263078 => 263079)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -152,7 +152,7 @@
void abortOpenAndUpgradeNeeded(uint64_t, const IDBResourceIdentifier&) final { }
void didFireVersionChangeEvent(uint64_t, const IDBResourceIdentifier&, const IndexedDB::ConnectionClosedOnBehalfOfServer) final { }
void openDBRequestCancelled(const IDBRequestData&) final { }
- void getAllDatabaseNames(const SecurityOriginData&, const SecurityOriginData&, uint64_t) final { }
+ void getAllDatabaseNamesAndVersions(const IDBResourceIdentifier&, const ClientOrigin&) final { }
~EmptyIDBConnectionToServerDeletegate() { }
};
Modified: trunk/Source/WebKit/ChangeLog (263078 => 263079)
--- trunk/Source/WebKit/ChangeLog 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/ChangeLog 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,3 +1,29 @@
+2020-06-16 Darryl Pogue <[email protected]>
+
+ IndexedDB: Support IDBFactory databases method
+ https://bugs.webkit.org/show_bug.cgi?id=211043
+
+ Reviewed by Youenn Fablet.
+
+ Plumbing for returning a list of IDB databases and versions.
+
+ * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
+ (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions):
+ (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted.
+ * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
+ * NetworkProcess/IndexedDB/WebIDBServer.cpp:
+ (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions):
+ (WebKit::WebIDBServer::getAllDatabaseNames): Deleted.
+ * NetworkProcess/IndexedDB/WebIDBServer.h:
+ * NetworkProcess/IndexedDB/WebIDBServer.messages.in:
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
+ (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions):
+ (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions):
+ (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted.
+ (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted.
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
+ * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
+
2020-06-15 Pavel Feldman <[email protected]>
Web Inspector: introduce request interception
Modified: trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp (263078 => 263079)
--- trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -193,9 +193,9 @@
send(Messages::WebIDBConnectionToServer::NotifyOpenDBRequestBlocked(requestIdentifier, oldVersion, newVersion));
}
-void WebIDBConnectionToClient::didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames)
+void WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier& requestIdentifier, const Vector<WebCore::IDBDatabaseNameAndVersion>& databases)
{
- send(Messages::WebIDBConnectionToServer::DidGetAllDatabaseNames(callbackID, databaseNames));
+ send(Messages::WebIDBConnectionToServer::DidGetAllDatabaseNamesAndVersions(requestIdentifier, databases));
}
} // namespace WebKit
Modified: trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.h (263078 => 263079)
--- trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBConnectionToClient.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -82,7 +82,7 @@
void didCloseFromServer(WebCore::IDBServer::UniqueIDBDatabaseConnection&, const WebCore::IDBError&) final;
void notifyOpenDBRequestBlocked(const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) final;
- void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) final;
+ void didGetAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier&, const Vector<WebCore::IDBDatabaseNameAndVersion>&) final;
template<class MessageType> void handleGetResult(const WebCore::IDBResultData&);
Modified: trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.cpp (263078 => 263079)
--- trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -315,7 +315,7 @@
m_server->openDBRequestCancelled(requestData);
}
-void WebIDBServer::getAllDatabaseNames(IPC::Connection& connection, const WebCore::SecurityOriginData& mainFrameOrigin, const WebCore::SecurityOriginData& openingOrigin, uint64_t callbackID)
+void WebIDBServer::getAllDatabaseNamesAndVersions(IPC::Connection& connection, const WebCore::IDBResourceIdentifier& requestIdentifier, const WebCore::ClientOrigin& origin)
{
ASSERT(!RunLoop::isMain());
@@ -323,7 +323,7 @@
ASSERT(webIDBConnection);
LockHolder locker(m_server->lock());
- m_server->getAllDatabaseNames(webIDBConnection->identifier(), mainFrameOrigin, openingOrigin, callbackID);
+ m_server->getAllDatabaseNamesAndVersions(webIDBConnection->identifier(), requestIdentifier, origin);
}
void WebIDBServer::addConnection(IPC::Connection& connection, WebCore::ProcessIdentifier processIdentifier)
Modified: trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.h (263078 => 263079)
--- trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -80,7 +80,7 @@
void abortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& transactionIdentifier);
void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& requestIdentifier, const WebCore::IndexedDB::ConnectionClosedOnBehalfOfServer);
void openDBRequestCancelled(const WebCore::IDBRequestData&);
- void getAllDatabaseNames(IPC::Connection&, const WebCore::SecurityOriginData&, const WebCore::SecurityOriginData&, uint64_t callbackID);
+ void getAllDatabaseNamesAndVersions(IPC::Connection&, const WebCore::IDBResourceIdentifier&, const WebCore::ClientOrigin&);
void addConnection(IPC::Connection&, WebCore::ProcessIdentifier);
void removeConnection(IPC::Connection&);
Modified: trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.messages.in (263078 => 263079)
--- trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.messages.in 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/NetworkProcess/IndexedDB/WebIDBServer.messages.in 2020-06-16 07:27:14 UTC (rev 263079)
@@ -50,7 +50,7 @@
DidFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, WebCore::IDBResourceIdentifier requestIdentifier, WebCore::IndexedDB::ConnectionClosedOnBehalfOfServer connectionClosedOnBehalfOfServer)
OpenDBRequestCancelled(WebCore::IDBRequestData requestData)
- GetAllDatabaseNames(struct WebCore::SecurityOriginData topOrigin, struct WebCore::SecurityOriginData openingOrigin, uint64_t callbackID) WantsConnection
+ GetAllDatabaseNamesAndVersions(WebCore::IDBResourceIdentifier requestIdentifier, struct WebCore::ClientOrigin origin) WantsConnection
}
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp (263078 => 263079)
--- trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -207,9 +207,9 @@
send(Messages::WebIDBServer::OpenDBRequestCancelled(requestData));
}
-void WebIDBConnectionToServer::getAllDatabaseNames(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& openingOrigin, uint64_t callbackID)
+void WebIDBConnectionToServer::getAllDatabaseNamesAndVersions(const IDBResourceIdentifier& requestIdentifier, const ClientOrigin& origin)
{
- send(Messages::WebIDBServer::GetAllDatabaseNames(topOrigin, openingOrigin, callbackID));
+ send(Messages::WebIDBServer::GetAllDatabaseNamesAndVersions(requestIdentifier, origin));
}
void WebIDBConnectionToServer::didDeleteDatabase(const IDBResultData& result)
@@ -322,9 +322,9 @@
m_connectionToServer->notifyOpenDBRequestBlocked(requestIdentifier, oldVersion, newVersion);
}
-void WebIDBConnectionToServer::didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames)
+void WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions(const IDBResourceIdentifier& requestIdentifier, Vector<IDBDatabaseNameAndVersion>&& databases)
{
- m_connectionToServer->didGetAllDatabaseNames(callbackID, databaseNames);
+ m_connectionToServer->didGetAllDatabaseNamesAndVersions(requestIdentifier, WTFMove(databases));
}
void WebIDBConnectionToServer::connectionToServerLost()
Modified: trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h (263078 => 263079)
--- trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -80,7 +80,7 @@
void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& requestIdentifier, const WebCore::IndexedDB::ConnectionClosedOnBehalfOfServer) final;
void openDBRequestCancelled(const WebCore::IDBRequestData&) final;
- void getAllDatabaseNames(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& openingOrigin, uint64_t callbackID) final;
+ void getAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier&, const WebCore::ClientOrigin&) final;
// Messages received from Network Process
void didDeleteDatabase(const WebCore::IDBResultData&);
@@ -105,7 +105,7 @@
void didStartTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&);
void didCloseFromServer(uint64_t databaseConnectionIdentifier, const WebCore::IDBError&);
void notifyOpenDBRequestBlocked(const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion);
- void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames);
+ void didGetAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier&, Vector<WebCore::IDBDatabaseNameAndVersion>&&);
Ref<WebCore::IDBClient::IDBConnectionToServer> m_connectionToServer;
};
Modified: trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in (263078 => 263079)
--- trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in 2020-06-16 07:27:14 UTC (rev 263079)
@@ -47,7 +47,7 @@
DidCloseFromServer(uint64_t databaseConnectionIdentifier, WebCore::IDBError error) final;
NotifyOpenDBRequestBlocked(WebCore::IDBResourceIdentifier requestIdentifier, uint64_t oldVersion, uint64_t newVersion)
- DidGetAllDatabaseNames(uint64_t callbackID, Vector<String> databaseNames)
+ DidGetAllDatabaseNamesAndVersions(WebCore::IDBResourceIdentifier requestIdentifier, Vector<WebCore::IDBDatabaseNameAndVersion> databases)
}
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebKitLegacy/ChangeLog (263078 => 263079)
--- trunk/Source/WebKitLegacy/ChangeLog 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKitLegacy/ChangeLog 2020-06-16 07:27:14 UTC (rev 263079)
@@ -1,3 +1,19 @@
+2020-06-16 Darryl Pogue <[email protected]>
+
+ IndexedDB: Support IDBFactory databases method
+ https://bugs.webkit.org/show_bug.cgi?id=211043
+
+ Reviewed by Youenn Fablet.
+
+ Plumbing for returning a list of IDB databases and versions.
+
+ * Storage/InProcessIDBServer.cpp:
+ (InProcessIDBServer::getAllDatabaseNamesAndVersions):
+ (InProcessIDBServer::didGetAllDatabaseNamesAndVersions):
+ (InProcessIDBServer::getAllDatabaseNames): Deleted.
+ (InProcessIDBServer::didGetAllDatabaseNames): Deleted.
+ * Storage/InProcessIDBServer.h:
+
2020-06-12 Keith Rollin <[email protected]>
Add dependencies for Migrate Headers and Generate Export Files build phases
Modified: trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.cpp (263078 => 263079)
--- trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.cpp 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.cpp 2020-06-16 07:27:14 UTC (rev 263079)
@@ -476,18 +476,18 @@
});
}
-void InProcessIDBServer::getAllDatabaseNames(const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID)
+void InProcessIDBServer::getAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier& requestIdentifier, const ClientOrigin& origin)
{
- dispatchTask([this, protectedThis = makeRef(*this), identifier = m_connectionToServer->identifier(), mainFrameOrigin = mainFrameOrigin.isolatedCopy(), openingOrigin = openingOrigin.isolatedCopy(), callbackID] {
+ dispatchTask([this, protectedThis = makeRef(*this), identifier = m_connectionToServer->identifier(), requestIdentifier, origin = origin.isolatedCopy()] {
LockHolder locker(m_server->lock());
- m_server->getAllDatabaseNames(identifier, mainFrameOrigin, openingOrigin, callbackID);
+ m_server->getAllDatabaseNamesAndVersions(identifier, requestIdentifier, origin);
});
}
-void InProcessIDBServer::didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames)
+void InProcessIDBServer::didGetAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier& requestIdentifier, const Vector<WebCore::IDBDatabaseNameAndVersion>& databases)
{
- dispatchTaskReply([this, protectedThis = makeRef(*this), callbackID, databaseNames = databaseNames.isolatedCopy()] {
- m_connectionToServer->didGetAllDatabaseNames(callbackID, databaseNames);
+ dispatchTaskReply([this, protectedThis = makeRef(*this), requestIdentifier, databases = databases.isolatedCopy()]() mutable {
+ m_connectionToServer->didGetAllDatabaseNamesAndVersions(requestIdentifier, WTFMove(databases));
});
}
Modified: trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.h (263078 => 263079)
--- trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.h 2020-06-16 07:18:57 UTC (rev 263078)
+++ trunk/Source/WebKitLegacy/Storage/InProcessIDBServer.h 2020-06-16 07:27:14 UTC (rev 263079)
@@ -90,7 +90,7 @@
void abortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& transactionIdentifier) final;
void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& requestIdentifier, const WebCore::IndexedDB::ConnectionClosedOnBehalfOfServer) final;
void openDBRequestCancelled(const WebCore::IDBRequestData&) final;
- void getAllDatabaseNames(const WebCore::SecurityOriginData& mainFrameOrigin, const WebCore::SecurityOriginData& openingOrigin, uint64_t callbackID) final;
+ void getAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier&, const WebCore::ClientOrigin&) final;
// IDBConnectionToClient
WebCore::IDBConnectionIdentifier identifier() const final;
@@ -116,7 +116,7 @@
void didStartTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&) final;
void didCloseFromServer(WebCore::IDBServer::UniqueIDBDatabaseConnection&, const WebCore::IDBError&) final;
void notifyOpenDBRequestBlocked(const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) final;
- void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) final;
+ void didGetAllDatabaseNamesAndVersions(const WebCore::IDBResourceIdentifier&, const Vector<WebCore::IDBDatabaseNameAndVersion>&) final;
void closeAndDeleteDatabasesModifiedSince(WallTime);