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-88690-20120608144943.patch (text/plain), 27.86 KB, created by
Alec Flett
on 2012-06-08 14:49:43 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alec Flett
Created:
2012-06-08 14:49:43 PDT
Size:
27.86 KB
patch
obsolete
>Subversion Revision: 119830 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 231336322490b4c8202b229b8a9315f603abb7aa..9938274ed9e25a23951e084bd3dd38d3feec5535 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2012-06-08 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Error codes, phase two >+ https://bugs.webkit.org/show_bug.cgi?id=88690 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update the next phase of IndexedDB error codes to match the spec. >+ This update is mostly focused on DATA_ERR vs CONSTRAINT_ERR. >+ >+ Also moves some of the error checking for the transaction mode >+ into the frontend and replaces the backend checks with asserts, so that >+ we can consolidate error checking in one place. >+ >+ This also removes a few FIXME's that are no longer true (about >+ I/O errors - the spec was updated and our implementation was >+ already correct. >+ >+ No new tests, existing tests cover changed behavior. >+ >+ * Modules/indexeddb/IDBCursor.cpp: >+ (WebCore::IDBCursor::deleteFunction): >+ * Modules/indexeddb/IDBCursorBackendImpl.cpp: >+ (WebCore::IDBCursorBackendImpl::deleteFunction): >+ * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: >+ (WebCore::IDBDatabaseBackendImpl::setVersionInternal): >+ * Modules/indexeddb/IDBObjectStore.cpp: >+ (WebCore::IDBObjectStore::add): >+ (WebCore::IDBObjectStore::put): >+ (WebCore::IDBObjectStore::deleteFunction): >+ (WebCore::IDBObjectStore::clear): >+ * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: >+ (WebCore::IDBObjectStoreBackendImpl::put): >+ (WebCore::IDBObjectStoreBackendImpl::putInternal): >+ (WebCore::IDBObjectStoreBackendImpl::deleteFunction): >+ (WebCore::IDBObjectStoreBackendImpl::clear): >+ * Modules/indexeddb/IDBTransaction.h: >+ (WebCore::IDBTransaction::enumMode): >+ * Modules/indexeddb/IDBTransactionBackendImpl.h: >+ > 2012-06-08 Alexei Filippov <alexeif@chromium.org> > > Web Inspector: Better labels positioning on the memory pie chart >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >index b624a35968572e028730da566eb04a5f824afd96..04398634cb205a500d2ee2888adc571caecb7302 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >@@ -205,6 +205,11 @@ void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec) > PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec) > { > IDB_TRACE("IDBCursor::delete"); >+ if (m_transaction->enumMode() == IDBTransaction::READ_ONLY) { >+ ec = IDBDatabaseException::READ_ONLY_ERR; >+ return 0; >+ } >+ > if (!m_gotValue) { > ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; > return 0; >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp >index e1d71da2214d6df66dc05cc6a340e237b6e307d1..eb73e0c32de3288c2800574b805477871964809e 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp >@@ -163,6 +163,8 @@ void IDBCursorBackendImpl::continueFunctionInternal(ScriptExecutionContext*, Pas > void IDBCursorBackendImpl::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec) > { > IDB_TRACE("IDBCursorBackendImpl::delete"); >+ ASSERT(m_transaction->mode() != IDBTransaction::READ_ONLY); >+ > if (!m_cursor || m_cursorType == IndexKeyCursor) { > ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; > return; >diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp >index 9980c02a5d3561143b69a25ad4fa2ceb32259077..739c468e41cf7ea2d0117633b858e1d7524ce9c4 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp >@@ -249,7 +249,6 @@ void IDBDatabaseBackendImpl::setVersionInternal(ScriptExecutionContext*, PassRef > int64_t databaseId = database->id(); > database->m_version = version; > if (!database->m_backingStore->updateIDBDatabaseMetaData(databaseId, database->m_version)) { >- // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); > transaction->abort(); > return; >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >index 109a7515f87583a276a5222ec0bebb9cb49631f0..2fd4fe6ce8d6c7a47418efaddbbc4f038e40ac9b 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >@@ -118,6 +118,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, Pass > PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> key, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStore::add"); >+ if (m_transaction->enumMode() == IDBTransaction::READ_ONLY) { >+ ec = IDBDatabaseException::READ_ONLY_ERR; >+ return 0; >+ } >+ > if (key && (key->type() == IDBKey::InvalidType)) { > ec = IDBDatabaseException::DATA_ERR; > return 0; >@@ -142,6 +147,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, Pass > PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> key, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStore::put"); >+ if (m_transaction->enumMode() == IDBTransaction::READ_ONLY) { >+ ec = IDBDatabaseException::READ_ONLY_ERR; >+ return 0; >+ } >+ > if (key && (key->type() == IDBKey::InvalidType)) { > ec = IDBDatabaseException::DATA_ERR; > return 0; >@@ -166,6 +176,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, Pass > PassRefPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStore::delete"); >+ if (m_transaction->enumMode() == IDBTransaction::READ_ONLY) { >+ ec = IDBDatabaseException::READ_ONLY_ERR; >+ return 0; >+ } >+ > if (!keyRange) { > ec = IDBDatabaseException::DATA_ERR; > return 0; >@@ -183,6 +198,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* co > PassRefPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStore::delete"); >+ if (m_transaction->enumMode() == IDBTransaction::READ_ONLY) { >+ ec = IDBDatabaseException::READ_ONLY_ERR; >+ return 0; >+ } >+ > if (!key || !key->isValid()) { > ec = IDBDatabaseException::DATA_ERR; > return 0; >@@ -200,6 +220,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* co > PassRefPtr<IDBRequest> IDBObjectStore::clear(ScriptExecutionContext* context, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStore::clear"); >+ if (m_transaction->enumMode() == IDBTransaction::READ_ONLY) { >+ ec = IDBDatabaseException::READ_ONLY_ERR; >+ return 0; >+ } >+ > RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); > m_backend->clear(request, m_transaction->backend(), ec); > if (ec) { >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >index 1b3963060134962810cc88407119c0796e1efc4d..2af8abdf962a92040bcad685cf7a5ec82a1dd0be 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >@@ -142,10 +142,8 @@ static PassRefPtr<SerializedScriptValue> injectKeyIntoKeyPath(PassRefPtr<IDBKey> > void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStoreBackendImpl::put"); >- if (transactionPtr->mode() == IDBTransaction::READ_ONLY) { >- ec = IDBDatabaseException::READ_ONLY_ERR; >- return; >- } >+ >+ ASSERT(transactionPtr->mode() != IDBTransaction::READ_ONLY); > > RefPtr<IDBObjectStoreBackendImpl> objectStore = this; > RefPtr<SerializedScriptValue> value = prpValue; >@@ -240,7 +238,6 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > if (!valueAfterInjection) { > objectStore->resetAutoIncrementKeyCache(); > // Checks in put() ensure this should only happen if I/O error occurs. >- // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error inserting generated key into the object.")); > return; > } >@@ -278,7 +275,7 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > > if ((!index->multiEntry() || indexKey->type() != IDBKey::ArrayType) && !index->addingKeyAllowed(indexKey.get(), key.get())) { > objectStore->resetAutoIncrementKeyCache(); >- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); >+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); > return; > } > >@@ -286,7 +283,7 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > 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::CONSTRAINT_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); >+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); > return; > } > } >@@ -298,7 +295,6 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > // Before this point, don't do any mutation. After this point, rollback the transaction in case of error. > > if (!objectStore->backingStore()->putObjectStoreRecord(objectStore->databaseId(), objectStore->id(), *key, value->toWireString(), recordIdentifier.get())) { >- // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); > transaction->abort(); > return; >@@ -311,7 +307,6 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > continue; // The index object has been created, but does not exist in the database yet. > > if (!objectStore->backingStore()->deleteIndexDataForRecord(objectStore->databaseId(), objectStore->id(), index->id(), recordIdentifier.get())) { >- // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); > transaction->abort(); > return; >@@ -323,7 +318,6 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > > if (!index->multiEntry() || indexKey->type() != IDBKey::ArrayType) { > if (!objectStore->backingStore()->putIndexDataForRecord(objectStore->databaseId(), objectStore->id(), index->id(), *indexKey, recordIdentifier.get())) { >- // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); > transaction->abort(); > return; >@@ -333,7 +327,6 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< > ASSERT(indexKey->type() == IDBKey::ArrayType); > for (size_t j = 0; j < indexKey->array().size(); ++j) { > if (!objectStore->backingStore()->putIndexDataForRecord(objectStore->databaseId(), objectStore->id(), index->id(), *indexKey->array()[j], recordIdentifier.get())) { >- // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. > callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage.")); > transaction->abort(); > return; >@@ -364,10 +357,8 @@ void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKey> prpKey, PassRe > void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStoreBackendImpl::delete"); >- if (transaction->mode() == IDBTransaction::READ_ONLY) { >- ec = IDBDatabaseException::READ_ONLY_ERR; >- return; >- } >+ >+ ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); > > RefPtr<IDBObjectStoreBackendImpl> objectStore = this; > RefPtr<IDBKeyRange> keyRange = prpKeyRange; >@@ -409,10 +400,8 @@ void IDBObjectStoreBackendImpl::deleteInternal(ScriptExecutionContext*, PassRefP > void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) > { > IDB_TRACE("IDBObjectStoreBackendImpl::clear"); >- if (transaction->mode() == IDBTransaction::READ_ONLY) { >- ec = IDBDatabaseException::READ_ONLY_ERR; >- return; >- } >+ >+ ASSERT(transaction->mode() != IDBTransaction::READ_ONLY); > > RefPtr<IDBObjectStoreBackendImpl> objectStore = this; > RefPtr<IDBCallbacks> callbacks = prpCallbacks; >diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.h b/Source/WebCore/Modules/indexeddb/IDBTransaction.h >index 1cebe9c193d927bc1596267eb73568b71fb59e72..60394ea70dc1f942589fab4c587507d6cf52e2a6 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.h >+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.h >@@ -70,6 +70,7 @@ public: > bool isFinished() const; > > const String& mode() const; >+ unsigned short enumMode() const { return m_mode; } > IDBDatabase* db() const; > PassRefPtr<DOMError> error(ExceptionCode&) const; > void setError(PassRefPtr<DOMError>); >diff --git a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h >index 2f9c2ba8412a29db9f963cbebd1ce56aea73bd24..4ea3bfd43713add49a81777144d1625cd16d1efd 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h >+++ b/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h >@@ -76,7 +76,7 @@ private: > void closeOpenCursors(); > > RefPtr<DOMStringList> m_objectStoreNames; >- unsigned short m_mode; >+ const unsigned short m_mode; > > State m_state; > RefPtr<IDBTransactionCallbacks> m_callbacks; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 75a692bdf36061af717463e8be2aa08c95e8cfd4..8bbf81bce8dab9d4518b25822334ba550c1e5a51 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,26 @@ >+2012-06-08 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Error codes, phase two >+ https://bugs.webkit.org/show_bug.cgi?id=88690 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * storage/indexeddb/cursor-advance-expected.txt: >+ * storage/indexeddb/index-unique-expected.txt: >+ * storage/indexeddb/mozilla/index-prev-no-duplicate-expected.txt: >+ * storage/indexeddb/mozilla/index-prev-no-duplicate.html: >+ * storage/indexeddb/objectstore-basics-expected.txt: >+ * storage/indexeddb/objectstore-basics-workers-expected.txt: >+ * storage/indexeddb/resources/cursor-advance.js: >+ (openSuccess): >+ (createObjectStore.trans.oncomplete): >+ (createObjectStore): >+ (populateObjectStore): >+ * storage/indexeddb/resources/index-unique.js: >+ (addMoreDataFailed): >+ * storage/indexeddb/resources/objectstore-basics.js: >+ (addAgainFailure): >+ > 2012-06-08 Qi Zhang <qi.2.zhang@nokia.com> > > [Qt] fast/viewport/viewport-133.html fails >diff --git a/LayoutTests/storage/indexeddb/cursor-advance-expected.txt b/LayoutTests/storage/indexeddb/cursor-advance-expected.txt >index 3ad9e092ebd9292d537b6343e7599fd78e40766d..0c4235a3361af69e607d9bb08d7a129b65151f59 100644 >--- a/LayoutTests/storage/indexeddb/cursor-advance-expected.txt >+++ b/LayoutTests/storage/indexeddb/cursor-advance-expected.txt >@@ -10,7 +10,14 @@ openSuccess(): > db = event.target.result > request = db.setVersion('1') > Deleted all object stores. >+trans = request.result > objectStore = db.createObjectStore(objectStoreName); >+Now create the indexes. >+objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >+objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >+objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >+trans = db.transaction(objectStoreName, 'readwrite') >+objectStore = trans.objectStore(objectStoreName) > First, add all our data to the object store. > request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); > request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); >@@ -25,11 +32,6 @@ request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); > request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); > request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); > request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); >-Now create the indexes. >-objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >-objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >-objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >-testAll() > testSimple() > trans = db.transaction(objectStoreName) > store = trans.objectStore(objectStoreName) >diff --git a/LayoutTests/storage/indexeddb/index-unique-expected.txt b/LayoutTests/storage/indexeddb/index-unique-expected.txt >index fb107fa6b7e942a67c24569bdaba1c03eaf9c091..2b7e9642e9bd58e179ca7e2b5b21c84bf71c263a 100644 >--- a/LayoutTests/storage/indexeddb/index-unique-expected.txt >+++ b/LayoutTests/storage/indexeddb/index-unique-expected.txt >@@ -21,8 +21,8 @@ addMoreData(): > transaction.objectStore('store').put({x: 1}, 'bar') > addMoreDataFailed(): > event.preventDefault() >-PASS event.target.errorCode is IDBDatabaseException.CONSTRAINT_ERR >-PASS event.target.error.name is 'ConstraintError' >+PASS event.target.errorCode is IDBDatabaseException.DATA_ERR >+PASS event.target.error.name is 'DataError' > transaction.objectStore('store').put({x: 0}, 'foo') > changeDataSuccess(): > transaction.objectStore('store').index('index').openCursor(IDBKeyRange.lowerBound(1)) >diff --git a/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate-expected.txt b/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate-expected.txt >index b7805f1faa45a7a9d8dde2966b7aec7f3bec8317..690d8ae50ac9f0bd76ebab127e58b407f4d54dbd 100644 >--- a/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate-expected.txt >+++ b/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate-expected.txt >@@ -18,6 +18,7 @@ openSuccess(): > db = event.target.result > request = db.setVersion('1') > Deleted all object stores. >+trans = request.result > objectStore = db.createObjectStore(objectStoreName); > First, add all our data to the object store. > request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key); >@@ -33,6 +34,8 @@ Now create the indexes. > objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); > objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); > objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options); >+trans = db.transaction(objectStoreName, 'readwrite') >+objectStore = trans.objectStore(objectStoreName) > testPrev() > trans = db.transaction(objectStoreName) > objectStore = trans.objectStore(objectStoreName); >diff --git a/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate.html b/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate.html >index 8a96387bdea869f22d013b3abe6aff221d16ecaf..45a16c94b9b94bc762a589fd597ab8d32ec9709e 100644 >--- a/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate.html >+++ b/LayoutTests/storage/indexeddb/mozilla/index-prev-no-duplicate.html >@@ -78,16 +78,16 @@ function openSuccess() > ]; > > request = evalAndLog("request = db.setVersion('1')"); >- request.onsuccess = createAndPopulateObjectStore; >+ request.onsuccess = createObjectStore; > request.onerror = unexpectedErrorCallback; > } > >-function createAndPopulateObjectStore() >+function createObjectStore(request) > { > deleteAllObjectStores(db); > >+ evalAndLog("trans = request.result"); > objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName);"); >- > debug("First, add all our data to the object store."); > addedData = 0; > for (i in objectStoreData) { >@@ -100,6 +100,11 @@ function createAndPopulateObjectStore() > } > } > } >+ trans.oncomplete = function() { >+ evalAndLog("trans = db.transaction(objectStoreName, 'readwrite')"); >+ evalAndLog("objectStore = trans.objectStore(objectStoreName)"); >+ testPrev(); >+ } > } > > function createIndexes() >@@ -108,9 +113,6 @@ function createIndexes() > for (i in indexData) { > evalAndLog("objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);"); > } >- >- >- testPrev(); > } > > function testPrev() >diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt >index 48d2fa6554e9d079231bff5d9673c6a67be6c63e..be06bbea36f7ded833bdf8dffb6b7e1a5cc8f2e2 100644 >--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt >+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt >@@ -96,8 +96,8 @@ addSuccess(): > PASS event.target.result is "key" > event.target.source.add({x: 'foo'}, 'zzz') > addAgainFailure(): >-PASS event.target.errorCode is IDBDatabaseException.CONSTRAINT_ERR >-PASS event.target.error.name is 'ConstraintError' >+PASS event.target.errorCode is IDBDatabaseException.DATA_ERR >+PASS event.target.error.name is 'DataError' > event.preventDefault() > db.transaction(['storeName'], 'readwrite') > store = transaction.objectStore('storeName') >diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txt >index 58edde04ab86e34b4542e7d48b31c32ac6b6ee22..2b6edb00db23efcf4c09c8d50da7609e815f8800 100644 >--- a/LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txt >+++ b/LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txt >@@ -97,8 +97,8 @@ PASS [Worker] code is DOMException.DATA_CLONE_ERR > PASS [Worker] event.target.result is "key" > [Worker] event.target.source.add({x: 'foo'}, 'zzz') > [Worker] addAgainFailure(): >-PASS [Worker] event.target.errorCode is IDBDatabaseException.CONSTRAINT_ERR >-PASS [Worker] event.target.error.name is 'ConstraintError' >+PASS [Worker] event.target.errorCode is IDBDatabaseException.DATA_ERR >+PASS [Worker] event.target.error.name is 'DataError' > [Worker] event.preventDefault() > [Worker] db.transaction(['storeName'], 'readwrite') > [Worker] store = transaction.objectStore('storeName') >diff --git a/LayoutTests/storage/indexeddb/resources/cursor-advance.js b/LayoutTests/storage/indexeddb/resources/cursor-advance.js >index ffa93389fb4f3c9a5ac94e6650d52a9a7850233e..ff91daa4efc880d56744a4adaae857446194e9bc 100644 >--- a/LayoutTests/storage/indexeddb/resources/cursor-advance.js >+++ b/LayoutTests/storage/indexeddb/resources/cursor-advance.js >@@ -44,24 +44,32 @@ function openSuccess() > objectStoreName = "People"; > > request = evalAndLog("request = db.setVersion('1')"); >- request.onsuccess = createAndPopulateObjectStore; >+ request.onsuccess = createObjectStore; > request.onerror = unexpectedErrorCallback; > } > >-function createAndPopulateObjectStore() >+function createObjectStore(request) > { > deleteAllObjectStores(db); >- >+ trans = evalAndLog("trans = request.result"); > objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName);"); >+ createIndexes(); >+ trans.oncomplete = function() { >+ evalAndLog("trans = db.transaction(objectStoreName, 'readwrite')"); >+ evalAndLog("objectStore = trans.objectStore(objectStoreName)"); >+ populateObjectStore(); >+ }; >+} > >+function populateObjectStore() >+{ > debug("First, add all our data to the object store."); > addedData = 0; > for (i in objectStoreData) { > request = evalAndLog("request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);"); > request.onerror = unexpectedErrorCallback; > } >- createIndexes(); >- request.onsuccess = testAll; >+ request.onsuccess = testSimple; > } > > function createIndexes() >@@ -140,11 +148,6 @@ function runTest(cursor, expectedValue) > shouldBeEqualToString("expected", JSON.stringify(simplifyCursor(cursor))); > } > >-function testAll() >-{ >- debug("testAll()"); >- testSimple(); >-} > > function testSimple() > { >diff --git a/LayoutTests/storage/indexeddb/resources/index-unique.js b/LayoutTests/storage/indexeddb/resources/index-unique.js >index 3a2e361fc56d0d1f8e9dea33df188a248e644d5e..ac5a1740c3191fd9c7e03cd1053bba03c588024c 100644 >--- a/LayoutTests/storage/indexeddb/resources/index-unique.js >+++ b/LayoutTests/storage/indexeddb/resources/index-unique.js >@@ -65,8 +65,8 @@ function addMoreDataFailed() > // Don't abort the transaction. > evalAndLog("event.preventDefault()"); > >- shouldBe("event.target.errorCode", "IDBDatabaseException.CONSTRAINT_ERR"); >- shouldBe("event.target.error.name", "'ConstraintError'"); >+ shouldBe("event.target.errorCode", "IDBDatabaseException.DATA_ERR"); >+ shouldBe("event.target.error.name", "'DataError'"); > > // Update the 'foo' entry in object store, changing the value of x. > request = evalAndLog("transaction.objectStore('store').put({x: 0}, 'foo')"); >diff --git a/LayoutTests/storage/indexeddb/resources/objectstore-basics.js b/LayoutTests/storage/indexeddb/resources/objectstore-basics.js >index 5cff4298d237b5f20529b3d7ec4ef5ad2a6e1fd1..a7186a621a52f05455acf92e9e0cba744f786cf1 100644 >--- a/LayoutTests/storage/indexeddb/resources/objectstore-basics.js >+++ b/LayoutTests/storage/indexeddb/resources/objectstore-basics.js >@@ -175,8 +175,8 @@ function addAgainFailure(evt) > { > event = evt; > debug("addAgainFailure():"); >- shouldBe("event.target.errorCode", "IDBDatabaseException.CONSTRAINT_ERR"); >- shouldBe("event.target.error.name", "'ConstraintError'"); >+ shouldBe("event.target.errorCode", "IDBDatabaseException.DATA_ERR"); >+ shouldBe("event.target.error.name", "'DataError'"); > > evalAndLog("event.preventDefault()"); >
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 88690
:
146655
|
146899
|
146955
|
147114