| 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 IndexedDB Array-type keyPaths"); | 6 description("Test IndexedDB Array-type keyPaths"); |
| 7 | 7 |
| 8 indexedDBTest(prepareDatabase, testKeyPaths); | 8 indexedDBTest(prepareDatabase, testKeyPaths); |
| 9 function prepareDatabase() | 9 function prepareDatabase() |
| 10 { | 10 { |
| 11 db = event.target.result; | 11 db = event.target.result; |
| 12 event.target.transaction.onabort = unexpectedAbortCallback; | 12 event.target.transaction.onabort = unexpectedAbortCallback; |
| 13 evalAndLog("store = db.createObjectStore('store', {keyPath: ['a', 'b']})"); | 13 evalAndLog("store = db.createObjectStore('store', {keyPath: ['a', 'b']})"); |
| 14 evalAndLog("store.createIndex('index', ['c', 'd'])"); | 14 evalAndLog("index = store.createIndex('index', ['c', 'd'])"); |
| 15 |
| 16 shouldBeTrue("areArraysEqual(index.keyPath, ['c', 'd'])"); |
| 17 shouldBeFalse("index.keyPath instanceof DOMStringList"); |
| 15 | 18 |
| 16 evalAndExpectException("db.createObjectStore('store-with-generator', {keyPat
h: ['a', 'b'], autoIncrement: true})", "DOMException.INVALID_ACCESS_ERR"); | 19 evalAndExpectException("db.createObjectStore('store-with-generator', {keyPat
h: ['a', 'b'], autoIncrement: true})", "DOMException.INVALID_ACCESS_ERR"); |
| 17 evalAndExpectException("store.createIndex('index-multientry', ['e', 'f'], {m
ultiEntry: true})", "DOMException.INVALID_ACCESS_ERR"); | 20 evalAndExpectException("store.createIndex('index-multientry', ['e', 'f'], {m
ultiEntry: true})", "DOMException.INVALID_ACCESS_ERR"); |
| 18 | 21 |
| 19 debug(""); | 22 debug(""); |
| 20 debug("Empty arrays are not valid key paths:"); | 23 debug("Empty arrays are not valid key paths:"); |
| 21 evalAndExpectException("db.createObjectStore('store-keypath-empty-array', {k
eyPath: []})", "DOMException.SYNTAX_ERR"); | 24 evalAndExpectException("db.createObjectStore('store-keypath-empty-array', {k
eyPath: []})", "DOMException.SYNTAX_ERR"); |
| 22 evalAndExpectException("store.createIndex('index-keypath-empty-array', [])",
"DOMException.SYNTAX_ERR"); | 25 evalAndExpectException("store.createIndex('index-keypath-empty-array', [])",
"DOMException.SYNTAX_ERR"); |
| 23 } | 26 } |
| 24 | 27 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 54 request.onsuccess = function () { | 57 request.onsuccess = function () { |
| 55 evalAndLog("cursor = request.result"); | 58 evalAndLog("cursor = request.result"); |
| 56 shouldBeNonNull("cursor"); | 59 shouldBeNonNull("cursor"); |
| 57 shouldBeEqualToString("JSON.stringify(cursor.primaryKey)", "[1,2]"); | 60 shouldBeEqualToString("JSON.stringify(cursor.primaryKey)", "[1,2]"); |
| 58 shouldBeEqualToString("JSON.stringify(cursor.key)", "[3,4]"); | 61 shouldBeEqualToString("JSON.stringify(cursor.key)", "[3,4]"); |
| 59 }; | 62 }; |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 transaction.oncomplete = finishJSTest; | 65 transaction.oncomplete = finishJSTest; |
| 63 } | 66 } |
| OLD | NEW |