| 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 the basics of IndexedDB's IDBDatabase."); | 6 description("Test the basics of IndexedDB's IDBDatabase."); |
| 7 | 7 |
| 8 indexedDBTest(prepareDatabase, testSetVersionAbort); | 8 indexedDBTest(prepareDatabase, testSetVersionAbort); |
| 9 function prepareDatabase() | 9 function prepareDatabase() |
| 10 { | 10 { |
| 11 db = event.target.result; | 11 db = event.target.result; |
| 12 debug("Test that you can't open a transaction while in a versionchange trans
action"); | 12 debug("Test that you can't open a transaction while in a versionchange trans
action"); |
| 13 evalAndExpectException('db.transaction("doesntExist")', | 13 evalAndExpectException('db.transaction("doesntExist")', |
| 14 "DOMException.INVALID_STATE_ERR", "'InvalidStateError
'"); | 14 "DOMException.INVALID_STATE_ERR", "'InvalidStateError
'"); |
| 15 | 15 |
| 16 shouldBe("db.version", "1"); | 16 shouldBe("db.version", "1"); |
| 17 shouldBeEqualToString("db.name", dbname); | 17 shouldBeEqualToString("db.name", dbname); |
| 18 shouldBe("db.objectStoreNames", "[]"); | 18 shouldBe("db.objectStoreNames", "[]"); |
| 19 shouldBe("db.objectStoreNames.length", "0"); | 19 shouldBe("db.objectStoreNames.length", "0"); |
| 20 shouldBe("db.objectStoreNames.contains('')", "false"); | 20 shouldBe("db.objectStoreNames.contains('')", "false"); |
| 21 shouldBeUndefined("db.objectStoreNames[0]"); | 21 shouldBeUndefined("db.objectStoreNames[0]"); |
| 22 shouldBeNull("db.objectStoreNames.item(0)"); | |
| 23 | 22 |
| 24 objectStore = evalAndLog('db.createObjectStore("test123")'); | 23 objectStore = evalAndLog('db.createObjectStore("test123")'); |
| 25 checkObjectStore(); | 24 checkObjectStore(); |
| 26 } | 25 } |
| 27 | 26 |
| 28 function checkObjectStore() | 27 function checkObjectStore() |
| 29 { | 28 { |
| 30 shouldBe("db.objectStoreNames", "['test123']"); | 29 shouldBe("db.objectStoreNames", "['test123']"); |
| 31 shouldBe("db.objectStoreNames.length", "1"); | 30 shouldBe("db.objectStoreNames.length", "1"); |
| 32 shouldBe("db.objectStoreNames.contains('')", "false"); | 31 shouldBe("db.objectStoreNames.contains('')", "false"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 67 |
| 69 function testClose() | 68 function testClose() |
| 70 { | 69 { |
| 71 evalAndLog("db.close()"); | 70 evalAndLog("db.close()"); |
| 72 debug("Now that the connection is closed, transaction creation should fail")
; | 71 debug("Now that the connection is closed, transaction creation should fail")
; |
| 73 evalAndExpectException("db.transaction('test123')", "DOMException.INVALID_ST
ATE_ERR", "'InvalidStateError'"); | 72 evalAndExpectException("db.transaction('test123')", "DOMException.INVALID_ST
ATE_ERR", "'InvalidStateError'"); |
| 74 debug("Call twice, make sure it's harmless"); | 73 debug("Call twice, make sure it's harmless"); |
| 75 evalAndLog("db.close()"); | 74 evalAndLog("db.close()"); |
| 76 finishJSTest(); | 75 finishJSTest(); |
| 77 } | 76 } |
| OLD | NEW |