1 Test structured clone permutations in IndexedDB. File/FileList tests require DumpRenderTree.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 dbname = "structured-clone.html"
7 indexedDB.deleteDatabase(dbname)
9 store = db.createObjectStore('storeName')
10 This index is not used, but evaluating key path on each put() call will exercise (de)serialization:
11 store.createIndex('indexName', 'dummyKeyPath')
16 transaction = db.transaction('storeName', 'readwrite')
17 store = transaction.objectStore('storeName')
18 store.put(value, 'key')
20 PASS is(test_data, result) is true
24 transaction = db.transaction('storeName', 'readwrite')
25 store = transaction.objectStore('storeName')
26 store.put(value, 'key')
28 PASS is(test_data, result) is true
31 Testing boolean primitives
34 transaction = db.transaction('storeName', 'readwrite')
35 store = transaction.objectStore('storeName')
36 store.put(value, 'key')
38 PASS is(test_data, result) is true
41 transaction = db.transaction('storeName', 'readwrite')
42 store = transaction.objectStore('storeName')
43 store.put(value, 'key')
45 PASS is(test_data, result) is true
48 Testing number primitives
51 transaction = db.transaction('storeName', 'readwrite')
52 store = transaction.objectStore('storeName')
53 store.put(value, 'key')
55 PASS is(test_data, result) is true
58 transaction = db.transaction('storeName', 'readwrite')
59 store = transaction.objectStore('storeName')
60 store.put(value, 'key')
62 PASS is(test_data, result) is true
64 Testing: -Number.MAX_VALUE
65 transaction = db.transaction('storeName', 'readwrite')
66 store = transaction.objectStore('storeName')
67 store.put(value, 'key')
69 PASS is(test_data, result) is true
72 transaction = db.transaction('storeName', 'readwrite')
73 store = transaction.objectStore('storeName')
74 store.put(value, 'key')
76 PASS is(test_data, result) is true
79 transaction = db.transaction('storeName', 'readwrite')
80 store = transaction.objectStore('storeName')
81 store.put(value, 'key')
83 PASS is(test_data, result) is true
86 transaction = db.transaction('storeName', 'readwrite')
87 store = transaction.objectStore('storeName')
88 store.put(value, 'key')
90 PASS is(test_data, result) is true
93 transaction = db.transaction('storeName', 'readwrite')
94 store = transaction.objectStore('storeName')
95 store.put(value, 'key')
97 PASS is(test_data, result) is true
99 Testing: -Number.MIN_VALUE
100 transaction = db.transaction('storeName', 'readwrite')
101 store = transaction.objectStore('storeName')
102 store.put(value, 'key')
104 PASS is(test_data, result) is true
107 transaction = db.transaction('storeName', 'readwrite')
108 store = transaction.objectStore('storeName')
109 store.put(value, 'key')
111 PASS is(test_data, result) is true
114 transaction = db.transaction('storeName', 'readwrite')
115 store = transaction.objectStore('storeName')
116 store.put(value, 'key')
118 PASS is(test_data, result) is true
121 transaction = db.transaction('storeName', 'readwrite')
122 store = transaction.objectStore('storeName')
123 store.put(value, 'key')
125 PASS is(test_data, result) is true
127 Testing: Number.MIN_VALUE
128 transaction = db.transaction('storeName', 'readwrite')
129 store = transaction.objectStore('storeName')
130 store.put(value, 'key')
132 PASS is(test_data, result) is true
135 transaction = db.transaction('storeName', 'readwrite')
136 store = transaction.objectStore('storeName')
137 store.put(value, 'key')
139 PASS is(test_data, result) is true
142 transaction = db.transaction('storeName', 'readwrite')
143 store = transaction.objectStore('storeName')
144 store.put(value, 'key')
146 PASS is(test_data, result) is true
149 transaction = db.transaction('storeName', 'readwrite')
150 store = transaction.objectStore('storeName')
151 store.put(value, 'key')
153 PASS is(test_data, result) is true
155 Testing: Number.MAX_VALUE
156 transaction = db.transaction('storeName', 'readwrite')
157 store = transaction.objectStore('storeName')
158 store.put(value, 'key')
160 PASS is(test_data, result) is true
163 transaction = db.transaction('storeName', 'readwrite')
164 store = transaction.objectStore('storeName')
165 store.put(value, 'key')
167 PASS is(test_data, result) is true
170 Testing string primitives
173 transaction = db.transaction('storeName', 'readwrite')
174 store = transaction.objectStore('storeName')
175 store.put(value, 'key')
177 PASS is(test_data, result) is true
179 Testing: 'this is a sample string'
180 transaction = db.transaction('storeName', 'readwrite')
181 store = transaction.objectStore('storeName')
182 store.put(value, 'key')
184 PASS is(test_data, result) is true
187 transaction = db.transaction('storeName', 'readwrite')
188 store = transaction.objectStore('storeName')
189 store.put(value, 'key')
191 PASS is(test_data, result) is true
194 Testing Boolean objects
196 Testing: new Boolean(true)
197 transaction = db.transaction('storeName', 'readwrite')
198 store = transaction.objectStore('storeName')
199 store.put(value, 'key')
201 PASS typeof result is "object"
202 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
203 PASS test_data !== result is true
204 PASS result.toString() is test_data.toString()
205 PASS is(test_data.valueOf(), result.valueOf()) is true
207 Testing: new Boolean(false)
208 transaction = db.transaction('storeName', 'readwrite')
209 store = transaction.objectStore('storeName')
210 store.put(value, 'key')
212 PASS typeof result is "object"
213 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
214 PASS test_data !== result is true
215 PASS result.toString() is test_data.toString()
216 PASS is(test_data.valueOf(), result.valueOf()) is true
219 Testing Number objects
221 Testing: new Number(NaN)
222 transaction = db.transaction('storeName', 'readwrite')
223 store = transaction.objectStore('storeName')
224 store.put(value, 'key')
226 PASS typeof result is "object"
227 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
228 PASS test_data !== result is true
229 PASS result.toString() is test_data.toString()
230 PASS is(test_data.valueOf(), result.valueOf()) is true
232 Testing: new Number(-Infinity)
233 transaction = db.transaction('storeName', 'readwrite')
234 store = transaction.objectStore('storeName')
235 store.put(value, 'key')
237 PASS typeof result is "object"
238 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
239 PASS test_data !== result is true
240 PASS result.toString() is test_data.toString()
241 PASS is(test_data.valueOf(), result.valueOf()) is true
243 Testing: new Number(-Number.MAX_VALUE)
244 transaction = db.transaction('storeName', 'readwrite')
245 store = transaction.objectStore('storeName')
246 store.put(value, 'key')
248 PASS typeof result is "object"
249 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
250 PASS test_data !== result is true
251 PASS result.toString() is test_data.toString()
252 PASS is(test_data.valueOf(), result.valueOf()) is true
254 Testing: new Number(-Number.MIN_VALUE)
255 transaction = db.transaction('storeName', 'readwrite')
256 store = transaction.objectStore('storeName')
257 store.put(value, 'key')
259 PASS typeof result is "object"
260 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
261 PASS test_data !== result is true
262 PASS result.toString() is test_data.toString()
263 PASS is(test_data.valueOf(), result.valueOf()) is true
265 Testing: new Number(-0)
266 transaction = db.transaction('storeName', 'readwrite')
267 store = transaction.objectStore('storeName')
268 store.put(value, 'key')
270 PASS typeof result is "object"
271 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
272 PASS test_data !== result is true
273 PASS result.toString() is test_data.toString()
274 PASS is(test_data.valueOf(), result.valueOf()) is true
276 Testing: new Number(0)
277 transaction = db.transaction('storeName', 'readwrite')
278 store = transaction.objectStore('storeName')
279 store.put(value, 'key')
281 PASS typeof result is "object"
282 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
283 PASS test_data !== result is true
284 PASS result.toString() is test_data.toString()
285 PASS is(test_data.valueOf(), result.valueOf()) is true
287 Testing: new Number(Number.MIN_VALUE)
288 transaction = db.transaction('storeName', 'readwrite')
289 store = transaction.objectStore('storeName')
290 store.put(value, 'key')
292 PASS typeof result is "object"
293 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
294 PASS test_data !== result is true
295 PASS result.toString() is test_data.toString()
296 PASS is(test_data.valueOf(), result.valueOf()) is true
298 Testing: new Number(Number.MAX_VALUE)
299 transaction = db.transaction('storeName', 'readwrite')
300 store = transaction.objectStore('storeName')
301 store.put(value, 'key')
303 PASS typeof result is "object"
304 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
305 PASS test_data !== result is true
306 PASS result.toString() is test_data.toString()
307 PASS is(test_data.valueOf(), result.valueOf()) is true
309 Testing: new Number(Infinity)
310 transaction = db.transaction('storeName', 'readwrite')
311 store = transaction.objectStore('storeName')
312 store.put(value, 'key')
314 PASS typeof result is "object"
315 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
316 PASS test_data !== result is true
317 PASS result.toString() is test_data.toString()
318 PASS is(test_data.valueOf(), result.valueOf()) is true
321 Testing String objects
323 Testing: new String()
324 transaction = db.transaction('storeName', 'readwrite')
325 store = transaction.objectStore('storeName')
326 store.put(value, 'key')
328 PASS typeof result is "object"
329 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
330 PASS test_data !== result is true
331 PASS result.toString() is test_data.toString()
332 PASS is(test_data.valueOf(), result.valueOf()) is true
334 Testing: new String('this is a sample string')
335 transaction = db.transaction('storeName', 'readwrite')
336 store = transaction.objectStore('storeName')
337 store.put(value, 'key')
339 PASS typeof result is "object"
340 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
341 PASS test_data !== result is true
342 PASS result.toString() is test_data.toString()
343 PASS is(test_data.valueOf(), result.valueOf()) is true
345 Testing: new String('null(\0)')
346 transaction = db.transaction('storeName', 'readwrite')
347 store = transaction.objectStore('storeName')
348 store.put(value, 'key')
350 PASS typeof result is "object"
351 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
352 PASS test_data !== result is true
353 PASS result.toString() is test_data.toString()
354 PASS is(test_data.valueOf(), result.valueOf()) is true
359 Testing: new Date(-1e13)
360 transaction = db.transaction('storeName', 'readwrite')
361 store = transaction.objectStore('storeName')
362 store.put(value, 'key')
364 PASS typeof result is "object"
365 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
366 PASS test_data !== result is true
367 PASS result.toString() is test_data.toString()
368 PASS is(test_data.valueOf(), result.valueOf()) is true
370 Testing: new Date(-1e12)
371 transaction = db.transaction('storeName', 'readwrite')
372 store = transaction.objectStore('storeName')
373 store.put(value, 'key')
375 PASS typeof result is "object"
376 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
377 PASS test_data !== result is true
378 PASS result.toString() is test_data.toString()
379 PASS is(test_data.valueOf(), result.valueOf()) is true
381 Testing: new Date(-1e9)
382 transaction = db.transaction('storeName', 'readwrite')
383 store = transaction.objectStore('storeName')
384 store.put(value, 'key')
386 PASS typeof result is "object"
387 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
388 PASS test_data !== result is true
389 PASS result.toString() is test_data.toString()
390 PASS is(test_data.valueOf(), result.valueOf()) is true
392 Testing: new Date(-1e6)
393 transaction = db.transaction('storeName', 'readwrite')
394 store = transaction.objectStore('storeName')
395 store.put(value, 'key')
397 PASS typeof result is "object"
398 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
399 PASS test_data !== result is true
400 PASS result.toString() is test_data.toString()
401 PASS is(test_data.valueOf(), result.valueOf()) is true
403 Testing: new Date(-1e3)
404 transaction = db.transaction('storeName', 'readwrite')
405 store = transaction.objectStore('storeName')
406 store.put(value, 'key')
408 PASS typeof result is "object"
409 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
410 PASS test_data !== result is true
411 PASS result.toString() is test_data.toString()
412 PASS is(test_data.valueOf(), result.valueOf()) is true
415 transaction = db.transaction('storeName', 'readwrite')
416 store = transaction.objectStore('storeName')
417 store.put(value, 'key')
419 PASS typeof result is "object"
420 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
421 PASS test_data !== result is true
422 PASS result.toString() is test_data.toString()
423 PASS is(test_data.valueOf(), result.valueOf()) is true
425 Testing: new Date(1e3)
426 transaction = db.transaction('storeName', 'readwrite')
427 store = transaction.objectStore('storeName')
428 store.put(value, 'key')
430 PASS typeof result is "object"
431 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
432 PASS test_data !== result is true
433 PASS result.toString() is test_data.toString()
434 PASS is(test_data.valueOf(), result.valueOf()) is true
436 Testing: new Date(1e6)
437 transaction = db.transaction('storeName', 'readwrite')
438 store = transaction.objectStore('storeName')
439 store.put(value, 'key')
441 PASS typeof result is "object"
442 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
443 PASS test_data !== result is true
444 PASS result.toString() is test_data.toString()
445 PASS is(test_data.valueOf(), result.valueOf()) is true
447 Testing: new Date(1e9)
448 transaction = db.transaction('storeName', 'readwrite')
449 store = transaction.objectStore('storeName')
450 store.put(value, 'key')
452 PASS typeof result is "object"
453 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
454 PASS test_data !== result is true
455 PASS result.toString() is test_data.toString()
456 PASS is(test_data.valueOf(), result.valueOf()) is true
458 Testing: new Date(1e12)
459 transaction = db.transaction('storeName', 'readwrite')
460 store = transaction.objectStore('storeName')
461 store.put(value, 'key')
463 PASS typeof result is "object"
464 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
465 PASS test_data !== result is true
466 PASS result.toString() is test_data.toString()
467 PASS is(test_data.valueOf(), result.valueOf()) is true
469 Testing: new Date(1e13)
470 transaction = db.transaction('storeName', 'readwrite')
471 store = transaction.objectStore('storeName')
472 store.put(value, 'key')
474 PASS typeof result is "object"
475 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
476 PASS test_data !== result is true
477 PASS result.toString() is test_data.toString()
478 PASS is(test_data.valueOf(), result.valueOf()) is true
481 Testing RegExp objects
483 Testing RegExp: new RegExp()
484 transaction = db.transaction('storeName', 'readwrite')
485 store = transaction.objectStore('storeName')
486 store.put(value, 'key')
488 PASS test_data !== result is true
489 PASS Object.prototype.toString.call(result) is "[object RegExp]"
490 PASS result.toString() is test_data.toString()
492 Testing RegExp: /abc/
493 transaction = db.transaction('storeName', 'readwrite')
494 store = transaction.objectStore('storeName')
495 store.put(value, 'key')
497 PASS test_data !== result is true
498 PASS Object.prototype.toString.call(result) is "[object RegExp]"
499 PASS result.toString() is test_data.toString()
501 Testing RegExp: /abc/g
502 transaction = db.transaction('storeName', 'readwrite')
503 store = transaction.objectStore('storeName')
504 store.put(value, 'key')
506 PASS test_data !== result is true
507 PASS Object.prototype.toString.call(result) is "[object RegExp]"
508 PASS result.toString() is test_data.toString()
510 Testing RegExp: /abc/i
511 transaction = db.transaction('storeName', 'readwrite')
512 store = transaction.objectStore('storeName')
513 store.put(value, 'key')
515 PASS test_data !== result is true
516 PASS Object.prototype.toString.call(result) is "[object RegExp]"
517 PASS result.toString() is test_data.toString()
519 Testing RegExp: /abc/gi
520 transaction = db.transaction('storeName', 'readwrite')
521 store = transaction.objectStore('storeName')
522 store.put(value, 'key')
524 PASS test_data !== result is true
525 PASS Object.prototype.toString.call(result) is "[object RegExp]"
526 PASS result.toString() is test_data.toString()
528 Testing RegExp: /abc/m
529 transaction = db.transaction('storeName', 'readwrite')
530 store = transaction.objectStore('storeName')
531 store.put(value, 'key')
533 PASS test_data !== result is true
534 PASS Object.prototype.toString.call(result) is "[object RegExp]"
535 PASS result.toString() is test_data.toString()
537 Testing RegExp: /abc/mg
538 transaction = db.transaction('storeName', 'readwrite')
539 store = transaction.objectStore('storeName')
540 store.put(value, 'key')
542 PASS test_data !== result is true
543 PASS Object.prototype.toString.call(result) is "[object RegExp]"
544 PASS result.toString() is test_data.toString()
546 Testing RegExp: /abc/mi
547 transaction = db.transaction('storeName', 'readwrite')
548 store = transaction.objectStore('storeName')
549 store.put(value, 'key')
551 PASS test_data !== result is true
552 PASS Object.prototype.toString.call(result) is "[object RegExp]"
553 PASS result.toString() is test_data.toString()
555 Testing RegExp: /abc/mgi
556 transaction = db.transaction('storeName', 'readwrite')
557 store = transaction.objectStore('storeName')
558 store.put(value, 'key')
560 PASS test_data !== result is true
561 PASS Object.prototype.toString.call(result) is "[object RegExp]"
562 PASS result.toString() is test_data.toString()
566 canvas = document.createElement('canvas')
569 test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8)
570 transaction = db.transaction('storeName', 'readwrite')
571 store = transaction.objectStore('storeName')
572 store.put(value, 'key')
574 PASS test_data !== result is true
575 PASS Object.prototype.toString.call(result) is "[object ImageData]"
576 PASS result.width is test_data.width
577 PASS result.height is test_data.height
578 PASS result.data.length is test_data.data.length
579 PASS result data matches
582 PASS FileReader != null is true
583 test_content = 'This is a test. This is only a test.'
584 test_data = new Blob([test_content])
585 transaction = db.transaction('storeName', 'readwrite')
586 store = transaction.objectStore('storeName')
587 store.put(value, 'key')
589 PASS test_data !== result is true
590 PASS Object.prototype.toString.call(result) is "[object Blob]"
591 PASS result.size is test_data.size
592 PASS result.type is test_data.type
593 PASS text is "This is a test. This is only a test."
596 test_content = fileInput.files[0]
597 transaction = db.transaction('storeName', 'readwrite')
598 store = transaction.objectStore('storeName')
599 store.put(value, 'key')
601 PASS file1 !== file2 is true
602 PASS Object.prototype.toString.call(file1) is "[object File]"
603 PASS Object.prototype.toString.call(file2) is "[object File]"
605 PASS file1.size is file2.size
606 file1.type: text/html
607 PASS file1.type is file2.type
608 file1.name: test-data.html
609 PASS file1.name is file2.name
610 PASS String(file1.lastModifiedDate) is String(file2.lastModifiedDate)
611 PASS text2 is "<!DOCTYPE html>\n<title>This is some test data</title>\n<h1>Test data!</h1>\n<p>Get your test data here!\n"
614 test_content = fileInput.files
615 transaction = db.transaction('storeName', 'readwrite')
616 store = transaction.objectStore('storeName')
617 store.put(value, 'key')
619 PASS test_data !== result is true
620 PASS Object.prototype.toString.call(result) is "[object FileList]"
621 PASS result.length is test_data.length
623 PASS file1 !== file2 is true
624 PASS Object.prototype.toString.call(file1) is "[object File]"
625 PASS Object.prototype.toString.call(file2) is "[object File]"
627 PASS file1.size is file2.size
628 file1.type: text/html
629 PASS file1.type is file2.type
630 file1.name: test-data.html
631 PASS file1.name is file2.name
632 PASS String(file1.lastModifiedDate) is String(file2.lastModifiedDate)
633 PASS text2 is "<!DOCTYPE html>\n<title>This is some test data</title>\n<h1>Test data!</h1>\n<p>Get your test data here!\n"
635 PASS file1 !== file2 is true
636 PASS Object.prototype.toString.call(file1) is "[object File]"
637 PASS Object.prototype.toString.call(file2) is "[object File]"
639 PASS file1.size is file2.size
640 file1.type: text/plain
641 PASS file1.type is file2.type
642 file1.name: test-data.txt
643 PASS file1.name is file2.name
644 PASS String(file1.lastModifiedDate) is String(file2.lastModifiedDate)
645 PASS text2 is "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean laoreet dolor id urna eleifend aliquet. Nulla vel dolor ipsum. Aliquam ut turpis nisl, in vulputate sapien. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed congue magna vitae dolor feugiat vehicula. Sed volutpat, tellus vel varius vestibulum, purus quam mollis sapien, in condimentum leo neque sed nulla. Nunc quis porta elit. Pellentesque erat lectus, ultricies a lobortis id, faucibus id quam.\n"
652 test_data[11] = false
656 transaction = db.transaction('storeName', 'readwrite')
657 store = transaction.objectStore('storeName')
658 store.put(value, 'key')
660 PASS test_data !== result is true
661 PASS test_data.length === result.length is true
662 PASS test_data[0] is result[0]
663 PASS test_data[1] is result[1]
664 PASS test_data[10] is result[10]
665 PASS test_data[11] is result[11]
666 PASS test_data[20] is result[20]
667 PASS test_data[21] is result[21]
668 PASS test_data[30] is result[30]
674 test_data['a'] = true
675 test_data['b'] = false
676 test_data['foo'] = 123
677 test_data['bar'] = 456
679 transaction = db.transaction('storeName', 'readwrite')
680 store = transaction.objectStore('storeName')
681 store.put(value, 'key')
683 PASS test_data !== result is true
684 PASS arrayCompare(Object.keys(result).sort(), Object.keys(test_data).sort()) is true
685 PASS test_data["0"] is result["0"]
686 PASS test_data["1"] is result["1"]
687 PASS test_data["a"] is result["a"]
688 PASS test_data["b"] is result["b"]
689 PASS test_data["foo"] is result["foo"]
690 PASS test_data["bar"] is result["bar"]
691 PASS test_data[""] is result[""]
694 value = new Uint8Array([])
695 transaction = db.transaction('storeName', 'readwrite')
696 store = transaction.objectStore('storeName')
697 store.put(value, 'key')
699 PASS test_data !== result is true
700 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
701 PASS test_data.length === result.length is true
703 value = new Uint8Array([0, 1, 254, 255])
704 transaction = db.transaction('storeName', 'readwrite')
705 store = transaction.objectStore('storeName')
706 store.put(value, 'key')
708 PASS test_data !== result is true
709 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
710 PASS test_data.length === result.length is true
711 PASS is(test_data[0], result[0]) is true
712 PASS is(test_data[1], result[1]) is true
713 PASS is(test_data[2], result[2]) is true
714 PASS is(test_data[3], result[3]) is true
716 value = new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
717 transaction = db.transaction('storeName', 'readwrite')
718 store = transaction.objectStore('storeName')
719 store.put(value, 'key')
721 PASS test_data !== result is true
722 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
723 PASS test_data.length === result.length is true
724 PASS is(test_data[0], result[0]) is true
725 PASS is(test_data[1], result[1]) is true
726 PASS is(test_data[2], result[2]) is true
727 PASS is(test_data[3], result[3]) is true
729 value = new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
730 transaction = db.transaction('storeName', 'readwrite')
731 store = transaction.objectStore('storeName')
732 store.put(value, 'key')
734 PASS test_data !== result is true
735 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
736 PASS test_data.length === result.length is true
737 PASS is(test_data[0], result[0]) is true
738 PASS is(test_data[1], result[1]) is true
739 PASS is(test_data[2], result[2]) is true
740 PASS is(test_data[3], result[3]) is true
742 value = new Int8Array([0, 1, 254, 255])
743 transaction = db.transaction('storeName', 'readwrite')
744 store = transaction.objectStore('storeName')
745 store.put(value, 'key')
747 PASS test_data !== result is true
748 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
749 PASS test_data.length === result.length is true
750 PASS is(test_data[0], result[0]) is true
751 PASS is(test_data[1], result[1]) is true
752 PASS is(test_data[2], result[2]) is true
753 PASS is(test_data[3], result[3]) is true
755 value = new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
756 transaction = db.transaction('storeName', 'readwrite')
757 store = transaction.objectStore('storeName')
758 store.put(value, 'key')
760 PASS test_data !== result is true
761 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
762 PASS test_data.length === result.length is true
763 PASS is(test_data[0], result[0]) is true
764 PASS is(test_data[1], result[1]) is true
765 PASS is(test_data[2], result[2]) is true
766 PASS is(test_data[3], result[3]) is true
768 value = new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
769 transaction = db.transaction('storeName', 'readwrite')
770 store = transaction.objectStore('storeName')
771 store.put(value, 'key')
773 PASS test_data !== result is true
774 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
775 PASS test_data.length === result.length is true
776 PASS is(test_data[0], result[0]) is true
777 PASS is(test_data[1], result[1]) is true
778 PASS is(test_data[2], result[2]) is true
779 PASS is(test_data[3], result[3]) is true
781 value = new Uint8ClampedArray([0, 1, 254, 255])
782 transaction = db.transaction('storeName', 'readwrite')
783 store = transaction.objectStore('storeName')
784 store.put(value, 'key')
786 PASS test_data !== result is true
787 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
788 PASS test_data.length === result.length is true
789 PASS is(test_data[0], result[0]) is true
790 PASS is(test_data[1], result[1]) is true
791 PASS is(test_data[2], result[2]) is true
792 PASS is(test_data[3], result[3]) is true
794 value = new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])
795 transaction = db.transaction('storeName', 'readwrite')
796 store = transaction.objectStore('storeName')
797 store.put(value, 'key')
799 PASS test_data !== result is true
800 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
801 PASS test_data.length === result.length is true
802 PASS is(test_data[0], result[0]) is true
803 PASS is(test_data[1], result[1]) is true
804 PASS is(test_data[2], result[2]) is true
805 PASS is(test_data[3], result[3]) is true
806 PASS is(test_data[4], result[4]) is true
807 PASS is(test_data[5], result[5]) is true
808 PASS is(test_data[6], result[6]) is true
809 PASS is(test_data[7], result[7]) is true
810 PASS is(test_data[8], result[8]) is true
811 PASS is(test_data[9], result[9]) is true
813 value = new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])
814 transaction = db.transaction('storeName', 'readwrite')
815 store = transaction.objectStore('storeName')
816 store.put(value, 'key')
818 PASS test_data !== result is true
819 PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
820 PASS test_data.length === result.length is true
821 PASS is(test_data[0], result[0]) is true
822 PASS is(test_data[1], result[1]) is true
823 PASS is(test_data[2], result[2]) is true
824 PASS is(test_data[3], result[3]) is true
825 PASS is(test_data[4], result[4]) is true
826 PASS is(test_data[5], result[5]) is true
827 PASS is(test_data[6], result[6]) is true
828 PASS is(test_data[7], result[7]) is true
832 Test types that can't be cloned:
834 transaction = db.transaction('storeName', 'readwrite')
835 store = transaction.objectStore('storeName')
837 Other JavaScript object types:
838 Expecting exception from store.put(new Error, 'key')
839 PASS Exception was thrown.
840 PASS code is DOMException.DATA_CLONE_ERR
841 Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
842 Expecting exception from store.put(new Function, 'key')
843 PASS Exception was thrown.
844 PASS code is DOMException.DATA_CLONE_ERR
845 Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
847 Other host object types:
848 Expecting exception from store.put(self, 'key')
849 PASS Exception was thrown.
850 PASS code is DOMException.DATA_CLONE_ERR
851 Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
852 Expecting exception from store.put(document, 'key')
853 PASS Exception was thrown.
854 PASS code is DOMException.DATA_CLONE_ERR
855 Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
856 Expecting exception from store.put(document.body, 'key')
857 PASS Exception was thrown.
858 PASS code is DOMException.DATA_CLONE_ERR
859 Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
860 PASS successfullyParsed is true