Changeset 130095 in webkit
- Timestamp:
- Oct 1, 2012, 4:14:13 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r130093 r130095 1 2012-10-01 Joshua Bell <jsbell@chromium.org> 2 3 IndexedDB: Fire error rather than raising on request creation if transaction aborts asynchronously. 4 https://bugs.webkit.org/show_bug.cgi?id=93054 5 6 Reviewed by Tony Chang. 7 8 All IDB data operations are asynchronous, producing IDBRequest objects. This was implemented 9 by passing all data from the front-end to the back-end synchronously, and synchronously 10 returning an exception code back if the request was invalid. Previous changes have moved 11 request validation to the front-end except for the case of the back-end transaction having 12 asynchronously aborted in the mean time. 13 14 To eliminate that case (which would allow front-end to back-end communication to be 15 asynchronous in multi-process ports), change from returning an exception code to relying on 16 the front-end to abort the request when the abort event finally arrives. 17 18 The difference would be noticeable in scripts - in a multi-process environment: 19 20 var request1 = store.get(0); 21 request1.onerror = errorHandler; // (A) 22 // (B) 23 var request2 = store.get(0); // (C) 24 request2.onerror = errorHandler; // (D) 25 26 If the transaction back-end were to asynchronously abort at exactly point (B), then prior to 27 this patch an exception would be thrown at (C). With this patch, no exception but (D) would 28 fire, same as (A). 29 30 The back-end explicitly fires an error callback as well, as intermediate layers may rely on 31 this to stop tracking the pending callback. 32 33 No new layout tests - change is not observable in single-process ports. 34 Added webkit_unit_test IDBRequestTest.AbortErrorAfterAbort to verify that IDBRequest 35 is resilient to this pattern, but it was previous. 36 37 * Modules/indexeddb/IDBCursor.cpp: 38 (WebCore::IDBCursor::advance): Back end should never fail a request. 39 (WebCore::IDBCursor::continueFunction): Ditto. 40 (WebCore::IDBCursor::deleteFunction): Ditto, and also move "is key cursor" test 41 here from back-end. 42 * Modules/indexeddb/IDBCursorBackendImpl.cpp: 43 (WebCore::IDBCursorBackendImpl::continueFunction): Change from EC to firing error. 44 (WebCore::IDBCursorBackendImpl::advance): Ditto. 45 (WebCore::IDBCursorBackendImpl::deleteFunction): Ditto, and remove test moved to FE. 46 (WebCore::IDBCursorBackendImpl::prefetchContinue): Ditto. 47 * Modules/indexeddb/IDBDatabaseError.cpp: 48 (WebCore::IDBDatabaseError::create): Add overload that looks up message via code. 49 (WebCore::IDBDatabaseError::IDBDatabaseError): Look up message via exception table. 50 * Modules/indexeddb/IDBDatabaseException.h: Add getErrorDescription. 51 * Modules/indexeddb/IDBDatabaseException.cpp: Implementation of getErrorDescription. 52 * Modules/indexeddb/IDBIndex.cpp: 53 (WebCore::IDBIndex::openCursor): Back end should never fail a request. 54 (WebCore::IDBIndex::count): Ditto. 55 (WebCore::IDBIndex::openKeyCursor): Ditto. 56 (WebCore::IDBIndex::get): Ditto. 57 (WebCore::IDBIndex::getKey): Ditto. 58 * Modules/indexeddb/IDBIndexBackendImpl.cpp: 59 (WebCore::IDBIndexBackendImpl::openCursor): Change from EC to firing error. 60 (WebCore::IDBIndexBackendImpl::openKeyCursor): Ditto. 61 (WebCore::IDBIndexBackendImpl::count): Ditto. 62 (WebCore::IDBIndexBackendImpl::get): Ditto. 63 (WebCore::IDBIndexBackendImpl::getKey): Ditto. 64 * Modules/indexeddb/IDBObjectStore.cpp: 65 (WebCore::IDBObjectStore::get): Back end should never fail a request. 66 (WebCore::IDBObjectStore::put): Ditto. 67 (WebCore::IDBObjectStore::deleteFunction): Ditto. 68 (WebCore::IDBObjectStore::clear): Ditto. 69 (WebCore): Ditto. 70 (WebCore::IDBObjectStore::openCursor): Ditto. 71 (WebCore::IDBObjectStore::count): Ditto. 72 * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: 73 (WebCore::IDBObjectStoreBackendImpl::get): Change from EC to firing error. 74 (WebCore::IDBObjectStoreBackendImpl::putWithIndexKeys): Ditto. 75 (WebCore): 76 (WebCore::IDBObjectStoreBackendImpl::deleteFunction): Ditto. 77 (WebCore::IDBObjectStoreBackendImpl::clear): Ditto. 78 (WebCore::IDBObjectStoreBackendImpl::openCursor): Ditto. 79 (WebCore::IDBObjectStoreBackendImpl::count): Ditto. 80 1 81 2012-10-01 Ryosuke Niwa <rniwa@webkit.org> 2 82 -
trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp
r129038 r130095 177 177 m_gotValue = false; 178 178 m_backend->advance(count, m_request, ec); 179 if (ec) 180 m_request->markEarlyDeath(); 179 ASSERT(!ec); 181 180 } 182 181 … … 219 218 m_gotValue = false; 220 219 m_backend->continueFunction(key, m_request, ec); 221 if (ec) 222 m_request->markEarlyDeath(); 220 ASSERT(!ec); 223 221 } 224 222 … … 235 233 } 236 234 237 if (!m_gotValue ) {235 if (!m_gotValue || isKeyCursor()) { 238 236 ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; 239 237 return 0; … … 241 239 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 242 240 m_backend->deleteFunction(request, ec); 243 if (ec) { 244 request->markEarlyDeath(); 245 return 0; 246 } 241 ASSERT(!ec); 247 242 return request.release(); 248 243 } -
trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp
r125728 r130095 64 64 } 65 65 66 void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)66 void IDBCursorBackendImpl::continueFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) 67 67 { 68 68 IDB_TRACE("IDBCursorBackendImpl::continue"); 69 70 if (!m_transaction->scheduleTask(m_taskType, createCallbackTask(&IDBCursorBackendImpl::continueFunctionInternal, this, prpKey, prpCallbacks))) 71 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; 72 } 73 74 void IDBCursorBackendImpl::advance(unsigned long count, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec) 69 RefPtr<IDBCallbacks> callbacks = prpCallbacks; 70 71 if (!m_transaction->scheduleTask(m_taskType, createCallbackTask(&IDBCursorBackendImpl::continueFunctionInternal, this, prpKey, callbacks))) 72 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 73 } 74 75 void IDBCursorBackendImpl::advance(unsigned long count, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) 75 76 { 76 77 IDB_TRACE("IDBCursorBackendImpl::advance"); 77 78 if (!m_transaction->scheduleTask(createCallbackTask(&IDBCursorBackendImpl::advanceInternal, this, count, prpCallbacks))) 79 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; 78 RefPtr<IDBCallbacks> callbacks = prpCallbacks; 79 80 if (!m_transaction->scheduleTask(createCallbackTask(&IDBCursorBackendImpl::advanceInternal, this, count, callbacks))) 81 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 80 82 } 81 83 … … 108 110 } 109 111 110 void IDBCursorBackendImpl::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)112 void IDBCursorBackendImpl::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) 111 113 { 112 114 IDB_TRACE("IDBCursorBackendImpl::delete"); 113 115 ASSERT(m_transaction->mode() != IDBTransaction::READ_ONLY); 114 116 115 if (!m_cursor || m_cursorType == IndexKeyCursor) { 116 ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; 117 return; 118 } 119 117 ExceptionCode ec = 0; 120 118 RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_cursor->primaryKey(), ec); 121 119 ASSERT(!ec); 122 120 123 121 m_objectStore->deleteFunction(keyRange.release(), prpCallbacks, m_transaction.get(), ec); 124 } 125 126 void IDBCursorBackendImpl::prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec) 122 ASSERT(!ec); 123 } 124 125 void IDBCursorBackendImpl::prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&) 127 126 { 128 127 IDB_TRACE("IDBCursorBackendImpl::prefetchContinue"); 129 if (!m_transaction->scheduleTask(m_taskType, createCallbackTask(&IDBCursorBackendImpl::prefetchContinueInternal, this, numberToFetch, prpCallbacks))) 130 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; 128 RefPtr<IDBCallbacks> callbacks = prpCallbacks; 129 if (!m_transaction->scheduleTask(m_taskType, createCallbackTask(&IDBCursorBackendImpl::prefetchContinueInternal, this, numberToFetch, callbacks))) 130 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 131 131 } 132 132 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseError.h
r127757 r130095 38 38 class IDBDatabaseError : public RefCounted<IDBDatabaseError> { 39 39 public: 40 static PassRefPtr<IDBDatabaseError> create(unsigned short code) 41 { 42 ASSERT(code >= IDBDatabaseException::IDBDatabaseExceptionOffset); 43 ASSERT(code < IDBDatabaseException::IDBDatabaseExceptionMax); 44 return adoptRef(new IDBDatabaseError(code)); 45 } 46 40 47 static PassRefPtr<IDBDatabaseError> create(unsigned short code, const String& message) 41 48 { … … 53 60 54 61 private: 62 IDBDatabaseError(unsigned short code) 63 : m_code(code), m_message(IDBDatabaseException::getErrorDescription(code)) { } 55 64 IDBDatabaseError(unsigned short code, const String& message) 56 65 : m_code(code), m_message(message) { } 57 66 58 67 const unsigned short m_code; -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseException.cpp
r123112 r130095 104 104 } 105 105 106 String IDBDatabaseException::getErrorDescription(ExceptionCode ec) 107 { 108 const IDBDatabaseExceptionNameDescription* entry = getErrorEntry(ec); 109 ASSERT(entry); 110 if (!entry) 111 return "Unknown error."; 112 113 return entry->description; 114 } 115 106 116 ExceptionCode IDBDatabaseException::getLegacyErrorCode(ExceptionCode ec) 107 117 { -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseException.h
r123112 r130095 79 79 static bool initializeDescription(ExceptionCode, ExceptionCodeDescription*); 80 80 static String getErrorName(ExceptionCode); 81 static String getErrorDescription(ExceptionCode); 81 82 static ExceptionCode getLegacyErrorCode(ExceptionCode); 82 83 -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp
r126968 r130095 78 78 request->setCursorDetails(IDBCursorBackendInterface::IndexCursor, direction); 79 79 m_backend->openCursor(keyRange, direction, request, m_transaction->backend(), ec); 80 if (ec) { 81 request->markEarlyDeath(); 82 return 0; 83 } 80 ASSERT(!ec); 84 81 return request; 85 82 } … … 128 125 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 129 126 m_backend->count(keyRange, request, m_transaction->backend(), ec); 130 if (ec) { 131 request->markEarlyDeath(); 132 return 0; 133 } 127 ASSERT(!ec); 134 128 return request; 135 129 } … … 162 156 request->setCursorDetails(IDBCursorBackendInterface::IndexKeyCursor, direction); 163 157 m_backend->openKeyCursor(keyRange, direction, request, m_transaction->backend(), ec); 164 if (ec) { 165 request->markEarlyDeath(); 166 return 0; 167 } 158 ASSERT(!ec); 168 159 return request; 169 160 } … … 226 217 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 227 218 m_backend->get(keyRange, request, m_transaction->backend(), ec); 228 if (ec) { 229 request->markEarlyDeath(); 230 return 0; 231 } 219 ASSERT(!ec); 232 220 return request; 233 221 } … … 261 249 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 262 250 m_backend->getKey(keyRange, request, m_transaction->backend(), ec); 263 if (ec) { 264 request->markEarlyDeath(); 265 return 0; 266 } 251 ASSERT(!ec); 267 252 return request; 268 253 } -
trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp
r129066 r130095 104 104 } 105 105 106 void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)106 void IDBIndexBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 107 107 { 108 108 IDB_TRACE("IDBIndexBackendImpl::openCursor"); … … 113 113 if (!transaction->scheduleTask( 114 114 createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexCursor, callbacks, transaction))) 115 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;116 } 117 118 void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)115 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 116 } 117 118 void IDBIndexBackendImpl::openKeyCursor(PassRefPtr<IDBKeyRange> prpKeyRange, unsigned short direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 119 119 { 120 120 IDB_TRACE("IDBIndexBackendImpl::openKeyCursor"); … … 125 125 if (!transaction->scheduleTask( 126 126 createCallbackTask(&openCursorInternal, index, keyRange, direction, IDBCursorBackendInterface::IndexKeyCursor, callbacks, transaction))) 127 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;127 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 128 128 } 129 129 … … 146 146 } 147 147 148 void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)148 void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 149 149 { 150 150 IDB_TRACE("IDBIndexBackendImpl::count"); … … 152 152 if (!transaction->scheduleTask( 153 153 createCallbackTask(&countInternal, this, range, callbacks, transaction))) 154 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;154 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 155 155 } 156 156 … … 213 213 214 214 215 void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)215 void IDBIndexBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 216 216 { 217 217 IDB_TRACE("IDBIndexBackendImpl::get"); … … 221 221 RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr); 222 222 if (!transaction->scheduleTask(createCallbackTask(&getInternal, index, keyRange, callbacks, transaction))) 223 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;224 } 225 226 void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)223 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 224 } 225 226 void IDBIndexBackendImpl::getKey(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 227 227 { 228 228 IDB_TRACE("IDBIndexBackendImpl::getKey"); … … 233 233 if (!transaction->scheduleTask( 234 234 createCallbackTask(&getKeyInternal, index, keyRange, callbacks, transaction))) 235 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;235 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 236 236 } 237 237 -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
r128789 r130095 89 89 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 90 90 m_backend->get(keyRange, request, m_transaction->backend(), ec); 91 if (ec) { 92 request->markEarlyDeath(); 93 return 0; 94 } 91 ASSERT(!ec); 95 92 return request.release(); 96 93 } … … 220 217 RefPtr<IDBRequest> request = IDBRequest::create(context, source, m_transaction.get()); 221 218 m_backend->putWithIndexKeys(serializedValue.release(), key.release(), putMode, request, m_transaction->backend(), indexNames, indexKeys, ec); 222 if (ec) { 223 request->markEarlyDeath(); 224 return 0; 225 } 219 ASSERT(!ec); 226 220 return request.release(); 227 221 } … … 249 243 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 250 244 m_backend->deleteFunction(keyRange, request, m_transaction->backend(), ec); 251 if (ec) { 252 request->markEarlyDeath(); 253 return 0; 254 } 245 ASSERT(!ec); 255 246 return request.release(); 256 247 } … … 283 274 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 284 275 m_backend->clear(request, m_transaction->backend(), ec); 285 if (ec) { 286 request->markEarlyDeath(); 287 return 0; 288 } 276 ASSERT(!ec); 289 277 return request.release(); 290 278 } … … 515 503 request->setCursorDetails(IDBCursorBackendInterface::ObjectStoreCursor, direction); 516 504 m_backend->openCursor(range, direction, request, taskType, m_transaction->backend(), ec); 517 if (ec) { 518 request->markEarlyDeath(); 519 return 0; 520 } 505 ASSERT(!ec); 521 506 return request.release(); 522 507 } … … 565 550 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); 566 551 m_backend->count(range, request, m_transaction->backend(), ec); 567 if (ec) { 568 request->markEarlyDeath(); 569 return 0; 570 } 552 ASSERT(!ec); 571 553 return request.release(); 572 554 } -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
r129066 r130095 79 79 } 80 80 81 void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)81 void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 82 82 { 83 83 IDB_TRACE("IDBObjectStoreBackendImpl::get"); … … 88 88 if (!transaction->scheduleTask( 89 89 createCallbackTask(&IDBObjectStoreBackendImpl::getInternal, objectStore, keyRange, callbacks, transaction))) 90 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;90 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 91 91 } 92 92 … … 121 121 } 122 122 123 void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, ExceptionCode& ec)123 void IDBObjectStoreBackendImpl::putWithIndexKeys(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, const Vector<String>& indexNames, const Vector<IndexKeys>& indexKeys, ExceptionCode&) 124 124 { 125 125 IDB_TRACE("IDBObjectStoreBackendImpl::putWithIndexKeys"); … … 139 139 if (!transaction->scheduleTask( 140 140 createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction, newIndexNames.release(), newIndexKeys.release()))) 141 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;141 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 142 142 } 143 143 … … 369 369 } 370 370 371 void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)371 void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 372 372 { 373 373 IDB_TRACE("IDBObjectStoreBackendImpl::delete"); … … 382 382 if (!transaction->scheduleTask( 383 383 createCallbackTask(&IDBObjectStoreBackendImpl::deleteInternal, objectStore, keyRange, callbacks, transaction))) 384 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;384 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 385 385 } 386 386 … … 414 414 } 415 415 416 void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)416 void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 417 417 { 418 418 IDB_TRACE("IDBObjectStoreBackendImpl::clear"); … … 426 426 if (!transaction->scheduleTask( 427 427 createCallbackTask(&IDBObjectStoreBackendImpl::clearInternal, objectStore, callbacks, transaction))) 428 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;428 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 429 429 } 430 430 … … 504 504 } 505 505 506 void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)506 void IDBObjectStoreBackendImpl::openCursor(PassRefPtr<IDBKeyRange> prpRange, IDBCursor::Direction direction, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 507 507 { 508 508 IDB_TRACE("IDBObjectStoreBackendImpl::openCursor"); … … 513 513 if (!transaction->scheduleTask( 514 514 createCallbackTask(&IDBObjectStoreBackendImpl::openCursorInternal, objectStore, range, direction, callbacks, taskType, transaction))) { 515 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;515 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 516 516 } 517 517 } … … 537 537 } 538 538 539 void IDBObjectStoreBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)539 void IDBObjectStoreBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&) 540 540 { 541 541 IDB_TRACE("IDBObjectStoreBackendImpl::count"); … … 543 543 if (!transaction->scheduleTask( 544 544 createCallbackTask(&IDBObjectStoreBackendImpl::countInternal, this, range, callbacks, transaction))) 545 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR;545 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 546 546 } 547 547 -
trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
r129038 r130095 175 175 m_errorMessage = String(); 176 176 m_result.clear(); 177 onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR , "The transaction was aborted, so the request cannot be fulfilled."));177 onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR)); 178 178 m_requestAborted = true; 179 179 } -
trunk/Source/WebKit/chromium/ChangeLog
r130052 r130095 1 2012-10-01 Joshua Bell <jsbell@chromium.org> 2 3 IndexedDB: Move onSuccess(IDBDatabaseBackendInterface) to IDBOpenDBRequest 4 https://bugs.webkit.org/show_bug.cgi?id=94757 5 6 Reviewed by Tony Chang. 7 8 * tests/IDBRequestTest.cpp: Ensure IDBRequest can handle Error after abort. 9 (WebCore::TEST): Added AbortAfter 10 1 11 2012-10-01 Ilya Tikhonovsky <loislo@chromium.org> 2 12 -
trunk/Source/WebKit/chromium/tests/IDBRequestTest.cpp
r126461 r130095 59 59 } 60 60 61 TEST(IDBRequestTest, AbortErrorAfterAbort) 62 { 63 ScriptExecutionContext* context = 0; 64 IDBTransaction* transaction = 0; 65 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::createInvalid(), transaction); 66 EXPECT_EQ(request->readyState(), "pending"); 67 68 // Simulate the IDBTransaction having received onAbort from back end and aborting the request: 69 request->abort(); 70 71 // Now simulate the back end having fired an abort error at the request to clear up any intermediaries. 72 // Ensure an assertion is not raised. 73 request->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "Description goes here.")); 74 } 75 61 76 } // namespace 62 77
Note:
See TracChangeset
for help on using the changeset viewer.