chromium/third_party/blink/web_tests/storage/indexeddb/transaction-error-expected.txt

CONSOLE ERROR: Uncaught Error: This should *NOT* be caught!
Test IDBTransaction.error cases.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

dbname = "transaction-error.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('storeName')
store.add('value', 'key')


trans = db.transaction('storeName', 'readonly', {durability: 'relaxed'})


IDBTransaction.error should be null if transaction is not finished:
PASS trans.error is null


transaction() should throw if one of the DOMStringList items cannot be converted to a String:
PASS db.transaction(['storeName', nonConvertibleToString]) threw exception Exception in toString().


If IDBTransaction.abort() is explicitly called, IDBTransaction.error should be null:
trans.abort()
PASS trans.error is null


If the transaction is aborted due to a request error that is not prevented, IDBTransaction.error should match:
trans = db.transaction('storeName', 'readwrite', {durability: 'relaxed'})
request = trans.objectStore('storeName').add('value2', 'key')
PASS request.result is undefined.
PASS request.error is non-null.
PASS request.error.name is 'ConstraintError'
request_error = request.error
Transaction received abort event.
PASS trans.error is non-null.
trans.error.message = Key already exists in the object store.
PASS trans.error.message is non-null.
PASS trans.error is request_error


If the transaction is aborted due to an exception thrown from event callback, IDBTransaction.error should be AbortError:
trans = db.transaction('storeName', 'readwrite', {durability: 'relaxed'})
request = trans.objectStore('storeName').add('value2', 'key')
PASS request.result is undefined.
PASS request.error is non-null.
PASS request.error.name is 'ConstraintError'
Throwing exception...
Transaction received abort event.
PASS trans.error is non-null.
trans.error.message = Uncaught exception in event handler.
PASS trans.error.message is non-null.
PASS trans.error.name is 'AbortError'


If the transaction is aborted due to an error during commit, IDBTransaction.error should reflect that error:
trans = db.transaction('storeName', 'readwrite', {durability: 'relaxed'})
request = trans.objectStore('storeName').add({id: 1}, 'record1')
request = trans.objectStore('storeName').add({id: 1}, 'record2')
request = indexedDB.open(dbname, 2)
trans = request.transaction
This should fail due to the unique constraint:
indexName = 'Also test utf8: 漢'
trans.objectStore('storeName').createIndex(indexName, 'id', {unique: true})
Transaction received abort event.
PASS trans.error is non-null.
PASS trans.error.name is 'ConstraintError'
trans.error.message = Unable to add key to index 'Also test utf8: 漢': at least one key does not satisfy the uniqueness requirements.
PASS trans.error.message is non-null.
Note: This fails because of http://wkb.ug/37327
PASS trans.error.message.indexOf(indexName) is not -1


PASS successfullyParsed is true

TEST COMPLETE