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 that deleteDatabase is delayed if a VERSION_CHANGE transaction
is running"); | 6 description("Test that deleteDatabase is delayed if a VERSION_CHANGE transaction
is running"); |
7 | 7 |
8 indexedDBTest(prepareDatabase, onOpenSuccess); | 8 indexedDBTest(prepareDatabase, onOpenSuccess); |
9 function prepareDatabase(evt) | 9 function prepareDatabase(evt) |
10 { | 10 { |
(...skipping 15 matching lines...) Expand all Loading... |
26 transaction.oncomplete = function transactionOnComplete(evt) { | 26 transaction.oncomplete = function transactionOnComplete(evt) { |
27 preamble(evt); | 27 preamble(evt); |
28 evalAndLog("upgradeTransactionComplete = true"); | 28 evalAndLog("upgradeTransactionComplete = true"); |
29 }; | 29 }; |
30 | 30 |
31 request = evalAndLog("indexedDB.deleteDatabase(dbname)"); | 31 request = evalAndLog("indexedDB.deleteDatabase(dbname)"); |
32 request.onerror = unexpectedErrorCallback; | 32 request.onerror = unexpectedErrorCallback; |
33 request.onblocked = function deleteDatabaseOnBlocked(evt) { | 33 request.onblocked = function deleteDatabaseOnBlocked(evt) { |
34 preamble(evt); | 34 preamble(evt); |
35 shouldBeTrue("sawVersionChange"); | 35 shouldBeTrue("sawVersionChange"); |
| 36 evalAndLog("h.close()"); |
36 }; | 37 }; |
37 request.onsuccess = function deleteDatabaseOnSuccess(evt) { | 38 request.onsuccess = function deleteDatabaseOnSuccess(evt) { |
38 preamble(evt); | 39 preamble(evt); |
39 shouldBeTrue("upgradeTransactionComplete"); | 40 shouldBeTrue("upgradeTransactionComplete"); |
40 finishJSTest(); | 41 finishJSTest(); |
41 }; | 42 }; |
42 } | 43 } |
43 | 44 |
44 function onOpenSuccess(evt) | 45 function onOpenSuccess(evt) |
45 { | 46 { |
46 preamble(evt); | 47 preamble(evt); |
47 evalAndLog("h = event.target.result"); | 48 evalAndLog("h = event.target.result"); |
48 evalAndLog("h.close()"); | |
49 debug("Closing too late to prevent the in-flight 'blocked' event"); | |
50 // Event ordering between 'success' and 'blocked' is not strictly defined | |
51 // in the spec. This documents current Chromium behavior to detect | |
52 // unexpected changes. | |
53 } | 49 } |
OLD | NEW |