OLD | NEW |
1 CONSOLE ERROR: line 78: Uncaught Error: This should *NOT* be caught! | 1 CONSOLE ERROR: line 82: Uncaught Error: This should *NOT* be caught! |
2 Test IDBTransaction.error cases. | 2 Test IDBTransaction.error cases. |
3 | 3 |
4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
5 | 5 |
6 | 6 |
7 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; | 7 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; |
8 | 8 |
9 dbname = "transaction-error.html" | 9 dbname = "transaction-error.html" |
10 indexedDB.deleteDatabase(dbname) | 10 indexedDB.deleteDatabase(dbname) |
11 indexedDB.open(dbname) | 11 indexedDB.open(dbname) |
12 store = db.createObjectStore('storeName') | 12 store = db.createObjectStore('storeName') |
13 store.add('value', 'key') | 13 store.add('value', 'key') |
14 | 14 |
15 trans = db.transaction('storeName') | 15 trans = db.transaction('storeName') |
16 | 16 |
17 IDBTransaction.error should be null if transaction is not finished: | 17 IDBTransaction.error should be null if transaction is not finished: |
18 PASS trans.error is null | 18 PASS trans.error is null |
19 | 19 |
20 transaction() should throw if one of the DOMStringList items cannot be converted
to a String: | 20 transaction() should throw if one of the DOMStringList items cannot be converted
to a String: |
21 PASS db.transaction(['storeName', nonConvertibleToString]) threw exception Excep
tion in toString(). | 21 PASS db.transaction(['storeName', nonConvertibleToString]) threw exception Excep
tion in toString(). |
22 | 22 |
23 If IDBTransaction.abort() is explicitly called, IDBTransaction.error should be n
ull: | 23 If IDBTransaction.abort() is explicitly called, IDBTransaction.error should be n
ull: |
24 trans.abort() | 24 trans.abort() |
25 PASS trans.error is null | 25 PASS trans.error is null |
26 | 26 |
27 If the transaction is aborted due to a request error that is not prevented, IDBT
ransaction.error should match: | 27 If the transaction is aborted due to a request error that is not prevented, IDBT
ransaction.error should match: |
28 trans = db.transaction('storeName', 'readwrite') | 28 trans = db.transaction('storeName', 'readwrite') |
29 request = trans.objectStore('storeName').add('value2', 'key') | 29 request = trans.objectStore('storeName').add('value2', 'key') |
| 30 PASS request.result is undefined. |
| 31 PASS request.error is non-null. |
30 PASS request.error.name is 'ConstraintError' | 32 PASS request.error.name is 'ConstraintError' |
31 request_error = request.error | 33 request_error = request.error |
32 Transaction received abort event. | 34 Transaction received abort event. |
33 PASS trans.error is non-null. | 35 PASS trans.error is non-null. |
34 trans.error.message = Key already exists in the object store. | 36 trans.error.message = Key already exists in the object store. |
35 PASS trans.error.message is non-null. | 37 PASS trans.error.message is non-null. |
36 PASS trans.error is request_error | 38 PASS trans.error is request_error |
37 | 39 |
38 If the transaction is aborted due to an exception thrown from event callback, ID
BTransaction.error should be AbortError: | 40 If the transaction is aborted due to an exception thrown from event callback, ID
BTransaction.error should be AbortError: |
39 trans = db.transaction('storeName', 'readwrite') | 41 trans = db.transaction('storeName', 'readwrite') |
40 request = trans.objectStore('storeName').add('value2', 'key') | 42 request = trans.objectStore('storeName').add('value2', 'key') |
| 43 PASS request.result is undefined. |
| 44 PASS request.error is non-null. |
41 PASS request.error.name is 'ConstraintError' | 45 PASS request.error.name is 'ConstraintError' |
42 Throwing exception... | 46 Throwing exception... |
43 Transaction received abort event. | 47 Transaction received abort event. |
44 PASS trans.error is non-null. | 48 PASS trans.error is non-null. |
45 trans.error.message = Uncaught exception in event handler. | 49 trans.error.message = Uncaught exception in event handler. |
46 PASS trans.error.message is non-null. | 50 PASS trans.error.message is non-null. |
47 PASS trans.error.name is 'AbortError' | 51 PASS trans.error.name is 'AbortError' |
48 | 52 |
49 If the transaction is aborted due to an error during commit, IDBTransaction.erro
r should reflect that error: | 53 If the transaction is aborted due to an error during commit, IDBTransaction.erro
r should reflect that error: |
50 trans = db.transaction('storeName', 'readwrite') | 54 trans = db.transaction('storeName', 'readwrite') |
51 request = trans.objectStore('storeName').add({id: 1}, 'record1') | 55 request = trans.objectStore('storeName').add({id: 1}, 'record1') |
52 request = trans.objectStore('storeName').add({id: 1}, 'record2') | 56 request = trans.objectStore('storeName').add({id: 1}, 'record2') |
53 request = indexedDB.open(dbname, 2) | 57 request = indexedDB.open(dbname, 2) |
54 trans = request.transaction | 58 trans = request.transaction |
55 This should fail due to the unique constraint: | 59 This should fail due to the unique constraint: |
56 indexName = 'Also test utf8: 漢' | 60 indexName = 'Also test utf8: 漢' |
57 trans.objectStore('storeName').createIndex(indexName, 'id', {unique: true}) | 61 trans.objectStore('storeName').createIndex(indexName, 'id', {unique: true}) |
58 Transaction received abort event. | 62 Transaction received abort event. |
59 PASS trans.error is non-null. | 63 PASS trans.error is non-null. |
60 PASS trans.error.name is 'ConstraintError' | 64 PASS trans.error.name is 'ConstraintError' |
61 trans.error.message = Unable to add key to index 'Also test utf8: 漢': at least o
ne key does not satisfy the uniqueness requirements. | 65 trans.error.message = Unable to add key to index 'Also test utf8: 漢': at least o
ne key does not satisfy the uniqueness requirements. |
62 PASS trans.error.message is non-null. | 66 PASS trans.error.message is non-null. |
63 Note: This fails because of http://wkb.ug/37327 | 67 Note: This fails because of http://wkb.ug/37327 |
64 PASS trans.error.message.indexOf(indexName) is not -1 | 68 PASS trans.error.message.indexOf(indexName) is not -1 |
65 | 69 |
66 PASS successfullyParsed is true | 70 PASS successfullyParsed is true |
67 | 71 |
68 TEST COMPLETE | 72 TEST COMPLETE |
69 | 73 |
OLD | NEW |