Diff
Modified: trunk/LayoutTests/ChangeLog (163481 => 163482)
--- trunk/LayoutTests/ChangeLog 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/LayoutTests/ChangeLog 2014-02-05 23:59:52 UTC (rev 163482)
@@ -1,3 +1,12 @@
+2014-02-05 Brady Eidson <[email protected]>
+
+ IDB: storage/indexeddb/mozilla/autoincrement-indexes.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=128257
+
+ Reviewed by Sam Weinig.
+
+ * platform/mac-wk2/TestExpectations: Enable the test.
+
2014-02-05 Brian Burg <[email protected]>
Web Inspector: add probe manager and model objects to the frontend
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (163481 => 163482)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2014-02-05 23:59:52 UTC (rev 163482)
@@ -470,7 +470,9 @@
# All IndexedDB tests are skipped in WK1.
# Reenable individual tests here that are known to pass, with the eventual goal of re-enabling the entire directory.
storage/indexeddb/mozilla/add-twice-failure.html [ Pass ]
+storage/indexeddb/mozilla/autoincrement-indexes.html [ Pass ]
+
### END OF (5) Features that are not supported in WebKit1, so skipped in mac/TestExpectations then re-enabled here
########################################
Modified: trunk/Source/WebCore/ChangeLog (163481 => 163482)
--- trunk/Source/WebCore/ChangeLog 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebCore/ChangeLog 2014-02-05 23:59:52 UTC (rev 163482)
@@ -1,3 +1,22 @@
+2014-02-05 Brady Eidson <[email protected]>
+
+ IDB: storage/indexeddb/mozilla/autoincrement-indexes.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=128257
+
+ Reviewed by Sam Weinig.
+
+ Tests: storage/indexeddb/mozilla/autoincrement-indexes.html
+
+ Add some IDBKeyData utility methods for WK2 to use:
+ * Modules/indexeddb/IDBKeyData.cpp:
+ (WebCore::IDBKeyData::setArrayValue):
+ (WebCore::IDBKeyData::setStringValue):
+ (WebCore::IDBKeyData::setDateValue):
+ (WebCore::IDBKeyData::setNumberValue):
+ * Modules/indexeddb/IDBKeyData.h:
+
+ * WebCore.exp.in:
+
2014-02-05 Andreas Kling <[email protected]>
Turn on ENABLE(8BIT_TEXTRUN) for everyone.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp (163481 => 163482)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp 2014-02-05 23:59:52 UTC (rev 163482)
@@ -281,6 +281,38 @@
}
#endif
+void IDBKeyData::setArrayValue(const Vector<IDBKeyData>& value)
+{
+ *this = IDBKeyData();
+ arrayValue = value;
+ type = IDBKey::ArrayType;
+ isNull = false;
}
+void IDBKeyData::setStringValue(const String& value)
+{
+ *this = IDBKeyData();
+ stringValue = value;
+ type = IDBKey::StringType;
+ isNull = false;
+}
+
+void IDBKeyData::setDateValue(double value)
+{
+ *this = IDBKeyData();
+ numberValue = value;
+ type = IDBKey::DateType;
+ isNull = false;
+}
+
+void IDBKeyData::setNumberValue(double value)
+{
+ *this = IDBKeyData();
+ numberValue = value;
+ type = IDBKey::NumberType;
+ isNull = false;
+}
+
+}
+
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h (163481 => 163482)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h 2014-02-05 23:59:52 UTC (rev 163482)
@@ -58,6 +58,11 @@
// - Returns zero if this IDBKeyData is equal to other.
int compare(const IDBKeyData& other) const;
+ void setArrayValue(const Vector<IDBKeyData>&);
+ void setStringValue(const String&);
+ void setDateValue(double);
+ void setNumberValue(double);
+
#ifndef NDEBUG
String loggingString() const;
#endif
Modified: trunk/Source/WebCore/WebCore.exp.in (163481 => 163482)
--- trunk/Source/WebCore/WebCore.exp.in 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-02-05 23:59:52 UTC (rev 163482)
@@ -3100,6 +3100,7 @@
__ZNK7WebCore15IDBKeyRangeData15isExactlyOneKeyEv
__ZNK7WebCore15IDBKeyRangeData22maybeCreateIDBKeyRangeEv
__ZNK7WebCore6IDBKey7isValidEv
+__ZN7WebCore10IDBKeyData14setNumberValueEd
__ZN7WebCore10IDBKeyData6decodeERNS_12KeyedDecoderERS0_
__ZN7WebCore10IDBKeyDataC1EPKNS_6IDBKeyE
__ZN7WebCore10IDBKeyPathC1ERKN3WTF6StringE
Modified: trunk/Source/WebKit2/ChangeLog (163481 => 163482)
--- trunk/Source/WebKit2/ChangeLog 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-05 23:59:52 UTC (rev 163482)
@@ -1,3 +1,23 @@
+2014-02-05 Brady Eidson <[email protected]>
+
+ IDB: storage/indexeddb/mozilla/autoincrement-indexes.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=128257
+
+ Reviewed by Sam Weinig.
+
+ * DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
+ (WebKit::UniqueIDBDatabase::putRecordInBackingStore): Write the correct key to the index if it was auto generated.
+ (WebKit::UniqueIDBDatabase::getRecordFromBackingStore): If this is an auto increment object store with
+ a non-empty key path, save the key path to the get result.
+
+ * DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
+ * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createAndPopulateInitialMetadata): The IndexRecord schema shouldn’t
+ have key uniqueness.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::putRecord): Take IDBKeyData instead of IDBKey.
+ (WebKit::UniqueIDBDatabaseBackingStoreSQLite::getIndexRecord): Fill in the primary key from the fetch.
+ * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:
+
2014-02-05 Anders Carlsson <[email protected]>
Get rid of WebUIClient
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp (163481 => 163482)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp 2014-02-05 23:59:52 UTC (rev 163482)
@@ -813,31 +813,28 @@
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didDeleteIndex, requestID, success));
}
-void UniqueIDBDatabase::putRecordInBackingStore(uint64_t requestID, const IDBIdentifier& transaction, const IDBObjectStoreMetadata& objectStoreMetadata, const IDBKeyData& keyData, const Vector<uint8_t>& value, int64_t putMode, const Vector<int64_t>& indexIDs, const Vector<Vector<IDBKeyData>>& indexKeys)
+void UniqueIDBDatabase::putRecordInBackingStore(uint64_t requestID, const IDBIdentifier& transaction, const IDBObjectStoreMetadata& objectStoreMetadata, const IDBKeyData& inputKeyData, const Vector<uint8_t>& value, int64_t putMode, const Vector<int64_t>& indexIDs, const Vector<Vector<IDBKeyData>>& indexKeys)
{
ASSERT(!isMainThread());
ASSERT(m_backingStore);
bool keyWasGenerated = false;
- RefPtr<IDBKey> key;
+ IDBKeyData key;
int64_t keyNumber = 0;
- if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && keyData.isNull) {
+ if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && inputKeyData.isNull) {
if (!m_backingStore->generateKeyNumber(transaction, objectStoreMetadata.id, keyNumber)) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error checking for key existence")));
return;
}
- key = IDBKey::createNumber(keyNumber);
+ key.setNumberValue(keyNumber);
keyWasGenerated = true;
} else
- key = keyData.maybeCreateIDBKey();
+ key = inputKeyData;
- ASSERT(key);
- ASSERT(key->isValid());
-
if (putMode == IDBDatabaseBackend::AddOnly) {
bool keyExists;
- if (!m_backingStore->keyExistsInObjectStore(transaction, objectStoreMetadata.id, keyData, keyExists)) {
+ if (!m_backingStore->keyExistsInObjectStore(transaction, objectStoreMetadata.id, key, keyExists)) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error checking for key existence")));
return;
}
@@ -849,12 +846,12 @@
// The spec says that even if we're about to overwrite the record, perform the steps to delete it first.
// This is important because formally deleting it from from the object store also removes it from the appropriate indexes.
- if (!m_backingStore->deleteRecord(transaction, objectStoreMetadata.id, keyData)) {
+ if (!m_backingStore->deleteRecord(transaction, objectStoreMetadata.id, key)) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Replacing an existing key in backing store, unable to delete previous record.")));
return;
}
- if (!m_backingStore->putRecord(transaction, objectStoreMetadata.id, *key, value.data(), value.size())) {
+ if (!m_backingStore->putRecord(transaction, objectStoreMetadata.id, key, value.data(), value.size())) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error putting a record")));
return;
}
@@ -862,21 +859,21 @@
ASSERT(indexIDs.size() == indexKeys.size());
for (size_t i = 0; i < indexIDs.size(); ++i) {
for (size_t j = 0; j < indexKeys[i].size(); ++j) {
- if (!m_backingStore->putIndexRecord(transaction, objectStoreMetadata.id, indexIDs[i], keyData, indexKeys[i][j])) {
+ if (!m_backingStore->putIndexRecord(transaction, objectStoreMetadata.id, indexIDs[i], key, indexKeys[i][j])) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error writing index key")));
return;
}
}
}
- if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && key->type() == IDBKey::NumberType) {
+ if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && key.type == IDBKey::NumberType) {
if (!m_backingStore->updateKeyGeneratorNumber(transaction, objectStoreMetadata.id, keyNumber, keyWasGenerated)) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error updating key generator")));
return;
}
}
- postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(key.get()), 0, String(StringImpl::empty())));
+ postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, key, 0, String(StringImpl::empty())));
}
void UniqueIDBDatabase::didPutRecordInBackingStore(uint64_t requestID, const IDBKeyData& keyData, uint32_t errorCode, const String& errorMessage)
@@ -924,13 +921,18 @@
// IDBIndex get record
- RefPtr<SharedBuffer> result;
+ IDBGetResult result;
if (!m_backingStore->getIndexRecord(transaction, objectStoreMetadata.id, indexID, keyRangeData, result)) {
postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(), IDBDatabaseException::UnknownError, ASCIILiteral("Failed to get index record from backing store")));
return;
}
- postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, IDBGetResult(result.release()), 0, String(StringImpl::empty())));
+ // A get request that meets the following conditions needs to know the object store keypath
+ // to inject the result key into the result value object.
+ if (objectStoreMetadata.autoIncrement && !objectStoreMetadata.keyPath.isNull())
+ result.keyPath = objectStoreMetadata.keyPath;
+
+ postMainThreadTask(createAsyncTask(*this, &UniqueIDBDatabase::didGetRecordFromBackingStore, requestID, result, 0, String(StringImpl::empty())));
}
void UniqueIDBDatabase::didGetRecordFromBackingStore(uint64_t requestID, const IDBGetResult& result, uint32_t errorCode, const String& errorMessage)
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h (163481 => 163482)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h 2014-02-05 23:59:52 UTC (rev 163482)
@@ -37,6 +37,7 @@
class SharedBuffer;
struct IDBDatabaseMetadata;
+struct IDBGetResult;
struct IDBKeyData;
struct IDBObjectStoreMetadata;
}
@@ -68,9 +69,9 @@
virtual bool updateKeyGeneratorNumber(const IDBIdentifier& transactionIdentifier, int64_t objectStoreId, int64_t keyNumber, bool checkCurrent) = 0;
virtual bool keyExistsInObjectStore(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyData&, bool& keyExists) = 0;
- virtual bool putRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKey&, const uint8_t* valueBuffer, size_t valueSize) = 0;
+ virtual bool putRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyData&, const uint8_t* valueBuffer, size_t valueSize) = 0;
virtual bool putIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyData&, const WebCore::IDBKeyData& indexKey) = 0;
- virtual bool getIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&, RefPtr<WebCore::SharedBuffer>& result) = 0;
+ virtual bool getIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&, WebCore::IDBGetResult&) = 0;
virtual bool deleteRange(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyRangeData&) = 0;
virtual bool deleteRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyData&) = 0;
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp (163481 => 163482)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp 2014-02-05 23:59:52 UTC (rev 163482)
@@ -35,6 +35,7 @@
#include "SQLiteIDBTransaction.h"
#include <WebCore/FileSystem.h>
#include <WebCore/IDBDatabaseMetadata.h>
+#include <WebCore/IDBGetResult.h>
#include <WebCore/IDBKeyData.h>
#include <WebCore/IDBKeyRange.h>
#include <WebCore/SQLiteDatabase.h>
@@ -103,8 +104,8 @@
return nullptr;
}
- if (!m_sqliteDB->executeCommand("CREATE TABLE IndexRecords (indexID INTEGER NOT NULL ON CONFLICT FAIL, objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value NOT NULL ON CONFLICT FAIL);")) {
- LOG_ERROR("Could not create Records table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+ if (!m_sqliteDB->executeCommand("CREATE TABLE IndexRecords (indexID INTEGER NOT NULL ON CONFLICT FAIL, objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL);")) {
+ LOG_ERROR("Could not create IndexRecords table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
m_sqliteDB = nullptr;
return nullptr;
}
@@ -772,7 +773,7 @@
return true;
}
-bool UniqueIDBDatabaseBackingStoreSQLite::putRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const IDBKey& key, const uint8_t* valueBuffer, size_t valueSize)
+bool UniqueIDBDatabaseBackingStoreSQLite::putRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const IDBKeyData& keyData, const uint8_t* valueBuffer, size_t valueSize)
{
ASSERT(!isMainThread());
ASSERT(m_sqliteDB);
@@ -788,7 +789,7 @@
return false;
}
- RefPtr<SharedBuffer> keyBuffer = serializeIDBKeyData(IDBKeyData(&key));
+ RefPtr<SharedBuffer> keyBuffer = serializeIDBKeyData(keyData);
if (!keyBuffer) {
LOG_ERROR("Unable to serialize IDBKey to be stored in the database");
return false;
@@ -851,7 +852,7 @@
return true;
}
-bool UniqueIDBDatabaseBackingStoreSQLite::getIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const IDBKeyRangeData& keyRangeData, RefPtr<SharedBuffer>& result)
+bool UniqueIDBDatabaseBackingStoreSQLite::getIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const IDBKeyRangeData& keyRangeData, IDBGetResult& result)
{
ASSERT(!isMainThread());
ASSERT(m_sqliteDB);
@@ -873,7 +874,8 @@
// Even though we're only using this cursor locally, add it to our cursor set.
m_cursors.set(cursor->identifier(), cursor);
- result = SharedBuffer::create(cursor->currentValueBuffer().data(), cursor->currentValueBuffer().size());
+ result = IDBGetResult(SharedBuffer::create(cursor->currentValueBuffer().data(), cursor->currentValueBuffer().size()));
+ result.keyData = cursor->currentValueKey();
// Closing the cursor will destroy the cursor object and remove it from our cursor set.
transaction->closeCursor(*cursor);
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h (163481 => 163482)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h 2014-02-05 23:47:28 UTC (rev 163481)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h 2014-02-05 23:59:52 UTC (rev 163482)
@@ -72,9 +72,9 @@
virtual bool updateKeyGeneratorNumber(const IDBIdentifier& transactionIdentifier, int64_t objectStoreId, int64_t keyNumber, bool checkCurrent) override;
virtual bool keyExistsInObjectStore(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyData&, bool& keyExists) override;
- virtual bool putRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKey&, const uint8_t* valueBuffer, size_t valueSize) override;
+ virtual bool putRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyData&, const uint8_t* valueBuffer, size_t valueSize) override;
virtual bool putIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyData& keyValue, const WebCore::IDBKeyData& indexKey) override;
- virtual bool getIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&, RefPtr<WebCore::SharedBuffer>& result) override;
+ virtual bool getIndexRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, int64_t indexID, const WebCore::IDBKeyRangeData&, WebCore::IDBGetResult&) override;
virtual bool deleteRange(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyRangeData&) override;
virtual bool deleteRecord(const IDBIdentifier& transactionIdentifier, int64_t objectStoreID, const WebCore::IDBKeyData&) override;