Modified: trunk/Source/WebCore/ChangeLog (243614 => 243615)
--- trunk/Source/WebCore/ChangeLog 2019-03-28 18:47:05 UTC (rev 243614)
+++ trunk/Source/WebCore/ChangeLog 2019-03-28 19:18:10 UTC (rev 243615)
@@ -1,3 +1,19 @@
+2019-03-28 Sihui Liu <[email protected]>
+
+ Crash at IDBDatabaseInfo::infoForExistingObjectStore and IDBDatabaseInfo::infoForExistingObjectStore
+ https://bugs.webkit.org/show_bug.cgi?id=196120
+ <rdar://problem/39869767>
+
+ Reviewed by Ryosuke Niwa.
+
+ No new tests because it is unclear how the crash happens. Added release logging to help debug.
+
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::performCreateIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
+
2019-03-28 Devin Rousso <[email protected]>
Web Inspector: Canvas: unbinding a canvas should always remove the agent as an observer
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (243614 => 243615)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2019-03-28 18:47:05 UTC (rev 243614)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2019-03-28 19:18:10 UTC (rev 243615)
@@ -1294,6 +1294,12 @@
}
}
+ ASSERT(m_databaseInfo);
+ if (!m_databaseInfo) {
+ RELEASE_LOG_ERROR(IndexedDB, "%p - SQLiteIDBBackingStore::clearObjectStore: m_databaseInfo is null", this);
+ return IDBError { UnknownError, "Database info is invalid"_s };
+ }
+
auto* objectStore = m_databaseInfo->infoForExistingObjectStore(info.objectStoreIdentifier());
ASSERT(objectStore);
objectStore->addExistingIndex(info);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (243614 => 243615)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-03-28 18:47:05 UTC (rev 243614)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-03-28 19:18:10 UTC (rev 243615)
@@ -1001,9 +1001,16 @@
ASSERT(!isMainThread());
LOG(IndexedDB, "(db) UniqueIDBDatabase::performCreateIndex");
+ IDBError error;
ASSERT(m_backingStore);
- IDBError error = m_backingStore->createIndex(transactionIdentifier, info);
+ if (!m_backingStore) {
+ RELEASE_LOG_ERROR(IndexedDB, "%p - UniqueIDBDatabase::performCreateIndex: m_backingStore is null", this);
+ error = IDBError(InvalidStateError, "Backing store is invalid for call to create index"_s);
+ postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateIndex, callbackIdentifier, error, info));
+ return;
+ }
+ error = m_backingStore->createIndex(transactionIdentifier, info);
postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateIndex, callbackIdentifier, error, info));
}
@@ -1200,6 +1207,13 @@
IDBKeyData usedKey;
IDBError error;
+ if (!m_backingStore) {
+ RELEASE_LOG_ERROR(IndexedDB, "%p - UniqueIDBDatabase::performPutOrAdd: m_backingStore is null", this);
+ error = IDBError(InvalidStateError, "Backing store is invalid for call to put or add"_s);
+ postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
+ return;
+ }
+
auto* objectStoreInfo = m_backingStore->infoForObjectStore(objectStoreIdentifier);
if (!objectStoreInfo) {
error = IDBError(InvalidStateError, "Object store cannot be found in the backing store"_s);