Home | History | Annotate | Download | only in indexeddb
      1 Test the basics of IndexedDB's webkitIDBIndex.
      2 
      3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
      4 
      5 
      6 webkitIndexedDB.open('index-basics')
      7 db = event.target.result
      8 db.setVersion('new version')
      9 setVersionSuccess():
     10 trans = event.target.result
     11 PASS trans !== null is true
     12 Deleted all object stores.
     13 db.createObjectStore('storeName', null)
     14 store.createIndex('indexName', 'x')
     15 store.createIndex('indexName2', 'y', false)
     16 store.createIndex('zIndex', 'z', true)
     17 PASS 'name' in indexObject is true
     18 PASS indexObject.name is "indexName"
     19 PASS 'objectStore' in indexObject is true
     20 PASS indexObject.objectStore.name is "storeName"
     21 PASS 'keyPath' in indexObject is true
     22 PASS indexObject.keyPath is "x"
     23 PASS 'unique' in indexObject is true
     24 PASS indexObject.unique is false
     25 PASS 'openKeyCursor' in indexObject is true
     26 PASS 'openCursor' in indexObject is true
     27 PASS 'getKey' in indexObject is true
     28 PASS 'get' in indexObject is true
     29 store.add({x: 'value', y: 'zzz', z: 2.72}, 'key')
     30 event.target.source.add({x: 'value2', y: 'zzz2', z: 2.71, foobar: 12}, 'key2')
     31 store.createIndex('indexWhileAddIsInFlight', 'x')
     32 store.createIndex('indexWithWeirdKeyPath', 'foobar')
     33 indexObject.getKey('value')
     34 PASS event.target.result is "key"
     35 indexObject2.getKey('zzz')
     36 PASS event.target.result is "key"
     37 indexObject3.get(2.71)
     38 PASS event.target.result.x is "value2"
     39 indexObject.get('value')
     40 PASS event.target.result.x is "value"
     41 PASS event.target.result.y is "zzz"
     42 indexObject.getKey('does not exist')
     43 PASS event.target.errorCode is webkitIDBDatabaseException.NOT_FOUND_ERR
     44 event.preventDefault()
     45 indexObject.get('does not exist')
     46 PASS event.target.errorCode is webkitIDBDatabaseException.NOT_FOUND_ERR
     47 event.preventDefault()
     48 indexObject4.getKey('value2')
     49 PASS event.target.result is "key2"
     50 indexObject.openKeyCursor()
     51 PASS event.target.source is indexObject
     52 PASS event.target.result === null is false
     53 PASS event.target.result.key is "value"
     54 PASS event.target.result.primaryKey is "key"
     55 event.target.result.continue()
     56 PASS event.target.result === null is false
     57 PASS event.target.result.key is "value2"
     58 PASS event.target.result.primaryKey is "key2"
     59 event.target.result.continue()
     60 PASS event.target.result === null is true
     61 indexObject.openCursor()
     62 PASS event.target.source is indexObject
     63 PASS event.target.result === null is false
     64 PASS event.target.result.key is "value"
     65 PASS event.target.result.value.x is "value"
     66 PASS event.target.result.value.y is "zzz"
     67 event.target.result.continue()
     68 PASS event.target.result === null is false
     69 PASS event.target.result.key is "value2"
     70 PASS event.target.result.value.x is "value2"
     71 PASS event.target.result.value.y is "zzz2"
     72 event.target.result.continue()
     73 PASS event.target.result === null is true
     74 Passing an invalid key into indexObject.get().
     75 PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17
     76 Passing an invalid key into indexObject.getKey().
     77 PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17
     78 PASS successfullyParsed is true
     79 
     80 TEST COMPLETE
     81 
     82