blob: 97289141efb05515d6f22744be1c63ca0a46908f [file] [log] [blame]
beidson@apple.com8ff3fe02016-01-21 02:13:21 +00001Test structured clone permutations in IndexedDB. File/FileList tests require DumpRenderTree.
2
3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
7
8indexedDB.deleteDatabase(dbname)
9indexedDB.open(dbname)
10store = db.createObjectStore('storeName')
11This index is not used, but evaluating key path on each put() call will exercise (de)serialization:
12store.createIndex('indexName', 'dummyKeyPath')
13
14Running tests...
15
16Testing: undefined
17transaction = db.transaction('storeName', 'readwrite')
18store = transaction.objectStore('storeName')
19store.put(value, 'key')
20store.get('key')
21PASS is(test_data, result) is true
22
23
24Testing: null
25transaction = db.transaction('storeName', 'readwrite')
26store = transaction.objectStore('storeName')
27store.put(value, 'key')
28store.get('key')
29PASS is(test_data, result) is true
30
31
32Testing boolean primitives
33
34Testing: true
35transaction = db.transaction('storeName', 'readwrite')
36store = transaction.objectStore('storeName')
37store.put(value, 'key')
38store.get('key')
39PASS is(test_data, result) is true
40
41Testing: false
42transaction = db.transaction('storeName', 'readwrite')
43store = transaction.objectStore('storeName')
44store.put(value, 'key')
45store.get('key')
46PASS is(test_data, result) is true
47
48
49Testing number primitives
50
51Testing: NaN
52transaction = db.transaction('storeName', 'readwrite')
53store = transaction.objectStore('storeName')
54store.put(value, 'key')
55store.get('key')
56PASS is(test_data, result) is true
57
58Testing: -Infinity
59transaction = db.transaction('storeName', 'readwrite')
60store = transaction.objectStore('storeName')
61store.put(value, 'key')
62store.get('key')
63PASS is(test_data, result) is true
64
65Testing: -Number.MAX_VALUE
66transaction = db.transaction('storeName', 'readwrite')
67store = transaction.objectStore('storeName')
68store.put(value, 'key')
69store.get('key')
70PASS is(test_data, result) is true
71
72Testing: -0xffffffff
73transaction = db.transaction('storeName', 'readwrite')
74store = transaction.objectStore('storeName')
75store.put(value, 'key')
76store.get('key')
77PASS is(test_data, result) is true
78
79Testing: -0x80000000
80transaction = db.transaction('storeName', 'readwrite')
81store = transaction.objectStore('storeName')
82store.put(value, 'key')
83store.get('key')
84PASS is(test_data, result) is true
85
86Testing: -0x7fffffff
87transaction = db.transaction('storeName', 'readwrite')
88store = transaction.objectStore('storeName')
89store.put(value, 'key')
90store.get('key')
91PASS is(test_data, result) is true
92
93Testing: -1
94transaction = db.transaction('storeName', 'readwrite')
95store = transaction.objectStore('storeName')
96store.put(value, 'key')
97store.get('key')
98PASS is(test_data, result) is true
99
100Testing: -Number.MIN_VALUE
101transaction = db.transaction('storeName', 'readwrite')
102store = transaction.objectStore('storeName')
103store.put(value, 'key')
104store.get('key')
105PASS is(test_data, result) is true
106
107Testing: -0
108transaction = db.transaction('storeName', 'readwrite')
109store = transaction.objectStore('storeName')
110store.put(value, 'key')
111store.get('key')
112PASS is(test_data, result) is true
113
114Testing: 0
115transaction = db.transaction('storeName', 'readwrite')
116store = transaction.objectStore('storeName')
117store.put(value, 'key')
118store.get('key')
119PASS is(test_data, result) is true
120
121Testing: 1
122transaction = db.transaction('storeName', 'readwrite')
123store = transaction.objectStore('storeName')
124store.put(value, 'key')
125store.get('key')
126PASS is(test_data, result) is true
127
128Testing: Number.MIN_VALUE
129transaction = db.transaction('storeName', 'readwrite')
130store = transaction.objectStore('storeName')
131store.put(value, 'key')
132store.get('key')
133PASS is(test_data, result) is true
134
135Testing: 0x7fffffff
136transaction = db.transaction('storeName', 'readwrite')
137store = transaction.objectStore('storeName')
138store.put(value, 'key')
139store.get('key')
140PASS is(test_data, result) is true
141
142Testing: 0x80000000
143transaction = db.transaction('storeName', 'readwrite')
144store = transaction.objectStore('storeName')
145store.put(value, 'key')
146store.get('key')
147PASS is(test_data, result) is true
148
149Testing: 0xffffffff
150transaction = db.transaction('storeName', 'readwrite')
151store = transaction.objectStore('storeName')
152store.put(value, 'key')
153store.get('key')
154PASS is(test_data, result) is true
155
156Testing: Number.MAX_VALUE
157transaction = db.transaction('storeName', 'readwrite')
158store = transaction.objectStore('storeName')
159store.put(value, 'key')
160store.get('key')
161PASS is(test_data, result) is true
162
163Testing: Infinity
164transaction = db.transaction('storeName', 'readwrite')
165store = transaction.objectStore('storeName')
166store.put(value, 'key')
167store.get('key')
168PASS is(test_data, result) is true
169
170
171Testing string primitives
172
173Testing: ''
174transaction = db.transaction('storeName', 'readwrite')
175store = transaction.objectStore('storeName')
176store.put(value, 'key')
177store.get('key')
178PASS is(test_data, result) is true
179
180Testing: 'this is a sample string'
181transaction = db.transaction('storeName', 'readwrite')
182store = transaction.objectStore('storeName')
183store.put(value, 'key')
184store.get('key')
185PASS is(test_data, result) is true
186
187Testing: 'null(\0)'
188transaction = db.transaction('storeName', 'readwrite')
189store = transaction.objectStore('storeName')
190store.put(value, 'key')
191store.get('key')
192PASS is(test_data, result) is true
193
194
195Testing Boolean objects
196
197Testing: new Boolean(true)
198transaction = db.transaction('storeName', 'readwrite')
199store = transaction.objectStore('storeName')
200store.put(value, 'key')
201store.get('key')
202PASS typeof result is "object"
203PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
204PASS test_data !== result is true
205PASS result.toString() is test_data.toString()
206PASS is(test_data.valueOf(), result.valueOf()) is true
207
208Testing: new Boolean(false)
209transaction = db.transaction('storeName', 'readwrite')
210store = transaction.objectStore('storeName')
211store.put(value, 'key')
212store.get('key')
213PASS typeof result is "object"
214PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
215PASS test_data !== result is true
216PASS result.toString() is test_data.toString()
217PASS is(test_data.valueOf(), result.valueOf()) is true
218
219
220Testing Number objects
221
222Testing: new Number(NaN)
223transaction = db.transaction('storeName', 'readwrite')
224store = transaction.objectStore('storeName')
225store.put(value, 'key')
226store.get('key')
227PASS typeof result is "object"
228PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
229PASS test_data !== result is true
230PASS result.toString() is test_data.toString()
231PASS is(test_data.valueOf(), result.valueOf()) is true
232
233Testing: new Number(-Infinity)
234transaction = db.transaction('storeName', 'readwrite')
235store = transaction.objectStore('storeName')
236store.put(value, 'key')
237store.get('key')
238PASS typeof result is "object"
239PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
240PASS test_data !== result is true
241PASS result.toString() is test_data.toString()
242PASS is(test_data.valueOf(), result.valueOf()) is true
243
244Testing: new Number(-Number.MAX_VALUE)
245transaction = db.transaction('storeName', 'readwrite')
246store = transaction.objectStore('storeName')
247store.put(value, 'key')
248store.get('key')
249PASS typeof result is "object"
250PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
251PASS test_data !== result is true
252PASS result.toString() is test_data.toString()
253PASS is(test_data.valueOf(), result.valueOf()) is true
254
255Testing: new Number(-Number.MIN_VALUE)
256transaction = db.transaction('storeName', 'readwrite')
257store = transaction.objectStore('storeName')
258store.put(value, 'key')
259store.get('key')
260PASS typeof result is "object"
261PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
262PASS test_data !== result is true
263PASS result.toString() is test_data.toString()
264PASS is(test_data.valueOf(), result.valueOf()) is true
265
266Testing: new Number(-0)
267transaction = db.transaction('storeName', 'readwrite')
268store = transaction.objectStore('storeName')
269store.put(value, 'key')
270store.get('key')
271PASS typeof result is "object"
272PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
273PASS test_data !== result is true
274PASS result.toString() is test_data.toString()
275PASS is(test_data.valueOf(), result.valueOf()) is true
276
277Testing: new Number(0)
278transaction = db.transaction('storeName', 'readwrite')
279store = transaction.objectStore('storeName')
280store.put(value, 'key')
281store.get('key')
282PASS typeof result is "object"
283PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
284PASS test_data !== result is true
285PASS result.toString() is test_data.toString()
286PASS is(test_data.valueOf(), result.valueOf()) is true
287
288Testing: new Number(Number.MIN_VALUE)
289transaction = db.transaction('storeName', 'readwrite')
290store = transaction.objectStore('storeName')
291store.put(value, 'key')
292store.get('key')
293PASS typeof result is "object"
294PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
295PASS test_data !== result is true
296PASS result.toString() is test_data.toString()
297PASS is(test_data.valueOf(), result.valueOf()) is true
298
299Testing: new Number(Number.MAX_VALUE)
300transaction = db.transaction('storeName', 'readwrite')
301store = transaction.objectStore('storeName')
302store.put(value, 'key')
303store.get('key')
304PASS typeof result is "object"
305PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
306PASS test_data !== result is true
307PASS result.toString() is test_data.toString()
308PASS is(test_data.valueOf(), result.valueOf()) is true
309
310Testing: new Number(Infinity)
311transaction = db.transaction('storeName', 'readwrite')
312store = transaction.objectStore('storeName')
313store.put(value, 'key')
314store.get('key')
315PASS typeof result is "object"
316PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
317PASS test_data !== result is true
318PASS result.toString() is test_data.toString()
319PASS is(test_data.valueOf(), result.valueOf()) is true
320
321
322Testing String objects
323
324Testing: new String()
325transaction = db.transaction('storeName', 'readwrite')
326store = transaction.objectStore('storeName')
327store.put(value, 'key')
328store.get('key')
329PASS typeof result is "object"
330PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
331PASS test_data !== result is true
332PASS result.toString() is test_data.toString()
333PASS is(test_data.valueOf(), result.valueOf()) is true
334
335Testing: new String('this is a sample string')
336transaction = db.transaction('storeName', 'readwrite')
337store = transaction.objectStore('storeName')
338store.put(value, 'key')
339store.get('key')
340PASS typeof result is "object"
341PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
342PASS test_data !== result is true
343PASS result.toString() is test_data.toString()
344PASS is(test_data.valueOf(), result.valueOf()) is true
345
346Testing: new String('null(\0)')
347transaction = db.transaction('storeName', 'readwrite')
348store = transaction.objectStore('storeName')
349store.put(value, 'key')
350store.get('key')
351PASS typeof result is "object"
352PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
353PASS test_data !== result is true
354PASS result.toString() is test_data.toString()
355PASS is(test_data.valueOf(), result.valueOf()) is true
356
357
358Testing Date objects
359
360Testing: new Date(-1e13)
361transaction = db.transaction('storeName', 'readwrite')
362store = transaction.objectStore('storeName')
363store.put(value, 'key')
364store.get('key')
365PASS typeof result is "object"
366PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
367PASS test_data !== result is true
368PASS result.toString() is test_data.toString()
369PASS is(test_data.valueOf(), result.valueOf()) is true
370
371Testing: new Date(-1e12)
372transaction = db.transaction('storeName', 'readwrite')
373store = transaction.objectStore('storeName')
374store.put(value, 'key')
375store.get('key')
376PASS typeof result is "object"
377PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
378PASS test_data !== result is true
379PASS result.toString() is test_data.toString()
380PASS is(test_data.valueOf(), result.valueOf()) is true
381
382Testing: new Date(-1e9)
383transaction = db.transaction('storeName', 'readwrite')
384store = transaction.objectStore('storeName')
385store.put(value, 'key')
386store.get('key')
387PASS typeof result is "object"
388PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
389PASS test_data !== result is true
390PASS result.toString() is test_data.toString()
391PASS is(test_data.valueOf(), result.valueOf()) is true
392
393Testing: new Date(-1e6)
394transaction = db.transaction('storeName', 'readwrite')
395store = transaction.objectStore('storeName')
396store.put(value, 'key')
397store.get('key')
398PASS typeof result is "object"
399PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
400PASS test_data !== result is true
401PASS result.toString() is test_data.toString()
402PASS is(test_data.valueOf(), result.valueOf()) is true
403
404Testing: new Date(-1e3)
405transaction = db.transaction('storeName', 'readwrite')
406store = transaction.objectStore('storeName')
407store.put(value, 'key')
408store.get('key')
409PASS typeof result is "object"
410PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
411PASS test_data !== result is true
412PASS result.toString() is test_data.toString()
413PASS is(test_data.valueOf(), result.valueOf()) is true
414
415Testing: new Date(0)
416transaction = db.transaction('storeName', 'readwrite')
417store = transaction.objectStore('storeName')
418store.put(value, 'key')
419store.get('key')
420PASS typeof result is "object"
421PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
422PASS test_data !== result is true
423PASS result.toString() is test_data.toString()
424PASS is(test_data.valueOf(), result.valueOf()) is true
425
426Testing: new Date(1e3)
427transaction = db.transaction('storeName', 'readwrite')
428store = transaction.objectStore('storeName')
429store.put(value, 'key')
430store.get('key')
431PASS typeof result is "object"
432PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
433PASS test_data !== result is true
434PASS result.toString() is test_data.toString()
435PASS is(test_data.valueOf(), result.valueOf()) is true
436
437Testing: new Date(1e6)
438transaction = db.transaction('storeName', 'readwrite')
439store = transaction.objectStore('storeName')
440store.put(value, 'key')
441store.get('key')
442PASS typeof result is "object"
443PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
444PASS test_data !== result is true
445PASS result.toString() is test_data.toString()
446PASS is(test_data.valueOf(), result.valueOf()) is true
447
448Testing: new Date(1e9)
449transaction = db.transaction('storeName', 'readwrite')
450store = transaction.objectStore('storeName')
451store.put(value, 'key')
452store.get('key')
453PASS typeof result is "object"
454PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
455PASS test_data !== result is true
456PASS result.toString() is test_data.toString()
457PASS is(test_data.valueOf(), result.valueOf()) is true
458
459Testing: new Date(1e12)
460transaction = db.transaction('storeName', 'readwrite')
461store = transaction.objectStore('storeName')
462store.put(value, 'key')
463store.get('key')
464PASS typeof result is "object"
465PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
466PASS test_data !== result is true
467PASS result.toString() is test_data.toString()
468PASS is(test_data.valueOf(), result.valueOf()) is true
469
470Testing: new Date(1e13)
471transaction = db.transaction('storeName', 'readwrite')
472store = transaction.objectStore('storeName')
473store.put(value, 'key')
474store.get('key')
475PASS typeof result is "object"
476PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
477PASS test_data !== result is true
478PASS result.toString() is test_data.toString()
479PASS is(test_data.valueOf(), result.valueOf()) is true
480
481
482Testing RegExp objects
483
484Testing RegExp: new RegExp()
485transaction = db.transaction('storeName', 'readwrite')
486store = transaction.objectStore('storeName')
487store.put(value, 'key')
488store.get('key')
489PASS test_data !== result is true
490PASS Object.prototype.toString.call(result) is "[object RegExp]"
491PASS result.toString() is test_data.toString()
492
493Testing RegExp: /abc/
494transaction = db.transaction('storeName', 'readwrite')
495store = transaction.objectStore('storeName')
496store.put(value, 'key')
497store.get('key')
498PASS test_data !== result is true
499PASS Object.prototype.toString.call(result) is "[object RegExp]"
500PASS result.toString() is test_data.toString()
501
502Testing RegExp: /abc/g
503transaction = db.transaction('storeName', 'readwrite')
504store = transaction.objectStore('storeName')
505store.put(value, 'key')
506store.get('key')
507PASS test_data !== result is true
508PASS Object.prototype.toString.call(result) is "[object RegExp]"
509PASS result.toString() is test_data.toString()
510
511Testing RegExp: /abc/i
512transaction = db.transaction('storeName', 'readwrite')
513store = transaction.objectStore('storeName')
514store.put(value, 'key')
515store.get('key')
516PASS test_data !== result is true
517PASS Object.prototype.toString.call(result) is "[object RegExp]"
518PASS result.toString() is test_data.toString()
519
520Testing RegExp: /abc/gi
521transaction = db.transaction('storeName', 'readwrite')
522store = transaction.objectStore('storeName')
523store.put(value, 'key')
524store.get('key')
525PASS test_data !== result is true
526PASS Object.prototype.toString.call(result) is "[object RegExp]"
527PASS result.toString() is test_data.toString()
528
529Testing RegExp: /abc/m
530transaction = db.transaction('storeName', 'readwrite')
531store = transaction.objectStore('storeName')
532store.put(value, 'key')
533store.get('key')
534PASS test_data !== result is true
535PASS Object.prototype.toString.call(result) is "[object RegExp]"
536PASS result.toString() is test_data.toString()
537
538Testing RegExp: /abc/mg
539transaction = db.transaction('storeName', 'readwrite')
540store = transaction.objectStore('storeName')
541store.put(value, 'key')
542store.get('key')
543PASS test_data !== result is true
544PASS Object.prototype.toString.call(result) is "[object RegExp]"
545PASS result.toString() is test_data.toString()
546
547Testing RegExp: /abc/mi
548transaction = db.transaction('storeName', 'readwrite')
549store = transaction.objectStore('storeName')
550store.put(value, 'key')
551store.get('key')
552PASS test_data !== result is true
553PASS Object.prototype.toString.call(result) is "[object RegExp]"
554PASS result.toString() is test_data.toString()
555
556Testing RegExp: /abc/mgi
557transaction = db.transaction('storeName', 'readwrite')
558store = transaction.objectStore('storeName')
559store.put(value, 'key')
560store.get('key')
561PASS test_data !== result is true
562PASS Object.prototype.toString.call(result) is "[object RegExp]"
563PASS result.toString() is test_data.toString()
564
565
566Testing ImageData
567canvas = document.createElement('canvas')
568canvas.width = 8
569canvas.height = 8
570test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8)
571transaction = db.transaction('storeName', 'readwrite')
572store = transaction.objectStore('storeName')
573store.put(value, 'key')
574store.get('key')
575PASS test_data !== result is true
576PASS Object.prototype.toString.call(result) is "[object ImageData]"
577PASS result.width is test_data.width
578PASS result.height is test_data.height
579PASS result.data.length is test_data.data.length
580PASS result data matches
581
582Testing Blob
583Skipping test
584
585Testing File
586Skipping test
587
588Testing FileList
589Skipping test
590
591Testing Array
592test_data = []
593test_data[0] = 'foo'
594test_data[1] = 'bar'
595test_data[10] = true
596test_data[11] = false
597test_data[20] = 123
598test_data[21] = 456
599test_data[30] = null
600transaction = db.transaction('storeName', 'readwrite')
601store = transaction.objectStore('storeName')
602store.put(value, 'key')
603store.get('key')
604PASS test_data !== result is true
605PASS test_data.length === result.length is true
606PASS test_data[0] is result[0]
607PASS test_data[1] is result[1]
608PASS test_data[10] is result[10]
609PASS test_data[11] is result[11]
610PASS test_data[20] is result[20]
611PASS test_data[21] is result[21]
612PASS test_data[30] is result[30]
613
614Testing Object
615test_data = []
616test_data[0] = 'foo'
617test_data[1] = 'bar'
618test_data['a'] = true
619test_data['b'] = false
620test_data['foo'] = 123
621test_data['bar'] = 456
622test_data[''] = null
623transaction = db.transaction('storeName', 'readwrite')
624store = transaction.objectStore('storeName')
625store.put(value, 'key')
626store.get('key')
627PASS test_data !== result is true
628PASS arrayCompare(Object.keys(result).sort(), Object.keys(test_data).sort()) is true
629PASS test_data["0"] is result["0"]
630PASS test_data["1"] is result["1"]
631PASS test_data["a"] is result["a"]
632PASS test_data["b"] is result["b"]
633PASS test_data["foo"] is result["foo"]
634PASS test_data["bar"] is result["bar"]
635PASS test_data[""] is result[""]
636
637Testing TypedArray
638value = new Uint8Array([])
639transaction = db.transaction('storeName', 'readwrite')
640store = transaction.objectStore('storeName')
641store.put(value, 'key')
642store.get('key')
643PASS test_data !== result is true
644PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
645PASS test_data.length === result.length is true
646
647value = new Uint8Array([0, 1, 254, 255])
648transaction = db.transaction('storeName', 'readwrite')
649store = transaction.objectStore('storeName')
650store.put(value, 'key')
651store.get('key')
652PASS test_data !== result is true
653PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
654PASS test_data.length === result.length is true
655PASS is(test_data[0], result[0]) is true
656PASS is(test_data[1], result[1]) is true
657PASS is(test_data[2], result[2]) is true
658PASS is(test_data[3], result[3]) is true
659
660value = new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
661transaction = db.transaction('storeName', 'readwrite')
662store = transaction.objectStore('storeName')
663store.put(value, 'key')
664store.get('key')
665PASS test_data !== result is true
666PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
667PASS test_data.length === result.length is true
668PASS is(test_data[0], result[0]) is true
669PASS is(test_data[1], result[1]) is true
670PASS is(test_data[2], result[2]) is true
671PASS is(test_data[3], result[3]) is true
672
673value = new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
674transaction = db.transaction('storeName', 'readwrite')
675store = transaction.objectStore('storeName')
676store.put(value, 'key')
677store.get('key')
678PASS test_data !== result is true
679PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
680PASS test_data.length === result.length is true
681PASS is(test_data[0], result[0]) is true
682PASS is(test_data[1], result[1]) is true
683PASS is(test_data[2], result[2]) is true
684PASS is(test_data[3], result[3]) is true
685
686value = new Int8Array([0, 1, 254, 255])
687transaction = db.transaction('storeName', 'readwrite')
688store = transaction.objectStore('storeName')
689store.put(value, 'key')
690store.get('key')
691PASS test_data !== result is true
692PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
693PASS test_data.length === result.length is true
694PASS is(test_data[0], result[0]) is true
695PASS is(test_data[1], result[1]) is true
696PASS is(test_data[2], result[2]) is true
697PASS is(test_data[3], result[3]) is true
698
699value = new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
700transaction = db.transaction('storeName', 'readwrite')
701store = transaction.objectStore('storeName')
702store.put(value, 'key')
703store.get('key')
704PASS test_data !== result is true
705PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
706PASS test_data.length === result.length is true
707PASS is(test_data[0], result[0]) is true
708PASS is(test_data[1], result[1]) is true
709PASS is(test_data[2], result[2]) is true
710PASS is(test_data[3], result[3]) is true
711
712value = new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
713transaction = db.transaction('storeName', 'readwrite')
714store = transaction.objectStore('storeName')
715store.put(value, 'key')
716store.get('key')
717PASS test_data !== result is true
718PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
719PASS test_data.length === result.length is true
720PASS is(test_data[0], result[0]) is true
721PASS is(test_data[1], result[1]) is true
722PASS is(test_data[2], result[2]) is true
723PASS is(test_data[3], result[3]) is true
724
725value = new Uint8ClampedArray([0, 1, 254, 255])
726transaction = db.transaction('storeName', 'readwrite')
727store = transaction.objectStore('storeName')
728store.put(value, 'key')
729store.get('key')
730PASS test_data !== result is true
731PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
732PASS test_data.length === result.length is true
733PASS is(test_data[0], result[0]) is true
734PASS is(test_data[1], result[1]) is true
735PASS is(test_data[2], result[2]) is true
736PASS is(test_data[3], result[3]) is true
737
738value = new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])
739transaction = db.transaction('storeName', 'readwrite')
740store = transaction.objectStore('storeName')
741store.put(value, 'key')
742store.get('key')
743PASS test_data !== result is true
744PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
745PASS test_data.length === result.length is true
746PASS is(test_data[0], result[0]) is true
747PASS is(test_data[1], result[1]) is true
748PASS is(test_data[2], result[2]) is true
749PASS is(test_data[3], result[3]) is true
750PASS is(test_data[4], result[4]) is true
751PASS is(test_data[5], result[5]) is true
752PASS is(test_data[6], result[6]) is true
753PASS is(test_data[7], result[7]) is true
754PASS is(test_data[8], result[8]) is true
755PASS is(test_data[9], result[9]) is true
756
757value = new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])
758transaction = db.transaction('storeName', 'readwrite')
759store = transaction.objectStore('storeName')
760store.put(value, 'key')
761store.get('key')
762PASS test_data !== result is true
763PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
764PASS test_data.length === result.length is true
765PASS is(test_data[0], result[0]) is true
766PASS is(test_data[1], result[1]) is true
767PASS is(test_data[2], result[2]) is true
768PASS is(test_data[3], result[3]) is true
769PASS is(test_data[4], result[4]) is true
770PASS is(test_data[5], result[5]) is true
771PASS is(test_data[6], result[6]) is true
772PASS is(test_data[7], result[7]) is true
773
774
775
776Test types that can't be cloned:
777
778transaction = db.transaction('storeName', 'readwrite')
779store = transaction.objectStore('storeName')
780
781Other JavaScript object types:
782Expecting exception from store.put(new Error, 'key')
783PASS Exception was thrown.
784PASS code is DOMException.DATA_CLONE_ERR
785Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
786Expecting exception from store.put(new Function, 'key')
787PASS Exception was thrown.
788PASS code is DOMException.DATA_CLONE_ERR
789Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
790
791Other host object types:
792Expecting exception from store.put(self, 'key')
793PASS Exception was thrown.
794PASS code is DOMException.DATA_CLONE_ERR
795Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
796Expecting exception from store.put(document, 'key')
797PASS Exception was thrown.
798PASS code is DOMException.DATA_CLONE_ERR
799Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
800Expecting exception from store.put(document.body, 'key')
801PASS Exception was thrown.
802PASS code is DOMException.DATA_CLONE_ERR
803Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
804PASS successfullyParsed is true
805
806TEST COMPLETE
807