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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 debug("success!"); | 93 debug("success!"); |
94 debug("Replace an existing record - this should work"); | 94 debug("Replace an existing record - this should work"); |
95 request = evalAndLog("transaction.objectStore('store-unique').put({x: [1
, 2, 7], y: 'a'}, 'foo')"); | 95 request = evalAndLog("transaction.objectStore('store-unique').put({x: [1
, 2, 7], y: 'a'}, 'foo')"); |
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() { debug("Request failed, as expected ("
+ request.error.name + ")"); }; | 102 request.onerror = function() { debug("Request failed, as expected ("
+ request.error.name + ")"); }; |
| 103 expectError(); |
103 }; | 104 }; |
104 }; | 105 }; |
105 } | 106 } |
106 | 107 |
107 function verifyCount(callback) { | 108 function verifyCount(callback) { |
108 evalAndLog("transaction = db.transaction(['store'])"); | 109 evalAndLog("transaction = db.transaction(['store'])"); |
109 | 110 |
110 transaction.onabort = unexpectedAbortCallback; | 111 transaction.onabort = unexpectedAbortCallback; |
111 transaction.oncomplete = callback; | 112 transaction.oncomplete = callback; |
112 | 113 |
(...skipping 22 matching lines...) Expand all Loading... |
135 request.onupgradeneeded = function() { | 136 request.onupgradeneeded = function() { |
136 evalAndLog("db = event.target.result"); | 137 evalAndLog("db = event.target.result"); |
137 evalAndLog("trans = event.target.transaction"); | 138 evalAndLog("trans = event.target.transaction"); |
138 trans.onabort = unexpectedAbortCallback; | 139 trans.onabort = unexpectedAbortCallback; |
139 | 140 |
140 store = evalAndLog("store = trans.objectStore('store')"); | 141 store = evalAndLog("store = trans.objectStore('store')"); |
141 evalAndLog("store.createIndex('index-new', 'x', {multiEntry: true})"); | 142 evalAndLog("store.createIndex('index-new', 'x', {multiEntry: true})"); |
142 }; | 143 }; |
143 request.onsuccess = function() { verifyIndexes('index-new', finishJSTest); }
; | 144 request.onsuccess = function() { verifyIndexes('index-new', finishJSTest); }
; |
144 } | 145 } |
OLD | NEW |