| OLD | NEW |
| 1 if (this.importScripts) { | 1 if (this.importScripts) { |
| 2 importScripts('../../../fast/js/resources/js-test-pre.js'); | 2 importScripts('../../../fast/js/resources/js-test-pre.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 { |
| 11 db = event.target.result; | 11 db = event.target.result; |
| 12 evalAndLog("store = db.createObjectStore('storeName')"); | 12 evalAndLog("store = db.createObjectStore('storeName')"); |
| 13 request = evalAndLog("store.add('value', 'key')"); | 13 request = evalAndLog("store.add('value', 'key')"); |
| 14 request.onerror = unexpectedErrorCallback; | 14 request.onerror = unexpectedErrorCallback; |
| 15 } | 15 } |
| 16 | 16 |
| 17 var nonConvertibleToString = {toString: function() { throw "Exception in toStrin
g()"; }}; |
| 17 function startTest() | 18 function startTest() |
| 18 { | 19 { |
| 19 debug(""); | 20 debug(""); |
| 20 evalAndLog("trans = db.transaction('storeName')"); | 21 evalAndLog("trans = db.transaction('storeName')"); |
| 21 | 22 |
| 22 debug(""); | 23 debug(""); |
| 23 debug("IDBTransaction.error should be null if transaction is not finished:")
; | 24 debug("IDBTransaction.error should be null if transaction is not finished:")
; |
| 24 shouldBeNull("trans.error"); | 25 shouldBeNull("trans.error"); |
| 25 | 26 |
| 26 debug(""); | 27 debug(""); |
| 28 debug("transaction() should throw if one of the DOMStringList items cannot b
e converted to a String:"); |
| 29 shouldThrow("db.transaction(['storeName', nonConvertibleToString])", "'Excep
tion in toString()'"); |
| 30 |
| 31 debug(""); |
| 27 debug("If IDBTransaction.abort() is explicitly called, IDBTransaction.error
should be null:"); | 32 debug("If IDBTransaction.abort() is explicitly called, IDBTransaction.error
should be null:"); |
| 28 evalAndLog("trans.abort()"); | 33 evalAndLog("trans.abort()"); |
| 29 trans.oncomplete = unexpectedCompleteCallback; | 34 trans.oncomplete = unexpectedCompleteCallback; |
| 30 trans.onabort = function() { | 35 trans.onabort = function() { |
| 31 shouldBeNull("trans.error"); | 36 shouldBeNull("trans.error"); |
| 32 testErrorFromRequest(); | 37 testErrorFromRequest(); |
| 33 }; | 38 }; |
| 34 } | 39 } |
| 35 | 40 |
| 36 function testErrorFromRequest() | 41 function testErrorFromRequest() |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 debug("trans.error.message = " + trans.error.message); | 120 debug("trans.error.message = " + trans.error.message); |
| 116 shouldBeNonNull("trans.error.message"); | 121 shouldBeNonNull("trans.error.message"); |
| 117 debug("Note: This fails because of http://wkb.ug/37327"); | 122 debug("Note: This fails because of http://wkb.ug/37327"); |
| 118 shouldNotBe("trans.error.message.indexOf(indexName)", "-1"); | 123 shouldNotBe("trans.error.message.indexOf(indexName)", "-1"); |
| 119 debug(""); | 124 debug(""); |
| 120 finishJSTest(); | 125 finishJSTest(); |
| 121 }; | 126 }; |
| 122 }; | 127 }; |
| 123 }; | 128 }; |
| 124 } | 129 } |
| OLD | NEW |