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 IDBTransaction.error cases."); | 6 description("Test IDBTransaction.error cases."); |
7 | 7 |
8 indexedDBTest(prepareDatabase, startTest); | 8 indexedDBTest(prepareDatabase, startTest); |
9 function prepareDatabase() | 9 function prepareDatabase() |
10 { | 10 { |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 function testErrorFromRequest() | 41 function testErrorFromRequest() |
42 { | 42 { |
43 debug(""); | 43 debug(""); |
44 debug("If the transaction is aborted due to a request error that is not prev
ented, IDBTransaction.error should match:"); | 44 debug("If the transaction is aborted due to a request error that is not prev
ented, IDBTransaction.error should match:"); |
45 evalAndLog("trans = db.transaction('storeName', 'readwrite')"); | 45 evalAndLog("trans = db.transaction('storeName', 'readwrite')"); |
46 evalAndLog("request = trans.objectStore('storeName').add('value2', 'key')"); | 46 evalAndLog("request = trans.objectStore('storeName').add('value2', 'key')"); |
47 request.onsuccess = unexpectedSuccessCallback; | 47 request.onsuccess = unexpectedSuccessCallback; |
48 request.onerror = function() { | 48 request.onerror = function() { |
| 49 expectError(); |
49 shouldBeUndefined("request.result"); | 50 shouldBeUndefined("request.result"); |
50 shouldBeNonNull("request.error"); | 51 shouldBeNonNull("request.error"); |
51 shouldBe("request.error.name", "'ConstraintError'"); | 52 shouldBe("request.error.name", "'ConstraintError'"); |
52 evalAndLog("request_error = request.error"); | 53 evalAndLog("request_error = request.error"); |
53 }; | 54 }; |
54 trans.oncomplete = unexpectedCompleteCallback; | 55 trans.oncomplete = unexpectedCompleteCallback; |
55 trans.onabort = function() { | 56 trans.onabort = function() { |
56 debug("Transaction received abort event."); | 57 debug("Transaction received abort event."); |
57 shouldBeNonNull("trans.error"); | 58 shouldBeNonNull("trans.error"); |
58 debug("trans.error.message = " + trans.error.message); | 59 debug("trans.error.message = " + trans.error.message); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 debug("trans.error.message = " + trans.error.message); | 125 debug("trans.error.message = " + trans.error.message); |
125 shouldBeNonNull("trans.error.message"); | 126 shouldBeNonNull("trans.error.message"); |
126 debug("Note: This fails because of http://wkb.ug/37327"); | 127 debug("Note: This fails because of http://wkb.ug/37327"); |
127 shouldNotBe("trans.error.message.indexOf(indexName)", "-1"); | 128 shouldNotBe("trans.error.message.indexOf(indexName)", "-1"); |
128 debug(""); | 129 debug(""); |
129 finishJSTest(); | 130 finishJSTest(); |
130 }; | 131 }; |
131 }; | 132 }; |
132 }; | 133 }; |
133 } | 134 } |
OLD | NEW |