Test IndexedDB binary keys

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;

dbname = "key-type-binary.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
db.createObjectStore('store');


testInvalidBinaryKeys1():
trans = db.transaction('store', 'readwrite')
store = trans.objectStore('store')

Expecting exception from store.put(0, new Uint8Array([]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(1, new Uint8Array([0]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(2, new Uint8Array([0, 0]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(3, new Uint8Array([0, 1]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(4, new Uint8Array([1]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(5, new Uint8Array([1, 0]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(6, new Uint8Array([1, 1]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put(7, new Uint8Array([255]));
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

testInvalidBinaryKeys2():
trans = db.transaction('store', 'readwrite')
store = trans.objectStore('store')

Expecting exception from store.put('value', new Uint8ClampedArray([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Uint16Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Uint32Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Int8Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Int16Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Int32Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Float32Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Float64Array([1,2,3]))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new Uint8Array([1,2,3]).buffer)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.

Expecting exception from store.put('value', new DataView(new Uint8Array([1,2,3]).buffer))
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.
PASS successfullyParsed is true

TEST COMPLETE

