Diff
Modified: trunk/Source/WebCore/ChangeLog (248698 => 248699)
--- trunk/Source/WebCore/ChangeLog 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/ChangeLog 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1,3 +1,15 @@
+2019-08-14 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r248526.
+
+ Caused two IndexedDB perf tests to fail
+
+ Reverted changeset:
+
+ "Remove IDB-specific quota"
+ https://bugs.webkit.org/show_bug.cgi?id=196545
+ https://trac.webkit.org/changeset/248526
+
2019-08-14 Keith Rollin <krol...@apple.com>
Remove support for macOS < 10.13
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -100,6 +100,7 @@
virtual bool isEphemeral() = 0;
virtual uint64_t databasesSizeForOrigin() const = 0;
+ virtual void setQuota(uint64_t) = 0;
virtual bool hasTransaction(const IDBResourceIdentifier&) const = 0;
protected:
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -135,7 +135,7 @@
if (m_databaseDirectoryPath.isEmpty())
return MemoryIDBBackingStore::create(identifier);
- return std::make_unique<SQLiteIDBBackingStore>(m_sessionID, identifier, m_databaseDirectoryPath, m_backingStoreTemporaryFileHandler);
+ return std::make_unique<SQLiteIDBBackingStore>(m_sessionID, identifier, m_databaseDirectoryPath, m_backingStoreTemporaryFileHandler, m_perOriginQuota);
}
void IDBServer::openDatabase(const IDBRequestData& requestData)
@@ -691,6 +691,14 @@
callback();
}
+void IDBServer::setPerOriginQuota(uint64_t quota)
+{
+ m_perOriginQuota = quota;
+
+ for (auto& database : m_uniqueIDBDatabaseMap.values())
+ database->setQuota(quota);
+}
+
IDBServer::QuotaUser::QuotaUser(IDBServer& server, StorageQuotaManager* manager, ClientOrigin&& origin)
: m_server(server)
, m_manager(makeWeakPtr(manager))
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -115,6 +115,9 @@
WEBCORE_EXPORT void closeAndDeleteDatabasesModifiedSince(WallTime, Function<void ()>&& completionHandler);
WEBCORE_EXPORT void closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, Function<void ()>&& completionHandler);
+ uint64_t perOriginQuota() const { return m_perOriginQuota; }
+ WEBCORE_EXPORT void setPerOriginQuota(uint64_t);
+
void requestSpace(const ClientOrigin&, uint64_t taskSize, CompletionHandler<void(StorageQuotaManager::Decision)>&&);
void increasePotentialSpaceUsed(const ClientOrigin&, uint64_t taskSize);
void decreasePotentialSpaceUsed(const ClientOrigin&, uint64_t taskSize);
@@ -193,6 +196,8 @@
String m_databaseDirectoryPath;
IDBBackingStoreTemporaryFileHandler& m_backingStoreTemporaryFileHandler;
+ uint64_t m_perOriginQuota { defaultPerOriginQuota };
+
HashMap<ClientOrigin, std::unique_ptr<QuotaUser>> m_quotaUsers;
QuotaManagerGetter m_quotaManagerGetter;
};
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -79,6 +79,7 @@
bool supportsSimultaneousTransactions() final { return true; }
bool isEphemeral() final { return true; }
+ void setQuota(uint64_t quota) final { UNUSED_PARAM(quota); };
uint64_t databasesSizeForOrigin() const final;
void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -228,11 +228,12 @@
return blobFilesTableSchemaString;
}
-SQLiteIDBBackingStore::SQLiteIDBBackingStore(PAL::SessionID sessionID, const IDBDatabaseIdentifier& identifier, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler& fileHandler)
+SQLiteIDBBackingStore::SQLiteIDBBackingStore(PAL::SessionID sessionID, const IDBDatabaseIdentifier& identifier, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler& fileHandler, uint64_t quota)
: m_sessionID(sessionID)
, m_identifier(identifier)
, m_databaseRootDirectory(databaseRootDirectory)
, m_temporaryFileHandler(fileHandler)
+ , m_quota(quota)
{
m_databaseDirectory = fullDatabaseDirectoryWithUpgrade();
}
@@ -872,6 +873,14 @@
return IDBError { };
}
+uint64_t SQLiteIDBBackingStore::quotaForOrigin() const
+{
+ ASSERT(!isMainThread());
+ uint64_t diskFreeSpaceSize = 0;
+ FileSystem::getVolumeFreeSpace(m_identifier.databaseDirectoryRelativeToRoot(m_databaseRootDirectory), diskFreeSpaceSize);
+ return std::min(diskFreeSpaceSize / 2, m_quota);
+}
+
uint64_t SQLiteIDBBackingStore::databasesSizeForFolder(const String& folder)
{
uint64_t diskUsage = 0;
@@ -889,6 +898,24 @@
return databasesSizeForFolder(oldVersionOriginDirectory) + databasesSizeForFolder(newVersionOriginDirectory);
}
+uint64_t SQLiteIDBBackingStore::maximumSize() const
+{
+ ASSERT(!isMainThread());
+
+ // The maximum size for one database file is the quota for its origin, minus size of all databases within that origin,
+ // and plus current size of the database file.
+ uint64_t databaseFileSize = SQLiteFileSystem::getDatabaseFileSize(fullDatabasePath());
+ uint64_t quota = quotaForOrigin();
+
+ uint64_t diskUsage = databasesSizeForOrigin();
+ ASSERT(diskUsage >= databaseFileSize);
+
+ if (quota < diskUsage)
+ return databaseFileSize;
+
+ return quota - diskUsage + databaseFileSize;
+}
+
IDBError SQLiteIDBBackingStore::beginTransaction(const IDBTransactionInfo& info)
{
LOG(IndexedDB, "SQLiteIDBBackingStore::beginTransaction - %s", info.identifier().loggingString().utf8().data());
@@ -897,6 +924,7 @@
ASSERT(m_sqliteDB->isOpen());
ASSERT(m_databaseInfo);
+ m_sqliteDB->setMaximumSize(maximumSize());
auto addResult = m_transactions.add(info.identifier(), nullptr);
if (!addResult.isNewEntry) {
LOG_ERROR("Attempt to establish transaction identifier that already exists");
@@ -913,7 +941,10 @@
if (sql.prepare() != SQLITE_OK
|| sql.bindText(1, String::number(info.newVersion())) != SQLITE_OK
|| sql.step() != SQLITE_DONE) {
- error = IDBError { UnknownError, "Failed to store new database version in database"_s };
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ error = IDBError { QuotaExceededError, "Failed to store new database version in database because no enough space for domain"_s };
+ else
+ error = IDBError { UnknownError, "Failed to store new database version in database"_s };
}
}
@@ -996,6 +1027,8 @@
|| sql->bindInt64(5, info.maxIndexID()) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not add object store '%s' to ObjectStoreInfo table (%i) - %s", info.name().utf8().data(), m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Could not create object store because no enough space for domain"_s };
return IDBError { UnknownError, "Could not create object store"_s };
}
}
@@ -1006,6 +1039,8 @@
|| sql->bindInt64(1, info.identifier()) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not seed initial key generator value for ObjectStoreInfo table (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Could not seed initial key generator value for object store because no enough space for domain"_s };
return IDBError { UnknownError, "Could not seed initial key generator value for object store"_s };
}
}
@@ -1129,6 +1164,8 @@
|| sql->bindInt64(2, objectStoreIdentifier) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not update name for object store id %" PRIi64 " in ObjectStoreInfo table (%i) - %s", objectStoreIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Could not rename object store because no enough space for domain"_s };
return IDBError { UnknownError, "Could not rename object store"_s };
}
}
@@ -1210,6 +1247,8 @@
|| sql->bindInt(6, info.multiEntry()) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not add index '%s' to IndexInfo table (%i) - %s", info.name().utf8().data(), m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Unable to create index in database because no enough space for domain"_s };
return IDBError { UnknownError, "Unable to create index in database"_s };
}
@@ -1358,6 +1397,8 @@
|| sql->bindInt64(5, recordID) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not put index record for index %" PRIi64 " in object store %" PRIi64 " in Records table (%i) - %s", indexID, objectStoreID, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Error putting index record into database because no enough space for domain"_s };
return IDBError { UnknownError, "Error putting index record into database"_s };
}
}
@@ -1443,6 +1484,8 @@
|| sql->bindInt64(3, indexIdentifier) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not update name for index id (%" PRIi64 ", %" PRIi64 ") in IndexInfo table (%i) - %s", objectStoreIdentifier, indexIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Could not rename index because no enough space for domain"_s };
return IDBError { UnknownError, "Could not rename index"_s };
}
}
@@ -1780,6 +1823,8 @@
|| sql->bindBlob(3, value.data().data()->data(), value.data().data()->size()) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not put record for object store %" PRIi64 " in Records table (%i) - %s", objectStoreInfo.identifier(), m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Unable to store record in object store because no enough space for domain"_s };
return IDBError { UnknownError, "Unable to store record in object store"_s };
}
@@ -1812,6 +1857,8 @@
|| sql->bindText(2, url) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Unable to record Blob record in database");
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Unable to record Blob record in database because no enough space for domain"_s };
return IDBError { UnknownError, "Unable to record Blob record in database"_s };
}
}
@@ -1845,6 +1892,8 @@
|| sql->bindText(2, storedFilename) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Unable to record Blob file record in database");
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Unable to record Blob file in database because no enough space for domain"_s };
return IDBError { UnknownError, "Unable to record Blob file record in database"_s };
}
}
@@ -2380,6 +2429,8 @@
|| sql->bindInt64(2, value) != SQLITE_OK
|| sql->step() != SQLITE_DONE) {
LOG_ERROR("Could not update key generator value (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (m_sqliteDB->lastError() == SQLITE_FULL)
+ return IDBError { QuotaExceededError, "Error storing new key generator value in database because no enough space for domain"_s };
return IDBError { ConstraintError, "Error storing new key generator value in database" };
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -48,7 +48,7 @@
class SQLiteIDBBackingStore : public IDBBackingStore {
WTF_MAKE_FAST_ALLOCATED;
public:
- SQLiteIDBBackingStore(PAL::SessionID, const IDBDatabaseIdentifier&, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler&);
+ SQLiteIDBBackingStore(PAL::SessionID, const IDBDatabaseIdentifier&, const String& databaseRootDirectory, IDBBackingStoreTemporaryFileHandler&, uint64_t quota);
~SQLiteIDBBackingStore() final;
@@ -81,6 +81,7 @@
IDBObjectStoreInfo* infoForObjectStore(uint64_t objectStoreIdentifier) final;
void deleteBackingStore() final;
+ void setQuota(uint64_t quota) final { m_quota = quota; }
uint64_t databasesSizeForOrigin() const final;
bool supportsSimultaneousTransactions() final { return false; }
@@ -108,6 +109,9 @@
String fullDatabasePath() const;
String fullDatabaseDirectoryWithUpgrade();
+ uint64_t quotaForOrigin() const;
+ uint64_t maximumSize() const;
+
bool ensureValidRecordsTable();
bool ensureValidIndexRecordsTable();
bool ensureValidIndexRecordsIndex();
@@ -207,6 +211,8 @@
JSC::Strong<JSC::JSGlobalObject> m_globalObject;
IDBBackingStoreTemporaryFileHandler& m_temporaryFileHandler;
+
+ uint64_t m_quota;
};
} // namespace IDBServer
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -2316,6 +2316,12 @@
m_errorCallbacks.remove(callbackIdentifier);
}
+void UniqueIDBDatabase::setQuota(uint64_t quota)
+{
+ if (m_backingStore)
+ m_backingStore->setQuota(quota);
+}
+
void UniqueIDBDatabase::abortTransactionOnMainThread(UniqueIDBDatabaseTransaction& transaction)
{
transaction.setResult(m_backingStore->abortTransaction(transaction.info().identifier()));
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (248698 => 248699)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -126,6 +126,8 @@
uint64_t spaceUsed() const;
+ void setQuota(uint64_t);
+
void finishActiveTransactions();
private:
Modified: trunk/Source/WebKit/ChangeLog (248698 => 248699)
--- trunk/Source/WebKit/ChangeLog 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/ChangeLog 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1,3 +1,15 @@
+2019-08-14 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r248526.
+
+ Caused two IndexedDB perf tests to fail
+
+ Reverted changeset:
+
+ "Remove IDB-specific quota"
+ https://bugs.webkit.org/show_bug.cgi?id=196545
+ https://trac.webkit.org/changeset/248526
+
2019-08-14 Andy Estes <aes...@apple.com>
Fix the build when ENABLE(APPLE_PAY) is false.
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (248698 => 248699)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -2284,11 +2284,13 @@
path = m_idbDatabasePaths.get(sessionID);
}
- return IDBServer::IDBServer::create(sessionID, path, *this, [this, weakThis = makeWeakPtr(this)](PAL::SessionID sessionID, const auto& origin) -> StorageQuotaManager* {
+ auto server = IDBServer::IDBServer::create(sessionID, path, *this, [this, weakThis = makeWeakPtr(this)](PAL::SessionID sessionID, const auto& origin) -> StorageQuotaManager* {
if (!weakThis)
return nullptr;
return &this->storageQuotaManager(sessionID, origin);
});
+ server->setPerOriginQuota(m_idbPerOriginQuota);
+ return server;
}
IDBServer::IDBServer& NetworkProcess::idbServer(PAL::SessionID sessionID)
@@ -2384,6 +2386,14 @@
postStorageTask(createCrossThreadTask(*this, &NetworkProcess::ensurePathExists, indexedDatabaseDirectory));
}
}
+
+void NetworkProcess::setIDBPerOriginQuota(uint64_t quota)
+{
+ m_idbPerOriginQuota = quota;
+
+ for (auto& server : m_idbServers.values())
+ server->setPerOriginQuota(quota);
+}
#endif // ENABLE(INDEXED_DATABASE)
void NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting(PAL::SessionID sessionID, const ClientOrigin& origin)
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (248698 => 248699)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -284,6 +284,7 @@
WebCore::IDBServer::IDBServer& idbServer(PAL::SessionID);
// WebCore::IDBServer::IDBBackingStoreFileHandler.
void accessToTemporaryFileComplete(const String& path) final;
+ void setIDBPerOriginQuota(uint64_t);
#endif
void updateQuotaBasedOnSpaceUsageForTesting(PAL::SessionID, const WebCore::ClientOrigin&);
@@ -524,6 +525,7 @@
#if ENABLE(INDEXED_DATABASE)
HashMap<PAL::SessionID, String> m_idbDatabasePaths;
HashMap<PAL::SessionID, RefPtr<WebCore::IDBServer::IDBServer>> m_idbServers;
+ uint64_t m_idbPerOriginQuota { WebCore::IDBServer::defaultPerOriginQuota };
#endif
Deque<CrossThreadTask> m_storageTasks;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (248698 => 248699)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-08-15 00:30:51 UTC (rev 248699)
@@ -160,6 +160,9 @@
DisableServiceWorkerProcessTerminationDelay()
#endif
+#if ENABLE(INDEXED_DATABASE)
+ SetIDBPerOriginQuota(uint64_t quota)
+#endif
UpdateQuotaBasedOnSpaceUsageForTesting(PAL::SessionID sessionID, struct WebCore::ClientOrigin origin)
StoreAdClickAttribution(PAL::SessionID sessionID, WebCore::AdClickAttribution adClickAttribution)
Modified: trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp (248698 => 248699)
--- trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -660,6 +660,11 @@
#endif
}
+void WKContextSetIDBPerOriginQuota(WKContextRef contextRef, uint64_t quota)
+{
+ WebKit::toImpl(contextRef)->setIDBPerOriginQuota(quota);
+}
+
void WKContextClearCurrentModifierStateForTesting(WKContextRef contextRef)
{
WebKit::toImpl(contextRef)->clearCurrentModifierStateForTesting();
Modified: trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h (248698 => 248699)
--- trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -116,6 +116,8 @@
WK_EXPORT void WKContextAddSupportedPlugin(WKContextRef context, WKStringRef domain, WKStringRef name, WKArrayRef mimeTypes, WKArrayRef extensions);
WK_EXPORT void WKContextClearSupportedPlugins(WKContextRef context);
+WK_EXPORT void WKContextSetIDBPerOriginQuota(WKContextRef context, uint64_t quota);
+
WK_EXPORT void WKContextClearCurrentModifierStateForTesting(WKContextRef context);
#ifdef __cplusplus
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (248698 => 248699)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1802,6 +1802,13 @@
ensureNetworkProcess().syncAllCookies();
}
+void WebProcessPool::setIDBPerOriginQuota(uint64_t quota)
+{
+#if ENABLE(INDEXED_DATABASE)
+ ensureNetworkProcess().send(Messages::NetworkProcess::SetIDBPerOriginQuota(quota), 0);
+#endif
+}
+
void WebProcessPool::allowSpecificHTTPSCertificateForHost(const WebCertificateInfo* certificate, const String& host)
{
ensureNetworkProcess();
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (248698 => 248699)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -318,6 +318,8 @@
void syncNetworkProcessCookies();
+ void setIDBPerOriginQuota(uint64_t);
+
void setShouldMakeNextWebProcessLaunchFailForTesting(bool value) { m_shouldMakeNextWebProcessLaunchFailForTesting = value; }
bool shouldMakeNextWebProcessLaunchFailForTesting() const { return m_shouldMakeNextWebProcessLaunchFailForTesting; }
void setShouldMakeNextNetworkProcessLaunchFailForTesting(bool value) { m_shouldMakeNextNetworkProcessLaunchFailForTesting = value; }
Modified: trunk/Source/WebKitLegacy/ChangeLog (248698 => 248699)
--- trunk/Source/WebKitLegacy/ChangeLog 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/ChangeLog 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1,3 +1,15 @@
+2019-08-14 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r248526.
+
+ Caused two IndexedDB perf tests to fail
+
+ Reverted changeset:
+
+ "Remove IDB-specific quota"
+ https://bugs.webkit.org/show_bug.cgi?id=196545
+ https://trac.webkit.org/changeset/248526
+
2019-08-12 Youenn Fablet <you...@apple.com>
Remove IDB-specific quota
Modified: trunk/Source/WebKitLegacy/Storage/WebDatabaseProvider.cpp (248698 => 248699)
--- trunk/Source/WebKitLegacy/Storage/WebDatabaseProvider.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/Storage/WebDatabaseProvider.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -45,9 +45,17 @@
#if ENABLE(INDEXED_DATABASE)
WebCore::IDBClient::IDBConnectionToServer& WebDatabaseProvider::idbConnectionToServerForSession(const PAL::SessionID& sessionID)
{
- return m_idbServerMap.ensure(sessionID.sessionID(), [&sessionID] {
- return sessionID.isEphemeral() ? WebCore::InProcessIDBServer::create(sessionID) : WebCore::InProcessIDBServer::create(sessionID, indexedDatabaseDirectoryPath());
- }).iterator->value->connectionToServer();
+ auto result = m_idbServerMap.add(sessionID.sessionID(), nullptr);
+ if (result.isNewEntry) {
+ if (sessionID.isEphemeral())
+ result.iterator->value = WebCore::InProcessIDBServer::create(sessionID);
+ else
+ result.iterator->value = WebCore::InProcessIDBServer::create(sessionID, indexedDatabaseDirectoryPath());
+ }
+
+ result.iterator->value->idbServer().setPerOriginQuota(m_idbPerOriginQuota);
+
+ return result.iterator->value->connectionToServer();
}
void WebDatabaseProvider::deleteAllDatabases()
@@ -55,4 +63,13 @@
for (auto& server : m_idbServerMap.values())
server->idbServer().closeAndDeleteDatabasesModifiedSince(-WallTime::infinity(), [] { });
}
+
+void WebDatabaseProvider::setIDBPerOriginQuota(uint64_t quota)
+{
+ m_idbPerOriginQuota = quota;
+
+ for (auto& server : m_idbServerMap.values())
+ server->idbServer().setPerOriginQuota(quota);
+}
+
#endif
Modified: trunk/Source/WebKitLegacy/Storage/WebDatabaseProvider.h (248698 => 248699)
--- trunk/Source/WebKitLegacy/Storage/WebDatabaseProvider.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/Storage/WebDatabaseProvider.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -44,6 +44,8 @@
WebCore::IDBClient::IDBConnectionToServer& idbConnectionToServerForSession(const PAL::SessionID&) override;
void deleteAllDatabases();
+
+ void setIDBPerOriginQuota(uint64_t);
#endif
private:
@@ -53,5 +55,6 @@
#if ENABLE(INDEXED_DATABASE)
HashMap<uint64_t, RefPtr<WebCore::InProcessIDBServer>> m_idbServerMap;
+ uint64_t m_idbPerOriginQuota { WebCore::IDBServer::defaultPerOriginQuota };
#endif
};
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (248698 => 248699)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1,3 +1,15 @@
+2019-08-14 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r248526.
+
+ Caused two IndexedDB perf tests to fail
+
+ Reverted changeset:
+
+ "Remove IDB-specific quota"
+ https://bugs.webkit.org/show_bug.cgi?id=196545
+ https://trac.webkit.org/changeset/248526
+
2019-08-14 Keith Rollin <krol...@apple.com>
Remove support for macOS < 10.13
Modified: trunk/Source/WebKitLegacy/mac/Storage/WebDatabaseManager.mm (248698 => 248699)
--- trunk/Source/WebKitLegacy/mac/Storage/WebDatabaseManager.mm 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/mac/Storage/WebDatabaseManager.mm 2019-08-15 00:30:51 UTC (rev 248699)
@@ -157,6 +157,13 @@
#endif
}
+- (void)setIDBPerOriginQuota:(uint64_t)quota
+{
+#if ENABLE(INDEXED_DATABASE)
+ WebDatabaseProvider::singleton().setIDBPerOriginQuota(quota);
+#endif
+}
+
#if PLATFORM(IOS_FAMILY)
static bool isFileHidden(NSString *file)
Modified: trunk/Source/WebKitLegacy/mac/Storage/WebDatabaseManagerPrivate.h (248698 => 248699)
--- trunk/Source/WebKitLegacy/mac/Storage/WebDatabaseManagerPrivate.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/mac/Storage/WebDatabaseManagerPrivate.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -70,6 +70,7 @@
// For DumpRenderTree support only
- (void)deleteAllIndexedDatabases;
+- (void)setIDBPerOriginQuota:(uint64_t)quota;
#if TARGET_OS_IPHONE
+ (void)scheduleEmptyDatabaseRemoval;
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (248698 => 248699)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1,3 +1,15 @@
+2019-08-14 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r248526.
+
+ Caused two IndexedDB perf tests to fail
+
+ Reverted changeset:
+
+ "Remove IDB-specific quota"
+ https://bugs.webkit.org/show_bug.cgi?id=196545
+ https://trac.webkit.org/changeset/248526
+
2019-08-14 Youenn Fablet <you...@apple.com>
ThreadableBlobRegistry::blobSize should take a SessionID as parameter
Modified: trunk/Source/WebKitLegacy/win/Interfaces/IWebDatabaseManager.idl (248698 => 248699)
--- trunk/Source/WebKitLegacy/win/Interfaces/IWebDatabaseManager.idl 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/win/Interfaces/IWebDatabaseManager.idl 2019-08-15 00:30:51 UTC (rev 248699)
@@ -69,4 +69,5 @@
interface IWebDatabaseManager2 : IWebDatabaseManager
{
HRESULT deleteAllIndexedDatabases();
+ HRESULT setIDBPerOriginQuota([in] unsigned long long quota);
}
Modified: trunk/Source/WebKitLegacy/win/WebDatabaseManager.cpp (248698 => 248699)
--- trunk/Source/WebKitLegacy/win/WebDatabaseManager.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/win/WebDatabaseManager.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -346,6 +346,14 @@
return S_OK;
}
+HRESULT WebDatabaseManager::setIDBPerOriginQuota(unsigned long long quota)
+{
+#if ENABLE(INDEXED_DATABASE)
+ WebDatabaseProvider::singleton().setIDBPerOriginQuota(quota);
+#endif
+ return S_OK;
+}
+
class DidModifyOriginData {
WTF_MAKE_NONCOPYABLE(DidModifyOriginData);
public:
Modified: trunk/Source/WebKitLegacy/win/WebDatabaseManager.h (248698 => 248699)
--- trunk/Source/WebKitLegacy/win/WebDatabaseManager.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Source/WebKitLegacy/win/WebDatabaseManager.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -56,6 +56,7 @@
// IWebDatabaseManager2
virtual HRESULT STDMETHODCALLTYPE deleteAllIndexedDatabases();
+ virtual HRESULT STDMETHODCALLTYPE setIDBPerOriginQuota(unsigned long long);
// DatabaseManagerClient
virtual void dispatchDidModifyOrigin(const WebCore::SecurityOriginData&);
Modified: trunk/Tools/ChangeLog (248698 => 248699)
--- trunk/Tools/ChangeLog 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/ChangeLog 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1,3 +1,15 @@
+2019-08-14 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r248526.
+
+ Caused two IndexedDB perf tests to fail
+
+ Reverted changeset:
+
+ "Remove IDB-specific quota"
+ https://bugs.webkit.org/show_bug.cgi?id=196545
+ https://trac.webkit.org/changeset/248526
+
2019-08-14 Keith Rollin <krol...@apple.com>
Remove support for macOS < 10.13
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (248698 => 248699)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -893,6 +893,20 @@
return JSValueMakeUndefined(context);
}
+static JSValueRef setIDBPerOriginQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ auto* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+
+ double quota = JSValueToNumber(context, arguments[0], nullptr);
+ if (!std::isnan(quota))
+ controller->setIDBPerOriginQuota(static_cast<uint64_t>(quota));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setDefersLoadingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 1)
@@ -2206,6 +2220,7 @@
{ "setRejectsProtectionSpaceAndContinueForAuthenticationChallenges", setRejectsProtectionSpaceAndContinueForAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setIDBPerOriginQuota", setIDBPerOriginQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAutomaticLinkDetectionEnabled", setAutomaticLinkDetectionEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Modified: trunk/Tools/DumpRenderTree/TestRunner.h (248698 => 248699)
--- trunk/Tools/DumpRenderTree/TestRunner.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/DumpRenderTree/TestRunner.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -106,6 +106,7 @@
void setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme);
void setDefersLoading(bool);
void setIconDatabaseEnabled(bool);
+ void setIDBPerOriginQuota(uint64_t);
void setJavaScriptCanAccessClipboard(bool flag);
void setAutomaticLinkDetectionEnabled(bool flag);
void setMainFrameIsFirstResponder(bool flag);
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (248698 => 248699)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2019-08-15 00:30:51 UTC (rev 248699)
@@ -2035,6 +2035,7 @@
gTestRunner->clearAllApplicationCaches();
gTestRunner->clearAllDatabases();
+ gTestRunner->setIDBPerOriginQuota(50 * MB);
if (disallowedURLs)
CFSetRemoveAllValues(disallowedURLs);
Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (248698 => 248699)
--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2019-08-15 00:30:51 UTC (rev 248699)
@@ -439,6 +439,11 @@
[origin release];
}
+void TestRunner::setIDBPerOriginQuota(uint64_t quota)
+{
+ [[WebDatabaseManager sharedWebDatabaseManager] setIDBPerOriginQuota:quota];
+}
+
void TestRunner::goBack()
{
[[mainFrame webView] goBack];
Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (248698 => 248699)
--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -172,6 +172,22 @@
databaseManager2->deleteAllIndexedDatabases();
}
+void TestRunner::setIDBPerOriginQuota(uint64_t quota)
+{
+ COMPtr<IWebDatabaseManager> databaseManager;
+ COMPtr<IWebDatabaseManager> tmpDatabaseManager;
+ if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager)))
+ return;
+ if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager)))
+ return;
+
+ COMPtr<IWebDatabaseManager2> databaseManager2;
+ if (FAILED(databaseManager->QueryInterface(&databaseManager2)))
+ return;
+
+ databaseManager2->setIDBPerOriginQuota(quota);
+}
+
void TestRunner::setStorageDatabaseIdleInterval(double)
{
// FIXME: Implement. Requires non-existant (on Windows) WebStorageManager
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (248698 => 248699)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-08-15 00:30:51 UTC (rev 248699)
@@ -146,6 +146,9 @@
attribute double databaseDefaultQuota;
attribute double databaseMaxQuota;
+ // IndexedDB API
+ void setIDBPerOriginQuota(unsigned long long quota);
+
// Application Cache API
void clearAllApplicationCaches();
void setAppCacheMaximumSize(unsigned long long size);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (248698 => 248699)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -367,6 +367,13 @@
m_disallowIncreaseForApplicationCacheQuota = true;
}
+void TestRunner::setIDBPerOriginQuota(uint64_t quota)
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetIDBPerOriginQuota"));
+ WKRetainPtr<WKUInt64Ref> messageBody = adoptWK(WKUInt64Create(quota));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
static inline JSValueRef stringArrayToJS(JSContextRef context, WKArrayRef strings)
{
const size_t count = WKArrayGetSize(strings);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (248698 => 248699)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -175,6 +175,9 @@
uint64_t domCacheSize(JSStringRef origin);
void setAllowStorageQuotaIncrease(bool);
+ // IndexedDB
+ void setIDBPerOriginQuota(uint64_t);
+
// Failed load condition testing
void forceImmediateCompletion();
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (248698 => 248699)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -940,6 +940,7 @@
WKWebsiteDataStoreClearAllDeviceOrientationPermissions(websiteDataStore);
ClearIndexedDatabases();
+ setIDBPerOriginQuota(50 * MB);
clearServiceWorkerRegistrations();
clearDOMCaches();
@@ -3063,6 +3064,11 @@
runUntil(context.done, noTimeout);
}
+void TestController::setIDBPerOriginQuota(uint64_t quota)
+{
+ WKContextSetIDBPerOriginQuota(platformContext(), quota);
+}
+
struct RemoveAllIndexedDatabasesCallbackContext {
explicit RemoveAllIndexedDatabasesCallbackContext(TestController& controller)
: testController(controller)
Modified: trunk/Tools/WebKitTestRunner/TestController.h (248698 => 248699)
--- trunk/Tools/WebKitTestRunner/TestController.h 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2019-08-15 00:30:51 UTC (rev 248699)
@@ -273,6 +273,8 @@
void setAllowStorageQuotaIncrease(bool);
+ void setIDBPerOriginQuota(uint64_t);
+
bool didReceiveServerRedirectForProvisionalNavigation() const { return m_didReceiveServerRedirectForProvisionalNavigation; }
void clearDidReceiveServerRedirectForProvisionalNavigation() { m_didReceiveServerRedirectForProvisionalNavigation = false; }
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (248698 => 248699)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-08-15 00:18:27 UTC (rev 248698)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-08-15 00:30:51 UTC (rev 248699)
@@ -1514,6 +1514,13 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetIDBPerOriginQuota")) {
+ ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
+ WKUInt64Ref quota = static_cast<WKUInt64Ref>(messageBody);
+ TestController::singleton().setIDBPerOriginQuota(WKUInt64GetValue(quota));
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "InjectUserScript")) {
ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
WKStringRef script = static_cast<WKStringRef>(messageBody);