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 features of IndexedDB's multiEntry indices."); | 6 description("Test features of IndexedDB's multiEntry indices."); |
7 | 7 |
8 indexedDBTest(prepareDatabase, addData); | 8 indexedDBTest(prepareDatabase, addData); |
9 function prepareDatabase() | 9 function prepareDatabase() |
10 { | 10 { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 request.onerror = unexpectedErrorCallback; | 96 request.onerror = unexpectedErrorCallback; |
97 request.onsuccess = function() { | 97 request.onsuccess = function() { |
98 debug("success!"); | 98 debug("success!"); |
99 debug("This should fail the uniqueness constraint on the index, and
fail:"); | 99 debug("This should fail the uniqueness constraint on the index, and
fail:"); |
100 request = evalAndLog("transaction.objectStore('store-unique').put({x
: [5, 2], y: 'c'}, 'should fail')"); | 100 request = evalAndLog("transaction.objectStore('store-unique').put({x
: [5, 2], y: 'c'}, 'should fail')"); |
101 request.onsuccess = unexpectedSuccessCallback; | 101 request.onsuccess = unexpectedSuccessCallback; |
102 request.onerror = function() { | 102 request.onerror = function() { |
103 shouldBeUndefined("request.result"); | 103 shouldBeUndefined("request.result"); |
104 shouldBeNonNull("request.error"); | 104 shouldBeNonNull("request.error"); |
105 debug("Request failed, as expected (" + request.error.name + ")"
); | 105 debug("Request failed, as expected (" + request.error.name + ")"
); |
| 106 expectError(); |
106 }; | 107 }; |
107 }; | 108 }; |
108 }; | 109 }; |
109 } | 110 } |
110 | 111 |
111 function verifyCount(callback) { | 112 function verifyCount(callback) { |
112 evalAndLog("transaction = db.transaction(['store'])"); | 113 evalAndLog("transaction = db.transaction(['store'])"); |
113 | 114 |
114 transaction.onabort = unexpectedAbortCallback; | 115 transaction.onabort = unexpectedAbortCallback; |
115 transaction.oncomplete = callback; | 116 transaction.oncomplete = callback; |
(...skipping 23 matching lines...) Expand all Loading... |
139 request.onupgradeneeded = function() { | 140 request.onupgradeneeded = function() { |
140 evalAndLog("db = event.target.result"); | 141 evalAndLog("db = event.target.result"); |
141 evalAndLog("trans = event.target.transaction"); | 142 evalAndLog("trans = event.target.transaction"); |
142 trans.onabort = unexpectedAbortCallback; | 143 trans.onabort = unexpectedAbortCallback; |
143 | 144 |
144 store = evalAndLog("store = trans.objectStore('store')"); | 145 store = evalAndLog("store = trans.objectStore('store')"); |
145 evalAndLog("store.createIndex('index-new', 'x', {multiEntry: true})"); | 146 evalAndLog("store.createIndex('index-new', 'x', {multiEntry: true})"); |
146 }; | 147 }; |
147 request.onsuccess = function() { verifyIndexes('index-new', finishJSTest); }
; | 148 request.onsuccess = function() { verifyIndexes('index-new', finishJSTest); }
; |
148 } | 149 } |
OLD | NEW |