OLD | NEW |
1 if (this.importScripts) { | 1 if (this.importScripts) { |
2 importScripts('../../../resources/js-test.js'); | 2 importScripts('../../../resources/js-test.js'); |
3 importScripts('shared.js'); | 3 importScripts('shared.js'); |
4 } | 4 } |
5 | 5 |
6 description("Test exceptions in IDBRequest handlers cause aborts."); | 6 description("Test exceptions in IDBRequest handlers cause aborts."); |
7 | 7 |
8 indexedDBTest(prepareDatabase, startTest); | 8 indexedDBTest(prepareDatabase, startTest); |
9 function prepareDatabase() | 9 function prepareDatabase() |
10 { | 10 { |
(...skipping 14 matching lines...) Expand all Loading... |
25 request = evalAndLog("store.add({x: 'value2', y: 'zzz2'}, 'key2')"); | 25 request = evalAndLog("store.add({x: 'value2', y: 'zzz2'}, 'key2')"); |
26 trans.addEventListener('success', causeException, true); | 26 trans.addEventListener('success', causeException, true); |
27 request.onerror = unexpectedErrorCallback; | 27 request.onerror = unexpectedErrorCallback; |
28 } | 28 } |
29 | 29 |
30 function causeException() | 30 function causeException() |
31 { | 31 { |
32 debug(""); | 32 debug(""); |
33 evalAndLog("event.preventDefault()"); | 33 evalAndLog("event.preventDefault()"); |
34 debug("Throwing"); | 34 debug("Throwing"); |
| 35 expectError(); |
35 throw "this exception is expected"; | 36 throw "this exception is expected"; |
36 } | 37 } |
37 | 38 |
38 function transactionAborted1() | 39 function transactionAborted1() |
39 { | 40 { |
40 debug(""); | 41 debug(""); |
41 shouldHaveHadError("this exception is expected"); | 42 shouldHaveHadError("this exception is expected"); |
42 testPassed("The transaction was aborted."); | 43 testPassed("The transaction was aborted."); |
43 trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')"); | 44 trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')"); |
44 evalAndLog("trans.onabort = transactionAborted2"); | 45 evalAndLog("trans.onabort = transactionAborted2"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 request.onerror = unexpectedErrorCallback; | 89 request.onerror = unexpectedErrorCallback; |
89 } | 90 } |
90 | 91 |
91 function transactionCompleted2() | 92 function transactionCompleted2() |
92 { | 93 { |
93 debug(""); | 94 debug(""); |
94 testPassed("The transaction completed."); | 95 testPassed("The transaction completed."); |
95 debug(""); | 96 debug(""); |
96 finishJSTest(); | 97 finishJSTest(); |
97 } | 98 } |
OLD | NEW |