WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-86123-20120619143025.patch (text/plain), 26.20 KB, created by
Alec Flett
on 2012-06-19 14:30:25 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alec Flett
Created:
2012-06-19 14:30:25 PDT
Size:
26.20 KB
patch
obsolete
>Subversion Revision: 120678 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cad3d45bfee594aa0a2876b0a1df8846ae769563..64302da6581f1ac75f4150228a53721d2e8890ad 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,54 @@ >+2012-06-19 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Implement spec behavior for multiEntry indexes with invalid/duplicate subkeys >+ https://bugs.webkit.org/show_bug.cgi?id=86123 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Distinguish between an actual invalid IDBKey, and an array of >+ possibly-invalid subkeys by making IDBKey::isValid() check subkeys >+ if the type is an array. >+ >+ Introduce a new way to transform an IDBKey into a >+ multiEntry-specific IDBKey, (IDBKey::createMultiEntryArray) >+ throwing out duplicates and invalid keys. Use it when storing >+ index entries for multiEntry indexes. >+ >+ No new tests: existing tests have been altered to include new behavior. >+ >+ * Modules/indexeddb/IDBCursor.cpp: >+ (WebCore::IDBCursor::continueFunction): >+ * Modules/indexeddb/IDBFactory.cpp: >+ (WebCore::IDBFactory::cmp): >+ * Modules/indexeddb/IDBIndex.cpp: >+ (WebCore::IDBIndex::get): >+ (WebCore::IDBIndex::getKey): >+ * Modules/indexeddb/IDBKey.cpp: >+ (WebCore::IDBKey::isValid): >+ (WebCore): >+ * Modules/indexeddb/IDBKey.h: >+ (WebCore::IDBKey::createMultiEntryArray): >+ (IDBKey): >+ * Modules/indexeddb/IDBKeyRange.cpp: >+ (WebCore::IDBKeyRange::only): >+ (WebCore::IDBKeyRange::lowerBound): >+ (WebCore::IDBKeyRange::upperBound): >+ (WebCore::IDBKeyRange::bound): >+ * Modules/indexeddb/IDBLevelDBBackingStore.cpp: >+ (WebCore::IDBLevelDBBackingStore::putObjectStoreRecord): >+ (WebCore::IDBLevelDBBackingStore::putIndexDataForRecord): >+ * Modules/indexeddb/IDBLevelDBCoding.cpp: >+ (WebCore::IDBLevelDBCoding::encodeIDBKey): >+ * Modules/indexeddb/IDBObjectStore.cpp: >+ (WebCore::IDBObjectStore::get): >+ (WebCore::IDBObjectStore::add): >+ (WebCore::IDBObjectStore::put): >+ * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: >+ (WebCore::IDBObjectStoreBackendImpl::putInternal): >+ (WebCore): >+ * bindings/v8/IDBBindingUtilities.cpp: >+ (WebCore::createIDBKeyFromValue): >+ > 2012-06-18 Joone Hur <joone.hur@intel.com> > > [EFL] Fontconfig can't be linked properly >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 9992e28e7138909e1250e0b26060fd250acc8445..8a1e779e01a3a4c72685946c9f9e19c15ca55c36 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,19 @@ >+2012-06-19 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Implement spec behavior for multiEntry indexes with invalid/duplicate subkeys >+ https://bugs.webkit.org/show_bug.cgi?id=86123 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add matching isValid() to WebIDBKey to match the one in IDBKey. >+ >+ * public/WebIDBKey.h: >+ * src/WebIDBKey.cpp: >+ (WebKit::WebIDBKey::isValid): >+ (WebKit): >+ * src/WebIDBKeyRange.cpp: >+ (WebKit::WebIDBKeyRange::assign): >+ > 2012-06-18 Adam Barth <abarth@webkit.org> > > [Chromium] GesturePinchBegin and friends are gesture events >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >index 8d218ee85578e82e1f7e41c096b9de2c5f9c2060..2759514eff74224c61799cf5f60779fdce4d2423 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >@@ -183,7 +183,7 @@ void IDBCursor::advance(unsigned long count, ExceptionCode& ec) > void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec) > { > IDB_TRACE("IDBCursor::continue"); >- if (key && (key->type() == IDBKey::InvalidType)) { >+ if (key && !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return; > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp >index 18116f5a3ea9785d1b69d828af3adcde1b6fc6e9..d3de8f6fa5b4e7333640c6313d6d4eff8ee9db53 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp >@@ -133,7 +133,7 @@ short IDBFactory::cmp(PassRefPtr<IDBKey> first, PassRefPtr<IDBKey> second, Excep > ASSERT(first); > ASSERT(second); > >- if (first->type() == IDBKey::InvalidType || second->type() == IDBKey::InvalidType) { >+ if (!first->isValid() || !second->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >index d6d7622bb2a4a9bd8e7ead089dfb55748b1bdea2..9776ff2a9715ec679f083e8809c01ed4f1245a3f 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >@@ -190,7 +190,7 @@ PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr > ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; > return 0; > } >- if (key && (key->type() == IDBKey::InvalidType)) { >+ if (key && !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >@@ -230,7 +230,7 @@ PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRef > ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; > return 0; > } >- if (key && (key->type() == IDBKey::InvalidType)) { >+ if (key && !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBKey.cpp b/Source/WebCore/Modules/indexeddb/IDBKey.cpp >index 598686e1a039adbfdcb2477fffe0911538c6831c..b76ed2cee305d6287f9db13e10dd108e61d684ee 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKey.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBKey.cpp >@@ -40,6 +40,21 @@ IDBKey::~IDBKey() > { > } > >+bool IDBKey::isValid() const >+{ >+ if (m_type == InvalidType) >+ return false; >+ >+ if (m_type == ArrayType) { >+ for (size_t i = 0; i < m_array.size(); i++) { >+ if (!m_array[i]->isValid()) >+ return false; >+ } >+ } >+ >+ return true; >+} >+ > int IDBKey::compare(const IDBKey* other) const > { > ASSERT(other); >diff --git a/Source/WebCore/Modules/indexeddb/IDBKey.h b/Source/WebCore/Modules/indexeddb/IDBKey.h >index 40ce833f9089435211e4971d35730fc2cc584b17..cbfdf1d4fc56ef45af520aa26bd1509a666f5f9f 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKey.h >+++ b/Source/WebCore/Modules/indexeddb/IDBKey.h >@@ -73,6 +73,32 @@ public: > return idbKey.release(); > } > >+ static PassRefPtr<IDBKey> createMultiEntryArray(const KeyArray& array) >+ { >+ RefPtr<IDBKey> idbKey = adoptRef(new IDBKey()); >+ idbKey->m_type = ArrayType; >+ KeyArray& result = idbKey->m_array; >+ >+ for (size_t i = 0; i < array.size(); i++) { >+ if (!array[i]->isValid()) >+ continue; >+ >+ bool skip = false; >+ for (size_t j = 0; j < result.size(); j++) { >+ if (array[i]->isEqual(result[j].get())) { >+ skip = true; >+ break; >+ } >+ } >+ if (!skip) { >+ result.append(array[i]); >+ idbKey->m_sizeEstimate += array[i]->m_sizeEstimate; >+ } >+ } >+ ASSERT(idbKey->isValid()); >+ return idbKey.release(); >+ } >+ > static PassRefPtr<IDBKey> createArray(const KeyArray& array) > { > RefPtr<IDBKey> idbKey = adoptRef(new IDBKey()); >@@ -98,7 +124,7 @@ public: > }; > > Type type() const { return m_type; } >- bool isValid() const { return m_type != InvalidType; } >+ bool isValid() const; > > const KeyArray& array() const > { >diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp b/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp >index 0c2326e5d643b306429511949e29ff3fac7e20ec..e8013f124e110a870ccc870bd24ff36baf47b193 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp >@@ -44,7 +44,7 @@ IDBKeyRange::IDBKeyRange(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, Low > PassRefPtr<IDBKeyRange> IDBKeyRange::only(PassRefPtr<IDBKey> prpKey, ExceptionCode& ec) > { > RefPtr<IDBKey> key = prpKey; >- if (key && (key->type() == IDBKey::InvalidType)) { >+ if (key && !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >@@ -54,7 +54,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::only(PassRefPtr<IDBKey> prpKey, ExceptionCo > > PassRefPtr<IDBKeyRange> IDBKeyRange::lowerBound(PassRefPtr<IDBKey> bound, bool open, ExceptionCode& ec) > { >- if (bound && (bound->type() == IDBKey::InvalidType)) { >+ if (bound && !bound->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >@@ -64,7 +64,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::lowerBound(PassRefPtr<IDBKey> bound, bool o > > PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool open, ExceptionCode& ec) > { >- if (bound && (bound->type() == IDBKey::InvalidType)) { >+ if (bound && !bound->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >@@ -74,7 +74,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool o > > PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, bool lowerOpen, bool upperOpen, ExceptionCode& ec) > { >- if ((lower && (lower->type() == IDBKey::InvalidType)) || (upper && (upper->type() == IDBKey::InvalidType))) { >+ if ((lower && !lower->isValid()) || (upper && !upper->isValid())) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp >index 49777c61bf35cc7b64d11f315fa233d5d77695fc..8dcb4605c0ac7c3032142ef442c2126343859b57 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp >@@ -587,6 +587,7 @@ static int64_t getNewVersionNumber(LevelDBTransaction* transaction, int64_t data > > bool IDBLevelDBBackingStore::putObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey& key, const String& value, ObjectStoreRecordIdentifier* recordIdentifier) > { >+ ASSERT(key.isValid()); > ASSERT(m_currentTransaction); > int64_t version = getNewVersionNumber(m_currentTransaction.get(), databaseId, objectStoreId); > const Vector<char> objectStoredataKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, key); >@@ -869,6 +870,7 @@ void IDBLevelDBBackingStore::deleteIndex(int64_t databaseId, int64_t objectStore > > bool IDBLevelDBBackingStore::putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const ObjectStoreRecordIdentifier* recordIdentifier) > { >+ ASSERT(key.isValid()); > ASSERT(indexId >= kMinimumIndexId); > const LevelDBRecordIdentifier* levelDBRecordIdentifier = static_cast<const LevelDBRecordIdentifier*>(recordIdentifier); > >diff --git a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp >index 47c9f7d3d1f4f1d6a22118f641981d3575ee5da7..bf195adca4b7dba95dbd77869be8816016f0ec32 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp >@@ -387,6 +387,7 @@ Vector<char> encodeIDBKey(const IDBKey& key) > void encodeIDBKey(const IDBKey& key, Vector<char>& into) > { > size_t previousSize = into.size(); >+ ASSERT(key.isValid()); > switch (key.type()) { > case IDBKey::InvalidType: > case IDBKey::MinType: >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >index 2afcb30e148502d91b7876cdc6122bf2f52548d8..722dae06d0e6ca1cbb3ce0c8985aea5b145992ad 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >@@ -110,7 +110,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, Pass > return 0; > } > >- if (!key || (key->type() == IDBKey::InvalidType)) { >+ if (!key || !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >@@ -133,7 +133,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, Pass > return 0; > } > >- if (key && (key->type() == IDBKey::InvalidType)) { >+ if (key && !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >@@ -166,7 +166,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, Pass > return 0; > } > >- if (key && (key->type() == IDBKey::InvalidType)) { >+ if (key && !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >index dc413439a7e5fcefcd71ba11e9ea36b7fb7c0cdf..8ab582a20e80b58b5c6e4179c154770cd6a3276d 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >@@ -264,6 +264,9 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > const RefPtr<IDBIndexBackendImpl>& index = it->second; > > RefPtr<IDBKey> indexKey = fetchKeyFromKeyPath(value.get(), index->keyPath()); >+ if (indexKey && index->multiEntry() && indexKey->type() == IDBKey::ArrayType) >+ indexKey = IDBKey::createMultiEntryArray(indexKey->array()); >+ > if (!indexKey || !indexKey->isValid()) { > // Null/invalid keys not added to index; null entry keeps iterator/vector indexes consistent. > indexKey.clear(); >@@ -279,7 +282,7 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > } > > if (index->multiEntry() && indexKey->type() == IDBKey::ArrayType) { >- for (size_t j = 0; j < indexKey->array().size(); ++j) { >+ for (size_t j = 0; j < indexKey->array().size(); ++j) { > if (!index->addingKeyAllowed(indexKey->array()[j].get(), key.get())) { > objectStore->resetAutoIncrementKeyCache(); > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); >@@ -442,8 +445,10 @@ public: > } else { > ASSERT(m_index->multiEntry()); > ASSERT(indexKey->type() == IDBKey::ArrayType); >+ >+ indexKey = IDBKey::createMultiEntryArray(indexKey->array()); > for (size_t i = 0; i < indexKey->array().size(); ++i) { >- if (!m_index->addingKeyAllowed(indexKey.get())) >+ if (!m_index->addingKeyAllowed(indexKey->array()[i].get())) > return false; > if (!m_backingStore.putIndexDataForRecord(m_databaseId, m_objectStoreId, m_index->id(), *indexKey->array()[i], recordIdentifier)) > return false; >diff --git a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp >index d316ad7299f4e28314595e35dc3fd0507283c63c..ee76ee29a001d6cd76c5f17ad35ecb7fcc674c29 100644 >--- a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp >+++ b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp >@@ -65,8 +65,9 @@ static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vec > v8::Local<v8::Value> item = array->Get(v8::Int32::New(i)); > RefPtr<IDBKey> subkey = createIDBKeyFromValue(item, stack); > if (!subkey) >- return 0; >- subkeys.append(subkey); >+ subkeys.append(IDBKey::createInvalid()); >+ else >+ subkeys.append(subkey); > } > > stack.removeLast(); >diff --git a/Source/WebKit/chromium/public/WebIDBKey.h b/Source/WebKit/chromium/public/WebIDBKey.h >index a78142345940bda168a0672d37fe740acace431c..0b704cac284461cc36101ae61aed658d40361904 100644 >--- a/Source/WebKit/chromium/public/WebIDBKey.h >+++ b/Source/WebKit/chromium/public/WebIDBKey.h >@@ -79,6 +79,7 @@ public: > }; > > WEBKIT_EXPORT Type type() const; >+ WEBKIT_EXPORT bool isValid() const; > WEBKIT_EXPORT WebVector<WebIDBKey> array() const; // Only valid for ArrayType. > WEBKIT_EXPORT WebString string() const; // Only valid for StringType. > WEBKIT_EXPORT double date() const; // Only valid for DateType. >diff --git a/Source/WebKit/chromium/src/WebIDBKey.cpp b/Source/WebKit/chromium/src/WebIDBKey.cpp >index 25be6c52f74453d7d36abdc082d62483b448df0b..cfadafbacd97389e85f6e4c3de1922504aba39a7 100644 >--- a/Source/WebKit/chromium/src/WebIDBKey.cpp >+++ b/Source/WebKit/chromium/src/WebIDBKey.cpp >@@ -120,6 +120,8 @@ static PassRefPtr<IDBKey> convertFromWebIDBKeyArray(const WebVector<WebIDBKey>& > keys.append(IDBKey::createNumber(array[i].number())); > break; > case WebIDBKey::InvalidType: >+ keys.append(IDBKey::createInvalid()); >+ break; > case WebIDBKey::NullType: > ASSERT_NOT_REACHED(); > break; >@@ -149,6 +151,8 @@ static void convertToWebIDBKeyArray(const IDBKey::KeyArray& array, WebVector<Web > keys[i] = WebIDBKey::createNumber(key->number()); > break; > case IDBKey::InvalidType: >+ keys[i] = WebIDBKey::createInvalid(); >+ break; > case IDBKey::MinType: > ASSERT_NOT_REACHED(); > break; >@@ -199,6 +203,13 @@ WebIDBKey::Type WebIDBKey::type() const > return Type(m_private->type()); > } > >+bool WebIDBKey::isValid() const >+{ >+ if (!m_private.get()) >+ return false; >+ return m_private->isValid(); >+} >+ > WebVector<WebIDBKey> WebIDBKey::array() const > { > WebVector<WebIDBKey> keys; >diff --git a/Source/WebKit/chromium/src/WebIDBKeyRange.cpp b/Source/WebKit/chromium/src/WebIDBKeyRange.cpp >index fef0d3c3daeaa540bab7383b5b370432ad62f8fc..419261c223edd655dd455df645a3671cacf0441d 100644 >--- a/Source/WebKit/chromium/src/WebIDBKeyRange.cpp >+++ b/Source/WebKit/chromium/src/WebIDBKeyRange.cpp >@@ -43,7 +43,7 @@ void WebIDBKeyRange::assign(const WebIDBKeyRange& other) > > void WebIDBKeyRange::assign(const WebIDBKey& lower, const WebIDBKey& upper, bool lowerOpen, bool upperOpen) > { >- if (lower.type() == WebIDBKey::InvalidType && upper.type() == WebIDBKey::InvalidType) >+ if (!lower.isValid() && !upper.isValid()) > m_private = 0; > else > m_private = IDBKeyRange::create(lower, upper, lowerOpen ? IDBKeyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed, upperOpen ? IDBKeyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index abfdbb09381440835c2f0f6429f0197740a798bc..180ec34b97bfabe9e25f1977a3438601dfded134 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,20 @@ >+2012-06-19 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Implement spec behavior for multiEntry indexes with invalid/duplicate subkeys >+ https://bugs.webkit.org/show_bug.cgi?id=86123 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * storage/indexeddb/index-multientry-expected.txt: >+ * storage/indexeddb/resources/index-multientry.js: >+ (addData): >+ (verifyIndexes.request.onsuccess): >+ (verifyIndexes): >+ (verifyUniqueConstraint.request.onsuccess.request.onsuccess.request.onerror): >+ (verifyUniqueConstraint.request.onsuccess.request.onsuccess): >+ (verifyUniqueConstraint.request.onsuccess): >+ (verifyUniqueConstraint): >+ > 2012-06-18 Zan Dobersek <zandobersek@gmail.com> > > Unreviewed GTK gardening, updating baselines after rollouts in r120627. >diff --git a/LayoutTests/storage/indexeddb/index-multientry-expected.txt b/LayoutTests/storage/indexeddb/index-multientry-expected.txt >index 3b8b07b38146e88342260120702af5356371f70c..82cbd49febcf151398abbf731f5e77cf61d606fb 100644 >--- a/LayoutTests/storage/indexeddb/index-multientry-expected.txt >+++ b/LayoutTests/storage/indexeddb/index-multientry-expected.txt >@@ -25,6 +25,8 @@ transaction.objectStore('store').put({x: [7, 8, 9], y: 'a'}, 'foo') > Now overwrite them with what we're expecting > transaction.objectStore('store').put({x: [1, 2, 3], y: 'a'}, 'foo') > transaction.objectStore('store').put({x: [4, 5, 6], y: 'b'}, 'bar') >+transaction.objectStore('store').put({x: [7, 7, 8, 7], y: 'c'}, 'baz') >+transaction.objectStore('store').put({x: [null, 9, 9], y: 'd'}, 'bloop') > > Verifying index: index > transaction = db.transaction(['store'], 'readonly') >@@ -34,31 +36,55 @@ PASS ex is non-null. > PASS cursor.key is 1 > PASS cursor.primaryKey is "foo" > PASS cursor.value.y is "a" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 2 > PASS cursor.primaryKey is "foo" > PASS cursor.value.y is "a" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 3 > PASS cursor.primaryKey is "foo" > PASS cursor.value.y is "a" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 4 > PASS cursor.primaryKey is "bar" > PASS cursor.value.y is "b" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 5 > PASS cursor.primaryKey is "bar" > PASS cursor.value.y is "b" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 6 > PASS cursor.primaryKey is "bar" > PASS cursor.value.y is "b" >+cursor.continue() >+cursor = event.target.result >+PASS ex is non-null. >+PASS cursor.key is 7 >+PASS cursor.primaryKey is "baz" >+PASS cursor.value.y is "c" >+cursor.continue() >+cursor = event.target.result >+PASS ex is non-null. >+PASS cursor.key is 8 >+PASS cursor.primaryKey is "baz" >+PASS cursor.value.y is "c" >+cursor.continue() >+cursor = event.target.result >+PASS ex is non-null. >+PASS cursor.key is 9 >+PASS cursor.primaryKey is "bloop" >+PASS cursor.value.y is "d" >+cursor.continue() > cursor = event.target.result > PASS expected.length is 0 > >@@ -71,7 +97,7 @@ transaction.objectStore('store-unique').put({x: [1, 2, 7], y: 'a'}, 'foo') > success! > This should fail the uniqueness constraint on the index, and fail: > transaction.objectStore('store-unique').put({x: [5, 2], y: 'c'}, 'should fail') >-Request failed, as expected >+Request failed, as expected (DataError) > Transaction aborted as expected > > Create an index on a populated store >@@ -89,31 +115,55 @@ PASS ex is non-null. > PASS cursor.key is 1 > PASS cursor.primaryKey is "foo" > PASS cursor.value.y is "a" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 2 > PASS cursor.primaryKey is "foo" > PASS cursor.value.y is "a" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 3 > PASS cursor.primaryKey is "foo" > PASS cursor.value.y is "a" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 4 > PASS cursor.primaryKey is "bar" > PASS cursor.value.y is "b" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 5 > PASS cursor.primaryKey is "bar" > PASS cursor.value.y is "b" >+cursor.continue() > cursor = event.target.result > PASS ex is non-null. > PASS cursor.key is 6 > PASS cursor.primaryKey is "bar" > PASS cursor.value.y is "b" >+cursor.continue() >+cursor = event.target.result >+PASS ex is non-null. >+PASS cursor.key is 7 >+PASS cursor.primaryKey is "baz" >+PASS cursor.value.y is "c" >+cursor.continue() >+cursor = event.target.result >+PASS ex is non-null. >+PASS cursor.key is 8 >+PASS cursor.primaryKey is "baz" >+PASS cursor.value.y is "c" >+cursor.continue() >+cursor = event.target.result >+PASS ex is non-null. >+PASS cursor.key is 9 >+PASS cursor.primaryKey is "bloop" >+PASS cursor.value.y is "d" >+cursor.continue() > cursor = event.target.result > PASS expected.length is 0 > PASS successfullyParsed is true >diff --git a/LayoutTests/storage/indexeddb/resources/index-multientry.js b/LayoutTests/storage/indexeddb/resources/index-multientry.js >index 9e1ad7a59e2ccc54c561a30ba92f1112ea7a370f..58fb92d1f9dfaa45eabb4f5b778e2009211efba3 100644 >--- a/LayoutTests/storage/indexeddb/resources/index-multientry.js >+++ b/LayoutTests/storage/indexeddb/resources/index-multientry.js >@@ -54,6 +54,10 @@ function addData() > request.onerror = unexpectedErrorCallback; > request = evalAndLog("transaction.objectStore('store').put({x: [4, 5, 6], y: 'b'}, 'bar')"); > request.onerror = unexpectedErrorCallback; >+ request = evalAndLog("transaction.objectStore('store').put({x: [7, 7, 8, 7], y: 'c'}, 'baz')"); >+ request.onerror = unexpectedErrorCallback; >+ request = evalAndLog("transaction.objectStore('store').put({x: [null, 9, 9], y: 'd'}, 'bloop')"); >+ request.onerror = unexpectedErrorCallback; > } > > function verifyIndexes(indexName, callback) >@@ -71,6 +75,9 @@ function verifyIndexes(indexName, callback) > { key: 4, primaryKey: 'bar', y: 'b' }, > { key: 5, primaryKey: 'bar', y: 'b' }, > { key: 6, primaryKey: 'bar', y: 'b' }, >+ { key: 7, primaryKey: 'baz', y: 'c' }, >+ { key: 8, primaryKey: 'baz', y: 'c' }, >+ { key: 9, primaryKey: 'bloop', y: 'd' }, > ]; > > var request = evalAndLog("transaction.objectStore('store').index('" + indexName + "').openCursor()"); >@@ -83,7 +90,7 @@ function verifyIndexes(indexName, callback) > shouldBe("cursor.key", String(ex.key)); > shouldBeEqualToString("cursor.primaryKey", ex.primaryKey); > shouldBeEqualToString("cursor.value.y", ex.y); >- cursor.continue(); >+ evalAndLog("cursor.continue()"); > } else { > shouldBe("expected.length", "0"); > } >@@ -113,7 +120,7 @@ function verifyUniqueConstraint() > debug("This should fail the uniqueness constraint on the index, and fail:"); > request = evalAndLog("transaction.objectStore('store-unique').put({x: [5, 2], y: 'c'}, 'should fail')"); > request.onsuccess = unexpectedSuccessCallback; >- request.onerror = function() { debug("Request failed, as expected"); }; >+ request.onerror = function() { debug("Request failed, as expected (" + request.error.name + ")"); }; > }; > }; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 86123
:
148395
|
148414
|
148425
|
148848
|
148851