OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <script src="resources/shared.js"></script> | 4 <script src="resources/shared.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <input type="file" id="fileInput" multiple></input> | 7 <input type="file" id="fileInput" multiple></input> |
8 <script> | 8 <script> |
9 | 9 |
10 description("Confirm basic Blob/File/FileList functionality."); | 10 description("Confirm basic Blob/File/FileList functionality."); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 validateResult("filelist", | 59 validateResult("filelist", |
60 fileListValidation, testCursor); | 60 fileListValidation, testCursor); |
61 } | 61 } |
62 | 62 |
63 function testCursor() | 63 function testCursor() |
64 { | 64 { |
65 debug(""); | 65 debug(""); |
66 debug("testCursor():"); | 66 debug("testCursor():"); |
67 evalAndLog("transaction = db.transaction('storeName', 'readonly')"); | 67 evalAndLog("transaction = db.transaction('storeName', 'readonly')"); |
68 transaction.onerror = unexpectedErrorCallback; | 68 transaction.onerror = unexpectedErrorCallback; |
| 69 transaction.onabort = unexpectedAbortCallback; |
69 evalAndLog("store = transaction.objectStore('storeName')"); | 70 evalAndLog("store = transaction.objectStore('storeName')"); |
70 evalAndLog("request = store.openCursor()"); | 71 evalAndLog("request = store.openCursor()"); |
71 | 72 |
72 var count = 0; | 73 var count = 0; |
73 request.onsuccess = continueToTest; | 74 request.onsuccess = continueToTest; |
74 | 75 |
75 function continueToTest(event) | 76 function continueToTest(event) |
76 { | 77 { |
77 cursor = event.target.result; | 78 cursor = event.target.result; |
78 switch (count++) { | 79 switch (count++) { |
(...skipping 21 matching lines...) Expand all Loading... |
100 } | 101 } |
101 | 102 |
102 function validateResult(variable, validation, onComplete) | 103 function validateResult(variable, validation, onComplete) |
103 { | 104 { |
104 var keyName = variable + "key"; | 105 var keyName = variable + "key"; |
105 debug(""); | 106 debug(""); |
106 debug("validateResult(" + variable + "):"); | 107 debug("validateResult(" + variable + "):"); |
107 evalAndLog("transaction = db.transaction('storeName', 'readwrite')"); | 108 evalAndLog("transaction = db.transaction('storeName', 'readwrite')"); |
108 evalAndLog("store = transaction.objectStore('storeName')"); | 109 evalAndLog("store = transaction.objectStore('storeName')"); |
109 evalAndLog("store.put(" + variable + ", '" + keyName + "')"); | 110 evalAndLog("store.put(" + variable + ", '" + keyName + "')"); |
| 111 transaction.onerror = unexpectedErrorCallback; |
| 112 transaction.onabort = unexpectedAbortCallback; |
110 var readTransactionOnComplete = function (e) { | 113 var readTransactionOnComplete = function (e) { |
111 shouldBeTrue("event.target.result" + validation); | 114 shouldBeTrue("event.target.result" + validation); |
112 onComplete(); | 115 onComplete(); |
113 } | 116 } |
114 transaction.oncomplete = function () { | 117 transaction.oncomplete = function () { |
115 doRead(keyName, readTransactionOnComplete); | 118 doRead(keyName, readTransactionOnComplete); |
116 } | 119 } |
117 } | 120 } |
118 | 121 |
119 function doRead(keyName, onComplete) | 122 function doRead(keyName, onComplete) |
120 { | 123 { |
121 evalAndLog("transaction = db.transaction('storeName', 'readwrite')"); | 124 evalAndLog("transaction = db.transaction('storeName', 'readwrite')"); |
122 evalAndLog("store = transaction.objectStore('storeName')"); | 125 evalAndLog("store = transaction.objectStore('storeName')"); |
123 evalAndLog("request = store.get('" + keyName + "')"); | 126 evalAndLog("request = store.get('" + keyName + "')"); |
124 request.onsuccess = onComplete; | 127 request.onsuccess = onComplete; |
125 transaction.onerror = unexpectedErrorCallback; | 128 transaction.onerror = unexpectedErrorCallback; |
| 129 transaction.onabort = unexpectedAbortCallback; |
126 } | 130 } |
127 | 131 |
128 if (window.eventSender) { | 132 if (window.eventSender) { |
129 indexedDBTest(prepareDatabase, testBlob); | 133 indexedDBTest(prepareDatabase, testBlob); |
130 } else { | 134 } else { |
131 alert("Select at least 2 files using the input control above to initiate the
test"); | 135 alert("Select at least 2 files using the input control above to initiate the
test"); |
132 document.getElementById("fileInput").onchange = function() { indexedDBTest(p
repareDatabase, testBlob); }; | 136 document.getElementById("fileInput").onchange = function() { indexedDBTest(p
repareDatabase, testBlob); }; |
133 } | 137 } |
134 | 138 |
135 </script> | 139 </script> |
136 </body> | 140 </body> |
137 </html> | 141 </html> |
OLD | NEW |