blob: 4d06a2b77085dc85adab1e834eca8b2cb9907484 [file] [log] [blame]
Test structured clone permutations in IndexedDB.
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;
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('storeName')
This index is not used, but evaluating key path on each put() call will exercise (de)serialization:
store.createIndex('indexName', 'dummyKeyPath')
Running tests...
Testing: undefined
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: null
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing boolean primitives
Testing: true
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: false
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing number primitives
Testing: NaN
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -Infinity
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -Number.MAX_VALUE
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -0xffffffff
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -0x80000000
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -0x7fffffff
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -1
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -Number.MIN_VALUE
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -0
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 0
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 1
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: Number.MIN_VALUE
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 0x7fffffff
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 0x80000000
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 0xffffffff
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: Number.MAX_VALUE
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: Infinity
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing string primitives
Testing: ''
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 'this is a sample string'
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 'null(\0)'
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing BigInt primitives
Testing: -12345678901234567890n
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: -1n
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 0n
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 1n
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing: 12345678901234567890n
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS is(test_data, result) is true
Testing Boolean objects
Testing: new Boolean(true)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Boolean(false)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing Number objects
Testing: new Number(NaN)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(-Infinity)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(-Number.MAX_VALUE)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(-Number.MIN_VALUE)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(-0)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(0)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(Number.MIN_VALUE)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(Number.MAX_VALUE)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Number(Infinity)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing String objects
Testing: new String()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new String('this is a sample string')
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new String('null(\0)')
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing BigInt objects
Testing BigInt object: BigInt(-12345678901234567890)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "bigint"
PASS test_data.toString() is result.toString()
Testing BigInt object: BigInt(-1)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "bigint"
PASS test_data.toString() is result.toString()
Testing BigInt object: BigInt(0)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "bigint"
PASS test_data.toString() is result.toString()
Testing BigInt object: BigInt(1)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "bigint"
PASS test_data.toString() is result.toString()
Testing BigInt object: BigInt(-0)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "bigint"
PASS test_data.toString() is result.toString()
Testing BigInt object: BigInt('0x1fffffffffffff')
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "bigint"
PASS test_data.toString() is result.toString()
Testing Date objects
Testing: new Date(-1e13)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(-1e12)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(-1e9)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(-1e6)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(-1e3)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(0)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(1e3)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(1e6)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(1e9)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(1e12)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing: new Date(1e13)
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
PASS is(test_data.valueOf(), result.valueOf()) is true
Testing RegExp objects
Testing RegExp: new RegExp()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/g
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/i
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/gi
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/m
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/mg
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/mi
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing RegExp: /abc/mgi
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object RegExp]"
PASS result.toString() is test_data.toString()
Testing ImageData
Testing ImageData: { colorSpace: "srgb" }
canvas = document.createElement('canvas')
canvas.width = 8
canvas.height = 8
test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: "srgb" })
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object ImageData]"
PASS result.width is test_data.width
PASS result.height is test_data.height
PASS result.data.length is test_data.data.length
PASS result.colorSpace is test_data.colorSpace
PASS result data matches
Testing ImageData: { colorSpace: undefined }
canvas = document.createElement('canvas')
canvas.width = 8
canvas.height = 8
test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: undefined })
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object ImageData]"
PASS result.width is test_data.width
PASS result.height is test_data.height
PASS result.data.length is test_data.data.length
PASS result.colorSpace is test_data.colorSpace
PASS result data matches
Testing Blob
PASS FileReader != null is true
test_content = 'This is a test. This is only a test.'
test_data = new Blob([test_content])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object Blob]"
PASS result.size is test_data.size
PASS result.type is test_data.type
PASS text is "This is a test. This is only a test."
Testing File
test_content = 'This is a test. This is only a test.'
blob = new Blob([test_content])
test_data = new File([blob], 'fileName')
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS file1 !== file2 is true
PASS Object.prototype.toString.call(file1) is "[object File]"
PASS Object.prototype.toString.call(file2) is "[object File]"
PASS file1.name is file2.name
PASS String(file1.lastModifiedDate) is String(file2.lastModifiedDate)
PASS text2 is "This is a test. This is only a test."
Testing FileList
test_data = document.getElementById('fileInput').files;
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is "[object FileList]"
PASS result.length is test_data.length
Testing Object
test_data = []
test_data[0] = 'foo'
test_data[1] = 'bar'
test_data['a'] = true
test_data['b'] = false
test_data['foo'] = 123
test_data['bar'] = 456
test_data[''] = null
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS arrayCompare(Object.keys(result).sort(), Object.keys(test_data).sort()) is true
PASS test_data["0"] is result["0"]
PASS test_data["1"] is result["1"]
PASS test_data["a"] is result["a"]
PASS test_data["b"] is result["b"]
PASS test_data["foo"] is result["foo"]
PASS test_data["bar"] is result["bar"]
PASS test_data[""] is result[""]
Testing Array
test_data = []
test_data[0] = 'foo'
test_data[1] = 'bar'
test_data[10] = true
test_data[11] = false
test_data[20] = 123
test_data[21] = 456
test_data[30] = null
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS test_data.length === result.length is true
PASS test_data[0] is result[0]
PASS test_data[1] is result[1]
PASS test_data[10] is result[10]
PASS test_data[11] is result[11]
PASS test_data[20] is result[20]
PASS test_data[21] is result[21]
PASS test_data[30] is result[30]
Testing TypedArray
value = new Uint8Array([])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
value = new Uint8Array([0, 1, 254, 255])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Int8Array([0, 1, 254, 255])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Uint8ClampedArray([0, 1, 254, 255])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
value = new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
PASS is(test_data[4], result[4]) is true
PASS is(test_data[5], result[5]) is true
PASS is(test_data[6], result[6]) is true
PASS is(test_data[7], result[7]) is true
PASS is(test_data[8], result[8]) is true
PASS is(test_data[9], result[9]) is true
value = new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
PASS is(test_data[4], result[4]) is true
PASS is(test_data[5], result[5]) is true
PASS is(test_data[6], result[6]) is true
PASS is(test_data[7], result[7]) is true
value = new BigInt64Array([0x7fffffffffffffffn, 1n, 0n, -1n, -0x8000000000000000n])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
PASS is(test_data[2], result[2]) is true
PASS is(test_data[3], result[3]) is true
PASS is(test_data[4], result[4]) is true
value = new BigUint64Array([0n, 0xffffffffffffffffn])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data.length === result.length is true
PASS is(test_data[0], result[0]) is true
PASS is(test_data[1], result[1]) is true
Testing Arrays
test_data = []
test_data[0] = []
test_data[1] = [1, 2, 3]
test_data[10] = Object.assign(['foo', 'bar'], {10: true, 11: false, 20: 123, 21: 456, 30: null})
test_data[11] = Object.assign(['foo', 'bar'], {a: true, b: false, foo: 123, bar: 456, '': null})
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof test_data is typeof result
PASS test_data.length === result.length is true
PASS arrayCompare(test_data[0], result[0]) is true
PASS arrayCompare(test_data[1], result[1]) is true
PASS arrayCompare(test_data[10], result[10]) is true
PASS arrayCompare(test_data[11], result[11]) is true
Testing Map
test_data = new Map([[1,2],[3,4]])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof test_data is typeof result
PASS test_data.size is result.size
Testing Set
test_data = new Set([1,2,3,4])
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof test_data is typeof result
PASS test_data.size is result.size
PASS result.has(1) is true
PASS result.has(2) is true
PASS result.has(3) is true
PASS result.has(4) is true
Testing geometry types
Testing geometry type: new DOMMatrix()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing geometry type: new DOMMatrixReadOnly()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing geometry type: new DOMPoint()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing geometry type: new DOMPointReadOnly()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing geometry type: new DOMRect()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing geometry type: new DOMRectReadOnly()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing geometry type: new DOMQuad()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS test_data !== result is true
PASS typeof result is "object"
PASS Object.prototype.toString.call(test_data) is Object.prototype.toString.call(result)
PASS test_data.toString() is result.toString()
Testing CryptoKey
promise = crypto.subtle.generateKey({ name: 'HMAC', hash: {name: 'SHA-512'}}, true, ['sign', 'verify']);
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof test_data is typeof result
PASS test_data.type is result.type
PASS test_data.extractable is result.extractable
PASS test_data.algorithm.toString() is result.algorithm.toString()
PASS arrayCompare(test_data.usages, result.usages) is true
Testing DOMException objects
Testing: new DOMException()
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
Testing: new DOMException("message")
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
Testing: new DOMException("message", "name")
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
Testing: new DOMException("", "")
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
store.put(value, 'key')
store.get('key')
PASS typeof result is "object"
PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
PASS test_data !== result is true
PASS result.toString() is test_data.toString()
Test types that can't be cloned:
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
Testing Error
Expecting exception from store.put(new Error, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: The object can not be cloned.
Testing Function
Expecting exception from store.put(new Function, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: The object can not be cloned.
Testing other host object types
Expecting exception from store.put(self, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: The object can not be cloned.
Expecting exception from store.put(document, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: The object can not be cloned.
Expecting exception from store.put(document.body, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: The object can not be cloned.
PASS successfullyParsed is true
TEST COMPLETE