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