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 transaction aborts send the proper onabort messages.."); | 6 description("Test transaction aborts send the proper onabort messages.."); |
7 | 7 |
8 indexedDBTest(prepareDatabase, startTest); | 8 indexedDBTest(prepareDatabase, startTest); |
9 function prepareDatabase() | 9 function prepareDatabase() |
10 { | 10 { |
(...skipping 15 matching lines...) Expand all Loading... |
26 request = evalAndLog("store.add({x: 'value3', y: 'zzz3'}, 'key3')"); | 26 request = evalAndLog("store.add({x: 'value3', y: 'zzz3'}, 'key3')"); |
27 request.onerror = secondAdd; | 27 request.onerror = secondAdd; |
28 request.onsuccess = unexpectedSuccessCallback; | 28 request.onsuccess = unexpectedSuccessCallback; |
29 trans.abort(); | 29 trans.abort(); |
30 | 30 |
31 firstError = false; | 31 firstError = false; |
32 secondError = false; | 32 secondError = false; |
33 abortFired = false; | 33 abortFired = false; |
34 } | 34 } |
35 | 35 |
36 function firstAdd() | 36 function firstAdd(evt) |
37 { | 37 { |
| 38 evt.preventDefault(); |
| 39 |
38 shouldBe("event.target.error.name", "'AbortError'"); | 40 shouldBe("event.target.error.name", "'AbortError'"); |
39 shouldBeNull("trans.error"); | 41 shouldBeNull("trans.error"); |
40 shouldBeFalse("firstError"); | 42 shouldBeFalse("firstError"); |
41 shouldBeFalse("secondError"); | 43 shouldBeFalse("secondError"); |
42 shouldBeFalse("abortFired"); | 44 shouldBeFalse("abortFired"); |
43 firstError = true; | 45 firstError = true; |
44 | 46 |
45 evalAndExpectException("store.add({x: 'value4', y: 'zzz4'}, 'key4')", "0", "
'TransactionInactiveError'"); | 47 evalAndExpectException("store.add({x: 'value4', y: 'zzz4'}, 'key4')", "0", "
'TransactionInactiveError'"); |
46 } | 48 } |
47 | 49 |
48 function secondAdd() | 50 function secondAdd(evt) |
49 { | 51 { |
| 52 evt.preventDefault(); |
| 53 |
50 shouldBe("event.target.error.name", "'AbortError'"); | 54 shouldBe("event.target.error.name", "'AbortError'"); |
51 shouldBeNull("trans.error"); | 55 shouldBeNull("trans.error"); |
52 shouldBeTrue("firstError"); | 56 shouldBeTrue("firstError"); |
53 shouldBeFalse("secondError"); | 57 shouldBeFalse("secondError"); |
54 shouldBeFalse("abortFired"); | 58 shouldBeFalse("abortFired"); |
55 secondError = true; | 59 secondError = true; |
56 } | 60 } |
57 | 61 |
58 function transactionAborted() | 62 function transactionAborted() |
59 { | 63 { |
60 shouldBeTrue("firstError"); | 64 shouldBeTrue("firstError"); |
61 shouldBeTrue("secondError"); | 65 shouldBeTrue("secondError"); |
62 shouldBeFalse("abortFired"); | 66 shouldBeFalse("abortFired"); |
63 shouldBeNull("trans.error"); | 67 shouldBeNull("trans.error"); |
64 abortFired = true; | 68 abortFired = true; |
65 | 69 |
66 evalAndExpectException("store.add({x: 'value5', y: 'zzz5'}, 'key5')", "0", "
'TransactionInactiveError'"); | 70 evalAndExpectException("store.add({x: 'value5', y: 'zzz5'}, 'key5')", "0", "
'TransactionInactiveError'"); |
67 | 71 |
68 evalAndExpectException("trans.abort()", "DOMException.INVALID_STATE_ERR", "'
InvalidStateError'"); | 72 evalAndExpectException("trans.abort()", "DOMException.INVALID_STATE_ERR", "'
InvalidStateError'"); |
69 | 73 |
70 finishJSTest(); | 74 finishJSTest(); |
71 } | 75 } |
OLD | NEW |