From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/IndexedDB/META.yml | 5 + testing/web-platform/tests/IndexedDB/README.md | 8 + .../IndexedDB/abort-in-initial-upgradeneeded.html | 35 ++ .../back-forward-cache-open-connection.window.js | 31 ++ .../web-platform/tests/IndexedDB/bigint_value.htm | 72 +++ .../bindings-inject-keys-bypass-setters.html | 35 ++ .../bindings-inject-values-bypass-chain.html | 35 ++ .../bindings-inject-values-bypass-setters.html | 36 ++ .../IndexedDB/blob-composite-blob-reads.any.js | 155 ++++++ .../tests/IndexedDB/blob-contenttype.any.js | 39 ++ .../IndexedDB/blob-delete-objectstore-db.any.js | 47 ++ .../IndexedDB/blob-valid-after-deletion.any.js | 53 ++ .../IndexedDB/blob-valid-before-commit.any.js | 41 ++ .../tests/IndexedDB/clone-before-keypath-eval.html | 135 +++++ .../tests/IndexedDB/close-in-upgradeneeded.html | 40 ++ .../tests/IndexedDB/cursor-overloads.htm | 88 +++ .../tests/IndexedDB/database-names-by-origin.html | 144 +++++ .../tests/IndexedDB/delete-range.any.js | 44 ++ .../tests/IndexedDB/delete-request-queue.html | 27 + .../tests/IndexedDB/error-attributes.html | 38 ++ .../IndexedDB/event-dispatch-active-flag.html | 154 ++++++ .../tests/IndexedDB/file_support.sub.html | 61 +++ .../IndexedDB/fire-error-event-exception.html | 181 +++++++ .../IndexedDB/fire-success-event-exception.html | 79 +++ .../fire-upgradeneeded-event-exception.html | 82 +++ .../tests/IndexedDB/get-databases.any.js | 119 ++++ .../globalscope-indexedDB-SameObject.html | 15 + .../web-platform/tests/IndexedDB/historical.html | 80 +++ .../tests/IndexedDB/idb-binary-key-detached.htm | 52 ++ .../tests/IndexedDB/idb-binary-key-roundtrip.htm | 116 ++++ .../IndexedDB/idb-explicit-commit-throw.any.js | 37 ++ .../tests/IndexedDB/idb-explicit-commit.any.js | 288 ++++++++++ .../idb-partitioned-basic.tentative.sub.html | 55 ++ .../idb-partitioned-coverage.tentative.sub.html | 12 + .../idb-partitioned-persistence.tentative.sub.html | 63 +++ .../tests/IndexedDB/idb_binary_key_conversion.htm | 79 +++ .../tests/IndexedDB/idb_webworkers.htm | 31 ++ .../IndexedDB/idbcursor-advance-continue-async.htm | 181 +++++++ .../idbcursor-advance-exception-order.html | 91 ++++ .../tests/IndexedDB/idbcursor-advance-invalid.htm | 192 +++++++ .../tests/IndexedDB/idbcursor-advance.htm | 247 +++++++++ .../idbcursor-continue-exception-order.htm | 81 +++ .../tests/IndexedDB/idbcursor-continue.htm | 248 +++++++++ ...dbcursor-continuePrimaryKey-exception-order.htm | 380 +++++++++++++ .../idbcursor-continuePrimaryKey-exceptions.htm | 107 ++++ .../IndexedDB/idbcursor-continuePrimaryKey.htm | 134 +++++ .../IndexedDB/idbcursor-delete-exception-order.htm | 76 +++ .../idbcursor-direction-index-keyrange.htm | 60 ++ .../tests/IndexedDB/idbcursor-direction-index.htm | 57 ++ .../idbcursor-direction-objectstore-keyrange.htm | 54 ++ .../IndexedDB/idbcursor-direction-objectstore.htm | 56 ++ .../tests/IndexedDB/idbcursor-direction.htm | 76 +++ .../tests/IndexedDB/idbcursor-iterating-update.htm | 58 ++ .../web-platform/tests/IndexedDB/idbcursor-key.htm | 57 ++ .../tests/IndexedDB/idbcursor-primarykey.htm | 61 +++ .../tests/IndexedDB/idbcursor-request-source.html | 31 ++ .../tests/IndexedDB/idbcursor-request.any.js | 41 ++ .../tests/IndexedDB/idbcursor-reused.htm | 69 +++ .../tests/IndexedDB/idbcursor-source.htm | 66 +++ .../IndexedDB/idbcursor-update-exception-order.htm | 98 ++++ .../tests/IndexedDB/idbcursor_advance_index.htm | 57 ++ .../tests/IndexedDB/idbcursor_advance_index2.htm | 47 ++ .../tests/IndexedDB/idbcursor_advance_index3.htm | 47 ++ .../tests/IndexedDB/idbcursor_advance_index5.htm | 55 ++ .../tests/IndexedDB/idbcursor_advance_index6.htm | 37 ++ .../tests/IndexedDB/idbcursor_advance_index7.htm | 39 ++ .../tests/IndexedDB/idbcursor_advance_index8.htm | 38 ++ .../tests/IndexedDB/idbcursor_advance_index9.htm | 37 ++ .../IndexedDB/idbcursor_advance_objectstore.htm | 54 ++ .../IndexedDB/idbcursor_advance_objectstore2.htm | 40 ++ .../IndexedDB/idbcursor_advance_objectstore3.htm | 42 ++ .../IndexedDB/idbcursor_advance_objectstore4.htm | 41 ++ .../IndexedDB/idbcursor_advance_objectstore5.htm | 36 ++ .../idbcursor_continue_delete_objectstore.htm | 114 ++++ .../tests/IndexedDB/idbcursor_continue_index.htm | 52 ++ .../tests/IndexedDB/idbcursor_continue_index2.htm | 49 ++ .../tests/IndexedDB/idbcursor_continue_index3.htm | 54 ++ .../tests/IndexedDB/idbcursor_continue_index4.htm | 65 +++ .../tests/IndexedDB/idbcursor_continue_index5.htm | 64 +++ .../tests/IndexedDB/idbcursor_continue_index6.htm | 64 +++ .../tests/IndexedDB/idbcursor_continue_index7.htm | 38 ++ .../tests/IndexedDB/idbcursor_continue_index8.htm | 38 ++ .../tests/IndexedDB/idbcursor_continue_invalid.htm | 54 ++ .../IndexedDB/idbcursor_continue_objectstore.htm | 46 ++ .../IndexedDB/idbcursor_continue_objectstore2.htm | 40 ++ .../IndexedDB/idbcursor_continue_objectstore3.htm | 40 ++ .../IndexedDB/idbcursor_continue_objectstore4.htm | 57 ++ .../IndexedDB/idbcursor_continue_objectstore5.htm | 42 ++ .../IndexedDB/idbcursor_continue_objectstore6.htm | 37 ++ .../tests/IndexedDB/idbcursor_delete_index.htm | 69 +++ .../tests/IndexedDB/idbcursor_delete_index2.htm | 42 ++ .../tests/IndexedDB/idbcursor_delete_index3.htm | 40 ++ .../tests/IndexedDB/idbcursor_delete_index4.htm | 38 ++ .../tests/IndexedDB/idbcursor_delete_index5.htm | 39 ++ .../IndexedDB/idbcursor_delete_objectstore.htm | 65 +++ .../IndexedDB/idbcursor_delete_objectstore2.htm | 40 ++ .../IndexedDB/idbcursor_delete_objectstore3.htm | 39 ++ .../IndexedDB/idbcursor_delete_objectstore4.htm | 37 ++ .../IndexedDB/idbcursor_delete_objectstore5.htm | 41 ++ .../tests/IndexedDB/idbcursor_iterating.htm | 109 ++++ .../tests/IndexedDB/idbcursor_iterating_index.htm | 53 ++ .../tests/IndexedDB/idbcursor_iterating_index2.htm | 53 ++ .../IndexedDB/idbcursor_iterating_objectstore.htm | 50 ++ .../IndexedDB/idbcursor_iterating_objectstore2.htm | 50 ++ .../tests/IndexedDB/idbcursor_update_index.htm | 64 +++ .../tests/IndexedDB/idbcursor_update_index2.htm | 40 ++ .../tests/IndexedDB/idbcursor_update_index3.htm | 41 ++ .../tests/IndexedDB/idbcursor_update_index4.htm | 39 ++ .../tests/IndexedDB/idbcursor_update_index5.htm | 45 ++ .../tests/IndexedDB/idbcursor_update_index6.htm | 41 ++ .../tests/IndexedDB/idbcursor_update_index7.htm | 41 ++ .../tests/IndexedDB/idbcursor_update_index8.htm | 45 ++ .../tests/IndexedDB/idbcursor_update_index9.any.js | 43 ++ .../IndexedDB/idbcursor_update_objectstore.htm | 60 ++ .../IndexedDB/idbcursor_update_objectstore2.htm | 38 ++ .../IndexedDB/idbcursor_update_objectstore3.htm | 40 ++ .../IndexedDB/idbcursor_update_objectstore4.htm | 39 ++ .../IndexedDB/idbcursor_update_objectstore5.htm | 41 ++ .../IndexedDB/idbcursor_update_objectstore6.htm | 43 ++ .../IndexedDB/idbcursor_update_objectstore7.htm | 39 ++ .../IndexedDB/idbcursor_update_objectstore8.htm | 39 ++ .../IndexedDB/idbcursor_update_objectstore9.htm | 45 ++ ...bdatabase-createObjectStore-exception-order.htm | 84 +++ ...bdatabase-deleteObjectStore-exception-order.htm | 45 ++ .../idbdatabase-transaction-exception-order.html | 68 +++ .../tests/IndexedDB/idbdatabase_close.htm | 44 ++ .../tests/IndexedDB/idbdatabase_close2.htm | 39 ++ ...ase_createObjectStore-createIndex-emptyname.htm | 45 ++ .../IndexedDB/idbdatabase_createObjectStore.htm | 29 + .../idbdatabase_createObjectStore10-1000ends.htm | 37 ++ .../idbdatabase_createObjectStore10-emptyname.htm | 38 ++ .../IndexedDB/idbdatabase_createObjectStore11.htm | 25 + .../IndexedDB/idbdatabase_createObjectStore2.htm | 33 ++ .../IndexedDB/idbdatabase_createObjectStore3.htm | 24 + .../IndexedDB/idbdatabase_createObjectStore4.htm | 27 + .../IndexedDB/idbdatabase_createObjectStore5.htm | 33 ++ .../IndexedDB/idbdatabase_createObjectStore6.htm | 30 + .../IndexedDB/idbdatabase_createObjectStore7.htm | 25 + .../idbdatabase_createObjectStore8-parameters.htm | 39 ++ ...tabase_createObjectStore9-invalidparameters.htm | 29 + .../IndexedDB/idbdatabase_deleteObjectStore.htm | 25 + .../IndexedDB/idbdatabase_deleteObjectStore2.htm | 31 ++ .../IndexedDB/idbdatabase_deleteObjectStore3.htm | 23 + .../idbdatabase_deleteObjectStore4-not_reused.htm | 42 ++ .../tests/IndexedDB/idbdatabase_transaction.htm | 24 + .../tests/IndexedDB/idbdatabase_transaction2.htm | 27 + .../tests/IndexedDB/idbdatabase_transaction3.htm | 28 + .../tests/IndexedDB/idbdatabase_transaction4.htm | 26 + .../tests/IndexedDB/idbdatabase_transaction5.htm | 22 + .../idbfactory-databases-opaque-origin.html | 97 ++++ .../idbfactory-deleteDatabase-opaque-origin.html | 101 ++++ .../idbfactory-deleteDatabase-request-success.html | 28 + .../idbfactory-open-error-properties.html | 28 + .../IndexedDB/idbfactory-open-opaque-origin.html | 105 ++++ .../IndexedDB/idbfactory-open-request-error.html | 66 +++ .../IndexedDB/idbfactory-open-request-success.html | 54 ++ .../IndexedDB/idbfactory-origin-isolation.html | 41 ++ .../tests/IndexedDB/idbfactory_cmp.htm | 21 + .../tests/IndexedDB/idbfactory_cmp2.htm | 41 ++ .../tests/IndexedDB/idbfactory_cmp3.htm | 27 + .../tests/IndexedDB/idbfactory_cmp4.htm | 40 ++ .../tests/IndexedDB/idbfactory_deleteDatabase.htm | 25 + .../tests/IndexedDB/idbfactory_deleteDatabase2.htm | 27 + .../tests/IndexedDB/idbfactory_deleteDatabase3.htm | 33 ++ .../tests/IndexedDB/idbfactory_deleteDatabase4.htm | 62 +++ .../tests/IndexedDB/idbfactory_open.htm | 18 + .../tests/IndexedDB/idbfactory_open10.htm | 93 ++++ .../tests/IndexedDB/idbfactory_open11.htm | 62 +++ .../tests/IndexedDB/idbfactory_open12.htm | 50 ++ .../tests/IndexedDB/idbfactory_open2.htm | 21 + .../tests/IndexedDB/idbfactory_open3.htm | 28 + .../tests/IndexedDB/idbfactory_open4.htm | 20 + .../tests/IndexedDB/idbfactory_open5.htm | 18 + .../tests/IndexedDB/idbfactory_open6.htm | 36 ++ .../tests/IndexedDB/idbfactory_open7.htm | 41 ++ .../tests/IndexedDB/idbfactory_open8.htm | 27 + .../tests/IndexedDB/idbfactory_open9.htm | 71 +++ .../IndexedDB/idbindex-cross-realm-methods.html | 99 ++++ .../IndexedDB/idbindex-getAll-enforcerange.html | 27 + .../idbindex-getAllKeys-enforcerange.html | 27 + .../IndexedDB/idbindex-multientry-arraykeypath.htm | 23 + .../tests/IndexedDB/idbindex-multientry-big.htm | 59 ++ .../tests/IndexedDB/idbindex-multientry.htm | 53 ++ .../IndexedDB/idbindex-objectStore-SameObject.html | 28 + .../IndexedDB/idbindex-query-exception-order.html | 67 +++ .../tests/IndexedDB/idbindex-rename-abort.html | 110 ++++ .../tests/IndexedDB/idbindex-rename-errors.html | 132 +++++ .../tests/IndexedDB/idbindex-rename.html | 301 +++++++++++ .../tests/IndexedDB/idbindex-request-source.html | 34 ++ .../idbindex_batchGetAll.tentative.any.js | 185 +++++++ .../tests/IndexedDB/idbindex_count.htm | 37 ++ .../tests/IndexedDB/idbindex_count2.htm | 37 ++ .../tests/IndexedDB/idbindex_count3.htm | 28 + .../tests/IndexedDB/idbindex_count4.htm | 37 ++ .../web-platform/tests/IndexedDB/idbindex_get.htm | 36 ++ .../web-platform/tests/IndexedDB/idbindex_get2.htm | 39 ++ .../web-platform/tests/IndexedDB/idbindex_get3.htm | 27 + .../web-platform/tests/IndexedDB/idbindex_get4.htm | 39 ++ .../web-platform/tests/IndexedDB/idbindex_get5.htm | 26 + .../web-platform/tests/IndexedDB/idbindex_get6.htm | 29 + .../web-platform/tests/IndexedDB/idbindex_get7.htm | 32 ++ .../web-platform/tests/IndexedDB/idbindex_get8.htm | 27 + .../tests/IndexedDB/idbindex_getAll.html | 216 ++++++++ .../tests/IndexedDB/idbindex_getAllKeys.html | 192 +++++++ .../tests/IndexedDB/idbindex_getKey.htm | 38 ++ .../tests/IndexedDB/idbindex_getKey2.htm | 39 ++ .../tests/IndexedDB/idbindex_getKey3.htm | 28 + .../tests/IndexedDB/idbindex_getKey4.htm | 38 ++ .../tests/IndexedDB/idbindex_getKey5.htm | 26 + .../tests/IndexedDB/idbindex_getKey6.htm | 29 + .../tests/IndexedDB/idbindex_getKey7.htm | 32 ++ .../tests/IndexedDB/idbindex_getKey8.htm | 27 + .../tests/IndexedDB/idbindex_indexNames.htm | 34 ++ .../tests/IndexedDB/idbindex_keyPath.any.js | 74 +++ .../tests/IndexedDB/idbindex_openCursor.htm | 29 + .../tests/IndexedDB/idbindex_openCursor2.htm | 32 ++ .../tests/IndexedDB/idbindex_openCursor3.htm | 27 + .../tests/IndexedDB/idbindex_openKeyCursor.htm | 28 + .../tests/IndexedDB/idbindex_openKeyCursor2.htm | 29 + .../tests/IndexedDB/idbindex_openKeyCursor3.htm | 32 ++ .../tests/IndexedDB/idbindex_openKeyCursor4.htm | 27 + .../tests/IndexedDB/idbindex_reverse_cursor.any.js | 60 ++ .../tests/IndexedDB/idbindex_tombstones.any.js | 66 +++ .../tests/IndexedDB/idbkeyrange-includes.htm | 140 +++++ .../web-platform/tests/IndexedDB/idbkeyrange.htm | 94 ++++ .../tests/IndexedDB/idbkeyrange_incorrect.htm | 92 ++++ .../idbobjectstore-add-put-exception-order.html | 74 +++ .../idbobjectstore-clear-exception-order.html | 51 ++ .../idbobjectstore-cross-realm-methods.html | 154 ++++++ .../idbobjectstore-delete-exception-order.html | 69 +++ ...idbobjectstore-deleteIndex-exception-order.html | 68 +++ .../idbobjectstore-getAll-enforcerange.html | 25 + .../idbobjectstore-getAllKeys-enforcerange.html | 25 + .../IndexedDB/idbobjectstore-index-finished.html | 26 + .../idbobjectstore-query-exception-order.html | 65 +++ .../IndexedDB/idbobjectstore-rename-abort.html | 120 ++++ .../IndexedDB/idbobjectstore-rename-errors.html | 121 +++++ .../IndexedDB/idbobjectstore-rename-store.html | 369 +++++++++++++ .../IndexedDB/idbobjectstore-request-source.html | 39 ++ .../idbobjectstore-transaction-SameObject.html | 26 + .../tests/IndexedDB/idbobjectstore_add.htm | 35 ++ .../tests/IndexedDB/idbobjectstore_add10.htm | 29 + .../tests/IndexedDB/idbobjectstore_add11.htm | 29 + .../tests/IndexedDB/idbobjectstore_add12.htm | 29 + .../tests/IndexedDB/idbobjectstore_add13.htm | 29 + .../tests/IndexedDB/idbobjectstore_add14.htm | 32 ++ .../tests/IndexedDB/idbobjectstore_add15.htm | 31 ++ .../tests/IndexedDB/idbobjectstore_add16.htm | 25 + .../tests/IndexedDB/idbobjectstore_add2.htm | 36 ++ .../tests/IndexedDB/idbobjectstore_add3.htm | 39 ++ .../tests/IndexedDB/idbobjectstore_add4.htm | 40 ++ .../tests/IndexedDB/idbobjectstore_add5.htm | 34 ++ .../tests/IndexedDB/idbobjectstore_add6.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_add7.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_add8.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_add9.htm | 27 + .../idbobjectstore_batchGetAll.tentative.any.js | 143 +++++ ...ctstore_batchGetAll_largeValue.tentative.any.js | 118 ++++ .../tests/IndexedDB/idbobjectstore_clear.htm | 41 ++ .../tests/IndexedDB/idbobjectstore_clear2.htm | 43 ++ .../tests/IndexedDB/idbobjectstore_clear3.htm | 36 ++ .../tests/IndexedDB/idbobjectstore_clear4.htm | 25 + .../tests/IndexedDB/idbobjectstore_count.htm | 35 ++ .../tests/IndexedDB/idbobjectstore_count2.htm | 35 ++ .../tests/IndexedDB/idbobjectstore_count3.htm | 31 ++ .../tests/IndexedDB/idbobjectstore_count4.htm | 25 + .../tests/IndexedDB/idbobjectstore_createIndex.htm | 30 + .../IndexedDB/idbobjectstore_createIndex10.htm | 24 + .../IndexedDB/idbobjectstore_createIndex11.htm | 23 + .../IndexedDB/idbobjectstore_createIndex12.htm | 31 ++ .../IndexedDB/idbobjectstore_createIndex13.htm | 31 ++ ...dbobjectstore_createIndex14-exception_order.htm | 89 +++ .../idbobjectstore_createIndex15-autoincrement.htm | 106 ++++ .../IndexedDB/idbobjectstore_createIndex2.htm | 41 ++ ...bobjectstore_createIndex3-usable-right-away.htm | 38 ++ ...tstore_createIndex4-deleteIndex-event_order.htm | 66 +++ .../idbobjectstore_createIndex5-emptykeypath.htm | 38 ++ .../idbobjectstore_createIndex6-event_order.htm | 75 +++ .../idbobjectstore_createIndex7-event_order.htm | 80 +++ .../idbobjectstore_createIndex8-valid_keys.htm | 54 ++ .../idbobjectstore_createIndex9-emptyname.htm | 41 ++ .../tests/IndexedDB/idbobjectstore_delete.htm | 46 ++ .../tests/IndexedDB/idbobjectstore_delete2.htm | 27 + .../tests/IndexedDB/idbobjectstore_delete3.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_delete4.htm | 48 ++ .../tests/IndexedDB/idbobjectstore_delete5.htm | 32 ++ .../tests/IndexedDB/idbobjectstore_delete6.htm | 36 ++ .../tests/IndexedDB/idbobjectstore_delete7.htm | 27 + .../tests/IndexedDB/idbobjectstore_deleteIndex.htm | 44 ++ .../tests/IndexedDB/idbobjectstore_deleted.htm | 50 ++ .../tests/IndexedDB/idbobjectstore_get.any.js | 28 + .../tests/IndexedDB/idbobjectstore_get2.any.js | 28 + .../tests/IndexedDB/idbobjectstore_get3.any.js | 28 + .../tests/IndexedDB/idbobjectstore_get4.any.js | 19 + .../tests/IndexedDB/idbobjectstore_get5.any.js | 29 + .../tests/IndexedDB/idbobjectstore_get6.any.js | 24 + .../tests/IndexedDB/idbobjectstore_get7.any.js | 23 + .../tests/IndexedDB/idbobjectstore_getAll.any.js | 148 +++++ .../IndexedDB/idbobjectstore_getAllKeys.any.js | 148 +++++ .../tests/IndexedDB/idbobjectstore_getKey.any.js | 89 +++ .../tests/IndexedDB/idbobjectstore_index.htm | 31 ++ .../tests/IndexedDB/idbobjectstore_keyPath.any.js | 27 + .../tests/IndexedDB/idbobjectstore_openCursor.htm | 42 ++ .../idbobjectstore_openCursor_invalid.htm | 33 ++ .../IndexedDB/idbobjectstore_openKeyCursor.htm | 133 +++++ .../tests/IndexedDB/idbobjectstore_put.htm | 35 ++ .../tests/IndexedDB/idbobjectstore_put10.htm | 29 + .../tests/IndexedDB/idbobjectstore_put11.htm | 29 + .../tests/IndexedDB/idbobjectstore_put12.htm | 29 + .../tests/IndexedDB/idbobjectstore_put13.htm | 29 + .../tests/IndexedDB/idbobjectstore_put14.htm | 32 ++ .../tests/IndexedDB/idbobjectstore_put15.htm | 31 ++ .../tests/IndexedDB/idbobjectstore_put16.htm | 25 + .../tests/IndexedDB/idbobjectstore_put2.htm | 36 ++ .../tests/IndexedDB/idbobjectstore_put3.htm | 48 ++ .../tests/IndexedDB/idbobjectstore_put4.htm | 40 ++ .../tests/IndexedDB/idbobjectstore_put5.htm | 34 ++ .../tests/IndexedDB/idbobjectstore_put6.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_put7.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_put8.htm | 47 ++ .../tests/IndexedDB/idbobjectstore_put9.htm | 27 + .../tests/IndexedDB/idbrequest-onupgradeneeded.htm | 146 +++++ .../tests/IndexedDB/idbrequest_error.html | 25 + .../tests/IndexedDB/idbrequest_result.html | 25 + .../IndexedDB/idbtransaction-db-SameObject.html | 24 + ...idbtransaction-objectStore-exception-order.html | 26 + .../idbtransaction-objectStore-finished.html | 24 + .../tests/IndexedDB/idbtransaction-oncomplete.htm | 53 ++ .../tests/IndexedDB/idbtransaction.htm | 63 +++ .../tests/IndexedDB/idbtransaction_abort.htm | 41 ++ .../IndexedDB/idbtransaction_objectStoreNames.html | 165 ++++++ .../tests/IndexedDB/idbversionchangeevent.htm | 87 +++ .../web-platform/tests/IndexedDB/idlharness.any.js | 25 + .../tests/IndexedDB/index_sort_order.htm | 51 ++ .../tests/IndexedDB/interleaved-cursors-large.html | 12 + .../tests/IndexedDB/interleaved-cursors-small.html | 14 + .../tests/IndexedDB/key-conversion-exceptions.htm | 199 +++++++ .../web-platform/tests/IndexedDB/key_invalid.htm | 131 +++++ .../web-platform/tests/IndexedDB/key_valid.html | 75 +++ .../IndexedDB/keygenerator-constrainterror.htm | 73 +++ .../tests/IndexedDB/keygenerator-explicit.html | 146 +++++ .../tests/IndexedDB/keygenerator-inject.html | 119 ++++ .../tests/IndexedDB/keygenerator-overflow.htm | 70 +++ .../web-platform/tests/IndexedDB/keygenerator.htm | 65 +++ testing/web-platform/tests/IndexedDB/keyorder.htm | 175 ++++++ .../tests/IndexedDB/keypath-exceptions.htm | 281 ++++++++++ .../IndexedDB/keypath-special-identifiers.htm | 66 +++ testing/web-platform/tests/IndexedDB/keypath.htm | 150 +++++ .../tests/IndexedDB/keypath_invalid.htm | 65 +++ .../tests/IndexedDB/keypath_maxsize.htm | 63 +++ .../tests/IndexedDB/large-requests-abort.html | 244 +++++++++ .../web-platform/tests/IndexedDB/list_ordering.htm | 61 +++ .../web-platform/tests/IndexedDB/name-scopes.html | 134 +++++ .../IndexedDB/nested-cloning-large-multiple.html | 54 ++ .../tests/IndexedDB/nested-cloning-large.html | 49 ++ .../tests/IndexedDB/nested-cloning-small.html | 47 ++ .../tests/IndexedDB/objectstore_keyorder.htm | 49 ++ .../tests/IndexedDB/open-request-queue.html | 63 +++ .../tests/IndexedDB/parallel-cursors-upgrade.html | 52 ++ .../reading-autoincrement-indexes-cursors.any.js | 88 +++ .../IndexedDB/reading-autoincrement-indexes.any.js | 108 ++++ .../reading-autoincrement-store-cursors.any.js | 38 ++ .../IndexedDB/reading-autoincrement-store.any.js | 49 ++ .../ready-state-destroyed-execution-context.html | 27 + .../tests/IndexedDB/request-abort-ordering.html | 83 +++ .../tests/IndexedDB/request-event-ordering.html | 369 +++++++++++++ .../tests/IndexedDB/request_bubble-and-capture.htm | 69 +++ .../resources/cross-origin-helper-frame.html | 37 ++ .../tests/IndexedDB/resources/file_to_save.txt | 1 + .../idb-partitioned-basic-iframe.tentative.html | 80 +++ .../idb-partitioned-coverage-iframe.tentative.html | 601 +++++++++++++++++++++ ...b-partitioned-persistence-iframe.tentative.html | 76 +++ .../idbfactory-origin-isolation-iframe.html | 50 ++ .../tests/IndexedDB/resources/idbworker.js | 34 ++ .../resources/interleaved-cursors-common.js | 188 +++++++ .../IndexedDB/resources/nested-cloning-common.js | 211 ++++++++ .../resources/reading-autoincrement-common.js | 93 ++++ .../tests/IndexedDB/resources/support-promises.js | 355 ++++++++++++ .../tests/IndexedDB/resources/support.js | 225 ++++++++ .../serialize-sharedarraybuffer-throws.https.html | 28 + ...ize-sharedarraybuffer-throws.https.html.headers | 2 + .../tests/IndexedDB/storage-buckets.https.any.js | 89 +++ .../tests/IndexedDB/string-list-ordering.htm | 85 +++ .../structured-clone-transaction-state.any.js | 96 ++++ .../tests/IndexedDB/structured-clone.any.js | 324 +++++++++++ .../transaction-abort-generator-revert.html | 110 ++++ .../transaction-abort-index-metadata-revert.html | 278 ++++++++++ ...transaction-abort-multiple-metadata-revert.html | 293 ++++++++++ ...saction-abort-object-store-metadata-revert.html | 235 ++++++++ .../IndexedDB/transaction-abort-request-error.html | 68 +++ .../transaction-create_in_versionchange.htm | 82 +++ .../IndexedDB/transaction-deactivation-timing.html | 143 +++++ .../IndexedDB/transaction-lifetime-blocked.htm | 111 ++++ .../IndexedDB/transaction-lifetime-empty.html | 89 +++ .../tests/IndexedDB/transaction-lifetime.htm | 104 ++++ ...transaction-relaxed-durability.tentative.any.js | 53 ++ .../tests/IndexedDB/transaction-requestqueue.htm | 89 +++ ...ransaction-scheduling-across-connections.any.js | 72 +++ .../transaction-scheduling-across-databases.any.js | 72 +++ .../transaction-scheduling-mixed-scopes.any.js | 63 +++ .../transaction-scheduling-ordering.any.js | 40 ++ .../transaction-scheduling-ro-waits-for-rw.any.js | 26 + .../transaction-scheduling-rw-scopes.any.js | 63 +++ .../transaction-scheduling-within-database.any.js | 55 ++ .../IndexedDB/transaction_bubble-and-capture.htm | 75 +++ .../upgrade-transaction-deactivation-timing.html | 48 ++ ...rade-transaction-lifecycle-backend-aborted.html | 84 +++ .../upgrade-transaction-lifecycle-committed.html | 80 +++ ...upgrade-transaction-lifecycle-user-aborted.html | 143 +++++ testing/web-platform/tests/IndexedDB/value.htm | 40 ++ .../tests/IndexedDB/value_recursive.htm | 66 +++ .../tests/IndexedDB/writer-starvation.htm | 105 ++++ 412 files changed, 27440 insertions(+) create mode 100644 testing/web-platform/tests/IndexedDB/META.yml create mode 100644 testing/web-platform/tests/IndexedDB/README.md create mode 100644 testing/web-platform/tests/IndexedDB/abort-in-initial-upgradeneeded.html create mode 100644 testing/web-platform/tests/IndexedDB/back-forward-cache-open-connection.window.js create mode 100644 testing/web-platform/tests/IndexedDB/bigint_value.htm create mode 100644 testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html create mode 100644 testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-chain.html create mode 100644 testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-setters.html create mode 100644 testing/web-platform/tests/IndexedDB/blob-composite-blob-reads.any.js create mode 100644 testing/web-platform/tests/IndexedDB/blob-contenttype.any.js create mode 100644 testing/web-platform/tests/IndexedDB/blob-delete-objectstore-db.any.js create mode 100644 testing/web-platform/tests/IndexedDB/blob-valid-after-deletion.any.js create mode 100644 testing/web-platform/tests/IndexedDB/blob-valid-before-commit.any.js create mode 100644 testing/web-platform/tests/IndexedDB/clone-before-keypath-eval.html create mode 100644 testing/web-platform/tests/IndexedDB/close-in-upgradeneeded.html create mode 100644 testing/web-platform/tests/IndexedDB/cursor-overloads.htm create mode 100644 testing/web-platform/tests/IndexedDB/database-names-by-origin.html create mode 100644 testing/web-platform/tests/IndexedDB/delete-range.any.js create mode 100644 testing/web-platform/tests/IndexedDB/delete-request-queue.html create mode 100644 testing/web-platform/tests/IndexedDB/error-attributes.html create mode 100644 testing/web-platform/tests/IndexedDB/event-dispatch-active-flag.html create mode 100644 testing/web-platform/tests/IndexedDB/file_support.sub.html create mode 100644 testing/web-platform/tests/IndexedDB/fire-error-event-exception.html create mode 100644 testing/web-platform/tests/IndexedDB/fire-success-event-exception.html create mode 100644 testing/web-platform/tests/IndexedDB/fire-upgradeneeded-event-exception.html create mode 100644 testing/web-platform/tests/IndexedDB/get-databases.any.js create mode 100644 testing/web-platform/tests/IndexedDB/globalscope-indexedDB-SameObject.html create mode 100644 testing/web-platform/tests/IndexedDB/historical.html create mode 100644 testing/web-platform/tests/IndexedDB/idb-binary-key-detached.htm create mode 100644 testing/web-platform/tests/IndexedDB/idb-binary-key-roundtrip.htm create mode 100644 testing/web-platform/tests/IndexedDB/idb-explicit-commit-throw.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idb-explicit-commit.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html create mode 100644 testing/web-platform/tests/IndexedDB/idb-partitioned-coverage.tentative.sub.html create mode 100644 testing/web-platform/tests/IndexedDB/idb-partitioned-persistence.tentative.sub.html create mode 100644 testing/web-platform/tests/IndexedDB/idb_binary_key_conversion.htm create mode 100644 testing/web-platform/tests/IndexedDB/idb_webworkers.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-advance-continue-async.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-advance-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-advance-invalid.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-advance.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-continue-exception-order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-continue.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exception-order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exceptions.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-delete-exception-order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-direction-index-keyrange.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-direction-index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore-keyrange.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-direction.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-iterating-update.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-key.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-primarykey.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-request-source.html create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-request.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-reused.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-source.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor-update-exception-order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_index9.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_delete_objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_index8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_invalid.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_index2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_index3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_index4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_index5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_iterating.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_iterating_index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_iterating_index2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_index9.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore9.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase-createObjectStore-exception-order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase-deleteObjectStore-exception-order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase-transaction-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_close.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_close2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore-createIndex-emptyname.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-1000ends.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-emptyname.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore11.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore8-parameters.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore9-invalidparameters.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_transaction.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_transaction2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_transaction3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_transaction4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbdatabase_transaction5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-databases-opaque-origin.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-opaque-origin.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-request-success.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-open-error-properties.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-open-opaque-origin.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-open-request-error.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-open-request-success.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory-origin-isolation.html create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_cmp.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_cmp2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_cmp3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_cmp4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open10.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open11.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open12.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbfactory_open9.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-cross-realm-methods.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-getAll-enforcerange.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-getAllKeys-enforcerange.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-multientry-arraykeypath.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-multientry-big.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-multientry.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-objectStore-SameObject.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-query-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-rename-abort.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-rename-errors.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-rename.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex-request-source.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_batchGetAll.tentative.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_count.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_count2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_count3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_count4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_get8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getAll.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_indexNames.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_keyPath.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openCursor.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openCursor2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openCursor3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_reverse_cursor.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbindex_tombstones.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbkeyrange-includes.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbkeyrange.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbkeyrange_incorrect.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-add-put-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-clear-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-cross-realm-methods.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-delete-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-deleteIndex-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-getAll-enforcerange.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-getAllKeys-enforcerange.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-index-finished.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-query-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-rename-abort.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-rename-errors.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-rename-store.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-request-source.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore-transaction-SameObject.html create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll.tentative.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll_largeValue.tentative.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_clear.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_clear2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_clear3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_clear4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_count.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_count2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_count3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_count4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex10.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex11.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex12.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex13.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex15-autoincrement.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex3-usable-right-away.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex4-deleteIndex-event_order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex5-emptykeypath.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex7-event_order.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex8-valid_keys.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex9-emptyname.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get2.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get3.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get4.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get5.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get6.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_get7.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_getAll.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_getAllKeys.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_getKey.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_index.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_keyPath.any.js create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor_invalid.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_openKeyCursor.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbrequest-onupgradeneeded.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbrequest_error.html create mode 100644 testing/web-platform/tests/IndexedDB/idbrequest_result.html create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction-db-SameObject.html create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-exception-order.html create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-finished.html create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction-oncomplete.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction_abort.htm create mode 100644 testing/web-platform/tests/IndexedDB/idbtransaction_objectStoreNames.html create mode 100644 testing/web-platform/tests/IndexedDB/idbversionchangeevent.htm create mode 100644 testing/web-platform/tests/IndexedDB/idlharness.any.js create mode 100644 testing/web-platform/tests/IndexedDB/index_sort_order.htm create mode 100644 testing/web-platform/tests/IndexedDB/interleaved-cursors-large.html create mode 100644 testing/web-platform/tests/IndexedDB/interleaved-cursors-small.html create mode 100644 testing/web-platform/tests/IndexedDB/key-conversion-exceptions.htm create mode 100644 testing/web-platform/tests/IndexedDB/key_invalid.htm create mode 100644 testing/web-platform/tests/IndexedDB/key_valid.html create mode 100644 testing/web-platform/tests/IndexedDB/keygenerator-constrainterror.htm create mode 100644 testing/web-platform/tests/IndexedDB/keygenerator-explicit.html create mode 100644 testing/web-platform/tests/IndexedDB/keygenerator-inject.html create mode 100644 testing/web-platform/tests/IndexedDB/keygenerator-overflow.htm create mode 100644 testing/web-platform/tests/IndexedDB/keygenerator.htm create mode 100644 testing/web-platform/tests/IndexedDB/keyorder.htm create mode 100644 testing/web-platform/tests/IndexedDB/keypath-exceptions.htm create mode 100644 testing/web-platform/tests/IndexedDB/keypath-special-identifiers.htm create mode 100644 testing/web-platform/tests/IndexedDB/keypath.htm create mode 100644 testing/web-platform/tests/IndexedDB/keypath_invalid.htm create mode 100644 testing/web-platform/tests/IndexedDB/keypath_maxsize.htm create mode 100644 testing/web-platform/tests/IndexedDB/large-requests-abort.html create mode 100644 testing/web-platform/tests/IndexedDB/list_ordering.htm create mode 100644 testing/web-platform/tests/IndexedDB/name-scopes.html create mode 100644 testing/web-platform/tests/IndexedDB/nested-cloning-large-multiple.html create mode 100644 testing/web-platform/tests/IndexedDB/nested-cloning-large.html create mode 100644 testing/web-platform/tests/IndexedDB/nested-cloning-small.html create mode 100644 testing/web-platform/tests/IndexedDB/objectstore_keyorder.htm create mode 100644 testing/web-platform/tests/IndexedDB/open-request-queue.html create mode 100644 testing/web-platform/tests/IndexedDB/parallel-cursors-upgrade.html create mode 100644 testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes-cursors.any.js create mode 100644 testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes.any.js create mode 100644 testing/web-platform/tests/IndexedDB/reading-autoincrement-store-cursors.any.js create mode 100644 testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js create mode 100644 testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html create mode 100644 testing/web-platform/tests/IndexedDB/request-abort-ordering.html create mode 100644 testing/web-platform/tests/IndexedDB/request-event-ordering.html create mode 100644 testing/web-platform/tests/IndexedDB/request_bubble-and-capture.htm create mode 100644 testing/web-platform/tests/IndexedDB/resources/cross-origin-helper-frame.html create mode 100644 testing/web-platform/tests/IndexedDB/resources/file_to_save.txt create mode 100644 testing/web-platform/tests/IndexedDB/resources/idb-partitioned-basic-iframe.tentative.html create mode 100644 testing/web-platform/tests/IndexedDB/resources/idb-partitioned-coverage-iframe.tentative.html create mode 100644 testing/web-platform/tests/IndexedDB/resources/idb-partitioned-persistence-iframe.tentative.html create mode 100644 testing/web-platform/tests/IndexedDB/resources/idbfactory-origin-isolation-iframe.html create mode 100644 testing/web-platform/tests/IndexedDB/resources/idbworker.js create mode 100644 testing/web-platform/tests/IndexedDB/resources/interleaved-cursors-common.js create mode 100644 testing/web-platform/tests/IndexedDB/resources/nested-cloning-common.js create mode 100644 testing/web-platform/tests/IndexedDB/resources/reading-autoincrement-common.js create mode 100644 testing/web-platform/tests/IndexedDB/resources/support-promises.js create mode 100644 testing/web-platform/tests/IndexedDB/resources/support.js create mode 100644 testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html create mode 100644 testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html.headers create mode 100644 testing/web-platform/tests/IndexedDB/storage-buckets.https.any.js create mode 100644 testing/web-platform/tests/IndexedDB/string-list-ordering.htm create mode 100644 testing/web-platform/tests/IndexedDB/structured-clone-transaction-state.any.js create mode 100644 testing/web-platform/tests/IndexedDB/structured-clone.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-abort-generator-revert.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-abort-index-metadata-revert.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-abort-multiple-metadata-revert.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-abort-object-store-metadata-revert.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-abort-request-error.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm create mode 100644 testing/web-platform/tests/IndexedDB/transaction-deactivation-timing.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-lifetime-blocked.htm create mode 100644 testing/web-platform/tests/IndexedDB/transaction-lifetime-empty.html create mode 100644 testing/web-platform/tests/IndexedDB/transaction-lifetime.htm create mode 100644 testing/web-platform/tests/IndexedDB/transaction-relaxed-durability.tentative.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-across-connections.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-across-databases.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-mixed-scopes.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-ordering.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-ro-waits-for-rw.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-rw-scopes.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction-scheduling-within-database.any.js create mode 100644 testing/web-platform/tests/IndexedDB/transaction_bubble-and-capture.htm create mode 100644 testing/web-platform/tests/IndexedDB/upgrade-transaction-deactivation-timing.html create mode 100644 testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-backend-aborted.html create mode 100644 testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-committed.html create mode 100644 testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-user-aborted.html create mode 100644 testing/web-platform/tests/IndexedDB/value.htm create mode 100644 testing/web-platform/tests/IndexedDB/value_recursive.htm create mode 100644 testing/web-platform/tests/IndexedDB/writer-starvation.htm (limited to 'testing/web-platform/tests/IndexedDB') diff --git a/testing/web-platform/tests/IndexedDB/META.yml b/testing/web-platform/tests/IndexedDB/META.yml new file mode 100644 index 0000000000..89cbe2be26 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/META.yml @@ -0,0 +1,5 @@ +spec: https://w3c.github.io/IndexedDB/ +suggested_reviewers: + - odinho + - inexorabletash + - zqzhang diff --git a/testing/web-platform/tests/IndexedDB/README.md b/testing/web-platform/tests/IndexedDB/README.md new file mode 100644 index 0000000000..545f0bec6d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/README.md @@ -0,0 +1,8 @@ +This directory contains the Indexed Database API test suite. + +To run the tests in this test suite within a browser, go to: . + +The latest Editor's Draft of Indexed Database API is: . + +The latest W3C Technical Report of Indexed Database API is: . + diff --git a/testing/web-platform/tests/IndexedDB/abort-in-initial-upgradeneeded.html b/testing/web-platform/tests/IndexedDB/abort-in-initial-upgradeneeded.html new file mode 100644 index 0000000000..e37056974f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/abort-in-initial-upgradeneeded.html @@ -0,0 +1,35 @@ + + +Test that an abort in the initial upgradeneeded sets version back to 0 + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/back-forward-cache-open-connection.window.js b/testing/web-platform/tests/IndexedDB/back-forward-cache-open-connection.window.js new file mode 100644 index 0000000000..397eadab87 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/back-forward-cache-open-connection.window.js @@ -0,0 +1,31 @@ +// META: title=Testing BFCache support for page with open IndexedDB connection, and eviction behavior when receiving versionchange event. +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/utils.js +// META: script=resources/support.js +// META: script=/html/browsers/browsing-the-web/back-forward-cache/resources/rc-helper.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js + +'use strict'; + +promise_test(async t => { + const rcHelper = new RemoteContextHelper(); + + // Open a window with noopener so that BFCache will work. + const rc1 = await rcHelper.addWindow( + /*config=*/ null, /*options=*/ {features: 'noopener'}); + + await createIndexedDBForTesting(rc1, 'test_idb', 1); + await assertBFCache(rc1, /*shouldRestoreFromBFCache=*/ true); + + // The page is ensured to be eligible for BFCache even with open connection, + // otherwise the previous assertion will fail with PRECONDITION_FAILED. + // Now we can test if the versionchange event will evict the BFCache. + await createIndexedDBForTesting(rc1, 'test_idb_2', 1); + + const rc2 = await rc1.navigateToNew(); + // Create an IndexedDB database with higher version. + await createIndexedDBForTesting(rc2, 'test_idb_2', 2); + await rc2.historyBack(); + // The previous page receiving versionchange event should be evicted. + await assert_not_bfcached(rc1); +}); diff --git a/testing/web-platform/tests/IndexedDB/bigint_value.htm b/testing/web-platform/tests/IndexedDB/bigint_value.htm new file mode 100644 index 0000000000..acdeebb76f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/bigint_value.htm @@ -0,0 +1,72 @@ + + +IndexedDB: BigInt keys and values + + + + + diff --git a/testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html b/testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html new file mode 100644 index 0000000000..e67377fb77 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html @@ -0,0 +1,35 @@ + + +IndexedDB: ES bindings - Inject a key into a value - Keys bypass setters + + + + + diff --git a/testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-chain.html b/testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-chain.html new file mode 100644 index 0000000000..73505edf1d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-chain.html @@ -0,0 +1,35 @@ + + +IndexedDB: ES bindings - Inject a key into a value - Values bypass chain + + + + + diff --git a/testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-setters.html b/testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-setters.html new file mode 100644 index 0000000000..6c4fb93bfd --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/bindings-inject-values-bypass-setters.html @@ -0,0 +1,36 @@ + + +IndexedDB: ES bindings - Inject a key into a value - Values bypass + setters + + + + + diff --git a/testing/web-platform/tests/IndexedDB/blob-composite-blob-reads.any.js b/testing/web-platform/tests/IndexedDB/blob-composite-blob-reads.any.js new file mode 100644 index 0000000000..7d6ab9be35 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/blob-composite-blob-reads.any.js @@ -0,0 +1,155 @@ +// META: title=IDB-backed composite blobs maintain coherency +// META: script=resources/support-promises.js +// META: timeout=long + +// This test file is intended to help validate browser handling of complex blob +// scenarios where one or more levels of multipart blobs are used and varying +// IPC serialization strategies may be used depending on various complexity +// heuristics. +// +// A variety of approaches of reading the blob's contents are attempted for +// completeness: +// - `fetch-blob-url`: fetch of a URL created via URL.createObjectURL +// - Note that this is likely to involve multi-process behavior in a way that +// the next 2 currently will not unless their Blobs are round-tripped +// through a MessagePort. +// - `file-reader`: FileReader +// - `direct`: Blob.prototype.arrayBuffer() + +function composite_blob_test({ blobCount, blobSize, name }) { + // NOTE: In order to reduce the runtime of this test and due to the similarity + // of the "file-reader" mechanism to the "direct", "file-reader" is commented + // out, but if you are investigating failures detected by this test, you may + // want to uncomment it. + for (const mode of ["fetch-blob-url", /*"file-reader",*/ "direct"]) { + promise_test(async testCase => { + const key = "the-blobs"; + let memBlobs = []; + for (let iBlob = 0; iBlob < blobCount; iBlob++) { + memBlobs.push(new Blob([make_arraybuffer_contents(iBlob, blobSize)])); + } + + const db = await createDatabase(testCase, db => { + db.createObjectStore("blobs"); + }); + + const write_tx = db.transaction("blobs", "readwrite", {durability: "relaxed"}); + let store = write_tx.objectStore("blobs"); + store.put(memBlobs, key); + // Make the blobs eligible for GC which is most realistic and most likely + // to cause problems. + memBlobs = null; + + await promiseForTransaction(testCase, write_tx); + + const read_tx = db.transaction("blobs", "readonly", {durability: "relaxed"}); + store = read_tx.objectStore("blobs"); + const read_req = store.get(key); + + await promiseForTransaction(testCase, read_tx); + + const diskBlobs = read_req.result; + const compositeBlob = new Blob(diskBlobs); + + if (mode === "fetch-blob-url") { + const blobUrl = URL.createObjectURL(compositeBlob); + let urlResp = await fetch(blobUrl); + let urlFetchArrayBuffer = await urlResp.arrayBuffer(); + urlResp = null; + + URL.revokeObjectURL(blobUrl); + validate_arraybuffer_contents("fetched URL", urlFetchArrayBuffer, blobCount, blobSize); + urlFetchArrayBuffer = null; + + } else if (mode === "file-reader") { + let reader = new FileReader(); + let readerPromise = new Promise(resolve => { + reader.onload = () => { + resolve(reader.result); + } + }) + reader.readAsArrayBuffer(compositeBlob); + + let readArrayBuffer = await readerPromise; + readerPromise = null; + reader = null; + + validate_arraybuffer_contents("FileReader", readArrayBuffer, blobCount, blobSize); + readArrayBuffer = null; + } else if (mode === "direct") { + let directArrayBuffer = await compositeBlob.arrayBuffer(); + validate_arraybuffer_contents("arrayBuffer", directArrayBuffer, blobCount, blobSize); + } + }, `Composite Blob Handling: ${name}: ${mode}`); + } +} + +// Create an ArrayBuffer whose even bytes are the index identifier and whose +// odd bytes are a sequence incremented by 3 (wrapping at 256) so that +// discontinuities at power-of-2 boundaries are more detectable. +function make_arraybuffer_contents(index, size) { + const arr = new Uint8Array(size); + for (let i = 0, counter = 0; i < size; i += 2, counter = (counter + 3) % 256) { + arr[i] = index; + arr[i + 1] = counter; + } + return arr.buffer; +} + +function validate_arraybuffer_contents(source, buffer, blobCount, blobSize) { + // Accumulate a list of problems we perceive so we can report what seems to + // have happened all at once. + const problems = []; + + const arr = new Uint8Array(buffer); + + const expectedLength = blobCount * blobSize; + const actualCount = arr.length / blobSize; + if (arr.length !== expectedLength) { + problems.push(`ArrayBuffer only holds ${actualCount} blobs' worth instead of ${blobCount}.`); + problems.push(`Actual ArrayBuffer is ${arr.length} bytes but expected ${expectedLength}`); + } + + const counterBlobStep = (blobSize / 2 * 3) % 256; + let expectedBlob = 0; + let blobSeenSoFar = 0; + let expectedCounter = 0; + let counterDrift = 0; + for (let i = 0; i < arr.length; i += 2) { + if (arr[i] !== expectedBlob || blobSeenSoFar >= blobSize) { + if (blobSeenSoFar !== blobSize) { + problems.push(`Truncated blob ${expectedBlob} after ${blobSeenSoFar} bytes.`); + } else { + expectedBlob++; + } + if (expectedBlob !== arr[i]) { + problems.push(`Expected blob ${expectedBlob} but found ${arr[i]}, compensating.`); + expectedBlob = arr[i]; + } + blobSeenSoFar = 0; + expectedCounter = (expectedBlob * counterBlobStep) % 256; + counterDrift = 0; + } + + if (arr[i + 1] !== (expectedCounter + counterDrift) % 256) { + const newDrift = expectedCounter - arr[i + 1]; + problems.push(`In blob ${expectedBlob} at ${blobSeenSoFar + 1} bytes in, counter drift now ${newDrift} was ${counterDrift}`); + counterDrift = newDrift; + } + + blobSeenSoFar += 2; + expectedCounter = (expectedCounter + 3) % 256; + } + + if (problems.length) { + assert_true(false, `${source} blob payload problem: ${problems.join("\n")}`); + } else { + assert_true(true, `${source} blob payloads validated.`); + } +} + +composite_blob_test({ + blobCount: 16, + blobSize: 256 * 1024, + name: "Many blobs", +}); diff --git a/testing/web-platform/tests/IndexedDB/blob-contenttype.any.js b/testing/web-platform/tests/IndexedDB/blob-contenttype.any.js new file mode 100644 index 0000000000..2d1d6a1ec9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/blob-contenttype.any.js @@ -0,0 +1,39 @@ +// META: title=Blob Content Type +// META: script=resources/support.js +// META: timeout=long + +indexeddb_test( + function upgrade(t, db) { + db.createObjectStore('store'); + }, + function success(t, db) { + var type = 'x-files/trust-no-one'; + + var blob = new Blob(['mulder', 'scully'], {type: type}); + assert_equals(blob.type, type, 'Blob type should match constructor option'); + + var tx = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + tx.objectStore('store').put(blob, 'key'); + + tx.oncomplete = t.step_func(function() { + var tx = db.transaction('store', 'readonly', {durability: 'relaxed'}); + tx.objectStore('store').get('key').onsuccess = t.step_func(function(e) { + var result = e.target.result; + assert_equals(result.type, type, 'Blob type should survive round-trip'); + + var url = URL.createObjectURL(result); + var xhr = new XMLHttpRequest(), async = true; + xhr.open('GET', url, async); + xhr.send(); + xhr.onreadystatechange = t.step_func(function() { + if (xhr.readyState !== XMLHttpRequest.DONE) + return; + assert_equals(xhr.getResponseHeader('Content-Type'), type, + 'Blob type should be preserved when fetched'); + t.done(); + }); + }); + }); + }, + 'Ensure that content type round trips when reading blob data' +); diff --git a/testing/web-platform/tests/IndexedDB/blob-delete-objectstore-db.any.js b/testing/web-platform/tests/IndexedDB/blob-delete-objectstore-db.any.js new file mode 100644 index 0000000000..1750241df4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/blob-delete-objectstore-db.any.js @@ -0,0 +1,47 @@ +// META: title=Blob Delete Object Store +// META: script=resources/support.js + +let key = "blob key"; + +indexeddb_test( + function upgrade(t, db) { + const store0 = db.createObjectStore('store0'); + const store1 = db.createObjectStore('store1'); + + const blobAContent = "First blob content"; + const blobA = new Blob([blobAContent], {"type" : "text/plain"}); + + store0.put(blobA, key); + }, + function success(t, db) { + db.close(); + const request = indexedDB.open(db.name, 2); + + request.onupgradeneeded = t.step_func(function(e) { + const db = e.target.result; + db.deleteObjectStore('store0'); + + request.onsuccess = t.step_func(function() { + const blobBContent = "Second blob content"; + const trans = db.transaction('store1', 'readwrite', {durability: 'relaxed'}); + const store1 = trans.objectStore('store1'); + const blobB = new Blob([blobBContent], {"type" : "text/plain"}); + store1.put(blobB, key); + + trans.oncomplete = t.step_func(function() { + db.close(); + const delete_request = indexedDB.deleteDatabase(db.name); + + // The test passes if it successfully completes. + delete_request.onsuccess = t.step_func_done(); + + delete_request.onerror = t.unreached_func("Request should not fail."); + }); + + trans.onabort = t.unreached_func("Transaction should not be aborted."); + }); + }); + request.onsuccess = t.unreached_func("Request should not succeed without an upgrade."); + request.onerror = t.unreached_func("Request should not fail."); + request.onblocked = t.unreached_func("Request should not be blocked."); + }, "Deleting an object store and a database containing blobs doesn't crash."); diff --git a/testing/web-platform/tests/IndexedDB/blob-valid-after-deletion.any.js b/testing/web-platform/tests/IndexedDB/blob-valid-after-deletion.any.js new file mode 100644 index 0000000000..b44fc4e38c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/blob-valid-after-deletion.any.js @@ -0,0 +1,53 @@ +// META: title=Blob Valid After Deletion +// META: script=resources/support.js + +let key = "key"; + +indexeddb_test( + function upgrade(t, db) { + db.createObjectStore('store'); + }, + function success(t, db) { + const blobAContent = "Blob A content"; + const blobBContent = "Blob B content"; + const blobA = new Blob([blobAContent], {"type" : "text/plain"}); + const blobB = new Blob([blobBContent], {"type" : "text/plain"}); + value = { a0: blobA, a1: blobA, b0: blobB }; + + const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + var store = tx.objectStore('store'); + + store.put(value, key); + value = null; + + const trans = db.transaction('store', 'readonly', {durability: 'relaxed'}); + store = trans.objectStore('store'); + const request = store.get(key); + + request.onsuccess = t.step_func(function() { + const record = request.result; + + trans.oncomplete = t.step_func(function() { + const trans = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + store = trans.objectStore('store'); + const request = store.delete(key); + + trans.oncomplete = t.step_func(function() { + const promise1 = record.a0.text().then(t.step_func(text => { assert_equals(text, blobAContent); }, + t.unreached_func())); + + const promise2 = record.a1.text().then(t.step_func(text => { assert_equals(text, blobAContent); }, + t.unreached_func())); + + const promise3 = record.b0.text().then(t.step_func(text => { assert_equals(text, blobBContent); }, + t.unreached_func())); + + Promise.all([promise1, promise2, promise3]).then(function() { + // The test passes if it successfully completes. + t.done(); + }); + }); + }); + }); + }, + "Blobs stay alive after their records are deleted."); diff --git a/testing/web-platform/tests/IndexedDB/blob-valid-before-commit.any.js b/testing/web-platform/tests/IndexedDB/blob-valid-before-commit.any.js new file mode 100644 index 0000000000..ad8b2a1be2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/blob-valid-before-commit.any.js @@ -0,0 +1,41 @@ +// META: title=Blob Valid Before Commit +// META: script=resources/support.js + +let key = "key"; + +indexeddb_test( + function upgrade(t, db) { + db.createObjectStore('store'); + }, + function success(t, db) { + const blobAContent = "Blob A content"; + const blobBContent = "Blob B content"; + const blobA = new Blob([blobAContent], {"type" : "text/plain"}); + const blobB = new Blob([blobBContent], {"type" : "text/plain"}); + const value = { a0: blobA, a1: blobA, b0: blobB }; + + const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + + store.put(value, key); + const request = store.get(key); + + request.onsuccess = t.step_func(function() { + const record = request.result; + + const promise1 = record.a0.text().then(t.step_func(text => { assert_equals(text, blobAContent); }, + t.unreached_func())); + + const promise2 = record.a1.text().then(t.step_func(text => { assert_equals(text, blobAContent); }, + t.unreached_func())); + + const promise3 = record.b0.text().then(t.step_func(text => { assert_equals(text, blobBContent); }, + t.unreached_func())); + + Promise.all([promise1, promise2, promise3]).then(function() { + // The test passes if it successfully completes. + t.done(); + }); + }); + }, + "Blobs can be read back before their records are committed."); diff --git a/testing/web-platform/tests/IndexedDB/clone-before-keypath-eval.html b/testing/web-platform/tests/IndexedDB/clone-before-keypath-eval.html new file mode 100644 index 0000000000..6ef36f5fe3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/clone-before-keypath-eval.html @@ -0,0 +1,135 @@ + + +IndexedDB: + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/close-in-upgradeneeded.html b/testing/web-platform/tests/IndexedDB/close-in-upgradeneeded.html new file mode 100644 index 0000000000..59adc31a99 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/close-in-upgradeneeded.html @@ -0,0 +1,40 @@ + + +When db.close is called in upgradeneeded, the db is cleaned up on refresh + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/cursor-overloads.htm b/testing/web-platform/tests/IndexedDB/cursor-overloads.htm new file mode 100644 index 0000000000..7beeaa2bb3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/cursor-overloads.htm @@ -0,0 +1,88 @@ + + + + + +Validate the overloads of IDBObjectStore.openCursor(), IDBIndex.openCursor() and IDBIndex.openKeyCursor() + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/database-names-by-origin.html b/testing/web-platform/tests/IndexedDB/database-names-by-origin.html new file mode 100644 index 0000000000..374b05c8fd --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/database-names-by-origin.html @@ -0,0 +1,144 @@ + + + +IndexedDB: origins have isolated namespaces + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/delete-range.any.js b/testing/web-platform/tests/IndexedDB/delete-range.any.js new file mode 100644 index 0000000000..b86d646354 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/delete-range.any.js @@ -0,0 +1,44 @@ +// META: title=Delete range +// META: script=resources/support.js + +"use strict"; + +let entries = [ + { lower: 3, upper: 8, lowerOpen: false, upperOpen: false, expected: [1, 2, 9, 10]}, + { lower: 3, upper: 8, lowerOpen: true, upperOpen: false, expected: [1, 2, 3, 9, 10]}, + { lower: 3, upper: 8, lowerOpen: false, upperOpen: true, expected: [1, 2, 8, 9, 10]}, + { lower: 3, upper: 8, lowerOpen: true, upperOpen: true, expected: [1, 2, 3, 8, 9, 10]} +]; + +for (const entry of entries) { + indexeddb_test( + function upgrade_func(t, db) { + db.createObjectStore("store"); + }, + function open_func(t, db) { + const store = db.transaction("store", "readwrite", {durability: 'relaxed'}).objectStore("store"); + + for (let i = 1; i <= 10; ++i) { + store.put(i, i); + } + store.delete(IDBKeyRange.bound(entry.lower, + entry.upper, + entry.lowerOpen, + entry.upperOpen)); + + let keys = []; + const cursor_request = store.openCursor(); + cursor_request.onsuccess = t.step_func(function () { + const cursor = cursor_request.result; + if (cursor) { + keys.push(cursor.key); + cursor.continue(); + } else { + assert_array_equals(entry.expected, keys, `Expected: ${entry.expected}, got: ${keys}.`); + t.done(); + } + }); + cursor_request.onerror = t.unreached_func("Failed to open cursor for read request."); + } + ) +} diff --git a/testing/web-platform/tests/IndexedDB/delete-request-queue.html b/testing/web-platform/tests/IndexedDB/delete-request-queue.html new file mode 100644 index 0000000000..d8dfbf9a60 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/delete-request-queue.html @@ -0,0 +1,27 @@ + + +IndexedDB: delete requests are processed as a FIFO queue + + + + + diff --git a/testing/web-platform/tests/IndexedDB/error-attributes.html b/testing/web-platform/tests/IndexedDB/error-attributes.html new file mode 100644 index 0000000000..d65bf21790 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/error-attributes.html @@ -0,0 +1,38 @@ + + +IndexedDB: Error attributes are DOMExceptions + + + + + diff --git a/testing/web-platform/tests/IndexedDB/event-dispatch-active-flag.html b/testing/web-platform/tests/IndexedDB/event-dispatch-active-flag.html new file mode 100644 index 0000000000..46f249c984 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/event-dispatch-active-flag.html @@ -0,0 +1,154 @@ + + +Transaction active flag is set during event dispatch + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/file_support.sub.html b/testing/web-platform/tests/IndexedDB/file_support.sub.html new file mode 100644 index 0000000000..fe4bdf13ed --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/file_support.sub.html @@ -0,0 +1,61 @@ + + +File support in IndexedDB + + + + + +
+ +
+ diff --git a/testing/web-platform/tests/IndexedDB/fire-error-event-exception.html b/testing/web-platform/tests/IndexedDB/fire-error-event-exception.html new file mode 100644 index 0000000000..f380e4081f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/fire-error-event-exception.html @@ -0,0 +1,181 @@ + + +Fire error event - Exception thrown + + + + + diff --git a/testing/web-platform/tests/IndexedDB/fire-success-event-exception.html b/testing/web-platform/tests/IndexedDB/fire-success-event-exception.html new file mode 100644 index 0000000000..eaff1b962a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/fire-success-event-exception.html @@ -0,0 +1,79 @@ + + +Fire success event - Exception thrown + + + + + diff --git a/testing/web-platform/tests/IndexedDB/fire-upgradeneeded-event-exception.html b/testing/web-platform/tests/IndexedDB/fire-upgradeneeded-event-exception.html new file mode 100644 index 0000000000..7160dbdfc7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/fire-upgradeneeded-event-exception.html @@ -0,0 +1,82 @@ + + +Fire upgradeneeded event - Exception thrown + + + + + diff --git a/testing/web-platform/tests/IndexedDB/get-databases.any.js b/testing/web-platform/tests/IndexedDB/get-databases.any.js new file mode 100644 index 0000000000..ac1ab15f27 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/get-databases.any.js @@ -0,0 +1,119 @@ +// META: script=resources/support-promises.js + +promise_test(async testCase => { + let result = indexedDB.databases(); + assert_true(result instanceof Promise, + "databases() should return a promise."); + result.catch(() => {}); +}, "Ensure that databases() returns a promise."); + +promise_test(async testCase => { + // Delete any databases that may not have been cleaned up after previous test + // runs. + await deleteAllDatabases(testCase); + + const db_name = "TestDatabase"; + const db = await createNamedDatabase(testCase, db_name, ()=>{}); + const databases_result = await indexedDB.databases(); + db.close(); + const expected_result = {"name": db_name, "version": 1}; + assert_equals( + databases_result.length, + 1, + "The result of databases() should contain one result per database."); + assert_true( + databases_result[0].name === expected_result.name + && databases_result[0].version === expected_result.version, + "The result of databases() should be a sequence of the correct names " + + "and versions of all databases for the origin."); +}, "Enumerate one database."); + +promise_test(async testCase => { + // Delete any databases that may not have been cleaned up after previous test + // runs. + await deleteAllDatabases(testCase); + + const db_name1 = "TestDatabase1"; + const db_name2 = "TestDatabase2"; + const db_name3 = "TestDatabase3"; + const db1 = await createNamedDatabase(testCase, db_name1, ()=>{}); + const db2 = await createNamedDatabase(testCase, db_name2, ()=>{}); + const db3 = await createNamedDatabase(testCase, db_name3, ()=>{}); + db1.close(); + db2.close(); + db3.close(); + const version_promise = + await migrateNamedDatabase(testCase, db_name2, 2, () => {}); + const databases_result = await indexedDB.databases(); + const expected_result = [ + {"name": db_name1, "version": 1}, + {"name": db_name2, "version": 2}, + {"name": db_name3, "version": 1}, + ]; + assert_equals( + databases_result.length, + expected_result.length, + "The result of databases() should contain one result per database."); + for ( let i = 0; i < expected_result.length; i += 1 ) { + result = expected_result[i]; + assert_true( + databases_result.some( + e => e.name === result.name && e.version === result.version), + "The result of databases() should be a sequence of the correct names " + + "and versions of all databases for the origin."); + } +}, "Enumerate multiple databases."); + +promise_test(async testCase => { + // Add some databases and close their connections. + const db1 = await createNamedDatabase(testCase, "DB1", () => {}); + const db2 = await createNamedDatabase(testCase, "DB2", () => {}); + db1.close(); + db2.close(); + + // Delete any databases that may not have been cleaned up after previous test + // runs as well as the two databases made above. + await deleteAllDatabases(testCase); + + // Make sure the databases are no longer returned. + const databases_result = await indexedDB.databases(); + assert_equals( + databases_result.length, + 0, + "The result of databases() should be an empty sequence for the case of " + + "no databases for the origin."); +}, "Make sure an empty list is returned for the case of no databases."); + +promise_test(async testCase => { + // Delete any databases that may not have been cleaned up after previous test + // runs as well as the two databases made above. + await deleteAllDatabases(testCase); + + const db1 = await createNamedDatabase(testCase, "DB1", ()=>{}); + const db2 = await createNamedDatabase(testCase, "DB2", async () => { + const databases_result1 = await indexedDB.databases(); + assert_equals( + databases_result1.length, + 1, + "The result of databases() should be only those databases which have " + + "been created at the time of calling, regardless of versionchange " + + "transactions currently running."); + }); + db1.close(); + db2.close(); + const databases_result2 = await indexedDB.databases(); + assert_equals( + databases_result2.length, + 2, + "The result of databases() should include all databases which have " + + "been created at the time of calling."); + await migrateNamedDatabase(testCase, "DB2", 2, async () => { + const databases_result3 = await indexedDB.databases(); + assert_true( + databases_result3[0].version === 1 + && databases_result3[1].version === 1, + "The result of databases() should contain the versions of databases " + + "at the time of calling, regardless of versionchange transactions " + + "currently running."); + }); +}, "Ensure that databases() doesn't pick up changes that haven't commited."); diff --git a/testing/web-platform/tests/IndexedDB/globalscope-indexedDB-SameObject.html b/testing/web-platform/tests/IndexedDB/globalscope-indexedDB-SameObject.html new file mode 100644 index 0000000000..7263aaaace --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/globalscope-indexedDB-SameObject.html @@ -0,0 +1,15 @@ + + +IndexedDB: Verify [SameObject] behavior of the global scope's indexedDB attribute + + + + diff --git a/testing/web-platform/tests/IndexedDB/historical.html b/testing/web-platform/tests/IndexedDB/historical.html new file mode 100644 index 0000000000..8e7097eb46 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/historical.html @@ -0,0 +1,80 @@ + + +IndexedDB: Historical features + + + diff --git a/testing/web-platform/tests/IndexedDB/idb-binary-key-detached.htm b/testing/web-platform/tests/IndexedDB/idb-binary-key-detached.htm new file mode 100644 index 0000000000..ac6fc2ef98 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-binary-key-detached.htm @@ -0,0 +1,52 @@ + + +IndexedDB: Detached buffers supplied as binary keys + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idb-binary-key-roundtrip.htm b/testing/web-platform/tests/IndexedDB/idb-binary-key-roundtrip.htm new file mode 100644 index 0000000000..de3889a71c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-binary-key-roundtrip.htm @@ -0,0 +1,116 @@ + + +IndexedDB: Binary keys written to a database and read back + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idb-explicit-commit-throw.any.js b/testing/web-platform/tests/IndexedDB/idb-explicit-commit-throw.any.js new file mode 100644 index 0000000000..8a9dd94056 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-explicit-commit-throw.any.js @@ -0,0 +1,37 @@ +// META: script=resources/support-promises.js + +setup({allow_uncaught_exception:true}); + +promise_test(async testCase => { + // Register an event listener that will prevent the intentionally thrown + // error from bubbling up to the window and failing the testharness. This + // is necessary because currently allow_uncaught_exception does not behave + // as expected for promise_test. + // + // Git issue: https://github.com/web-platform-tests/wpt/issues/14041 + self.addEventListener('error', (event) => { event.preventDefault(); }); + + const db = await createDatabase(testCase, async db => { + await createBooksStore(testCase, db); + }); + + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + const putRequest = objectStore.put({isbn:'one', title:'title'}); + txn.commit(); + putRequest.onsuccess = () => { + throw new Error('This error thrown after an explicit commit should not ' + + 'prevent the transaction from committing.'); + } + await promiseForTransaction(testCase, txn); + + // Ensure that despite the uncaught error after the put request, the explicit + // commit still causes the request to be committed. + const txn2 = db.transaction(['books'], 'readwrite'); + const objectStore2 = txn2.objectStore('books'); + const getRequest = objectStore2.get('one'); + await promiseForTransaction(testCase, txn2); + + assert_equals(getRequest.result.title, 'title'); +}, 'Any errors in callbacks that run after an explicit commit will not stop ' + + 'the commit from being processed.'); diff --git a/testing/web-platform/tests/IndexedDB/idb-explicit-commit.any.js b/testing/web-platform/tests/IndexedDB/idb-explicit-commit.any.js new file mode 100644 index 0000000000..898d461d7b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-explicit-commit.any.js @@ -0,0 +1,288 @@ +// META: script=resources/support-promises.js + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + objectStore.put({isbn: 'one', title: 'title1'}); + objectStore.put({isbn: 'two', title: 'title2'}); + objectStore.put({isbn: 'three', title: 'title3'}); + txn.commit(); + await promiseForTransaction(testCase, txn); + + const txn2 = db.transaction(['books'], 'readonly'); + const objectStore2 = txn2.objectStore('books'); + const getRequestitle1 = objectStore2.get('one'); + const getRequestitle2 = objectStore2.get('two'); + const getRequestitle3 = objectStore2.get('three'); + txn2.commit(); + await promiseForTransaction(testCase, txn2); + assert_array_equals( + [getRequestitle1.result.title, + getRequestitle2.result.title, + getRequestitle3.result.title], + ['title1', 'title2', 'title3'], + 'All three retrieved titles should match those that were put.'); + db.close(); +}, 'Explicitly committed data can be read back out.'); + + +promise_test(async testCase => { + let db = await createDatabase(testCase, () => {}); + assert_equals(1, db.version, 'A database should be created as version 1'); + db.close(); + + // Upgrade the versionDB database and explicitly commit its versionchange + // transaction. + db = await migrateDatabase(testCase, 2, (db, txn) => { + txn.commit(); + }); + assert_equals(2, db.version, + 'The database version should have been incremented regardless of ' + + 'whether the versionchange transaction was explicitly or implicitly ' + + 'committed.'); + db.close(); +}, 'commit() on a version change transaction does not cause errors.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + txn.commit(); + assert_throws_dom('TransactionInactiveError', + () => { objectStore.put({isbn: 'one', title: 'title1'}); }, + 'After commit is called, the transaction should be inactive.'); + db.close(); +}, 'A committed transaction becomes inactive immediately.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + const putRequest = objectStore.put({isbn: 'one', title: 'title1'}); + putRequest.onsuccess = testCase.step_func(() => { + assert_throws_dom('TransactionInactiveError', + () => { objectStore.put({isbn:'two', title:'title2'}); }, + 'The transaction should not be active in the callback of a request after ' + + 'commit() is called.'); + }); + txn.commit(); + await promiseForTransaction(testCase, txn); + db.close(); +}, 'A committed transaction is inactive in future request callbacks.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + txn.commit(); + + assert_throws_dom('TransactionInactiveError', + () => { objectStore.put({isbn:'one', title:'title1'}); }, + 'After commit is called, the transaction should be inactive.'); + + const txn2 = db.transaction(['books'], 'readonly'); + const objectStore2 = txn2.objectStore('books'); + const getRequest = objectStore2.get('one'); + await promiseForTransaction(testCase, txn2); + assert_equals(getRequest.result, undefined); + + db.close(); +}, 'Puts issued after commit are not fulfilled.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + txn.abort(); + assert_throws_dom('InvalidStateError', + () => { txn.commit(); }, + 'The transaction should have been aborted.'); + db.close(); +}, 'Calling commit on an aborted transaction throws.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + txn.commit(); + assert_throws_dom('InvalidStateError', + () => { txn.commit(); }, + 'The transaction should have already committed.'); + db.close(); +}, 'Calling commit on a committed transaction throws.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + const putRequest = objectStore.put({isbn:'one', title:'title1'}); + txn.commit(); + assert_throws_dom('InvalidStateError', + () => { txn.abort(); }, + 'The transaction should already have committed.'); + const txn2 = db.transaction(['books'], 'readwrite'); + const objectStore2 = txn2.objectStore('books'); + const getRequest = objectStore2.get('one'); + await promiseForTransaction(testCase, txn2); + assert_equals( + getRequest.result.title, + 'title1', + 'Explicitly committed data should be gettable.'); + db.close(); +}, 'Calling abort on a committed transaction throws and does not prevent ' + + 'persisting the data.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite'); + const objectStore = txn.objectStore('books'); + const releaseTxnFunction = keepAlive(testCase, txn, 'books'); + + // Break up the scope of execution to force the transaction into an inactive + // state. + await timeoutPromise(0); + + assert_throws_dom('InvalidStateError', + () => { txn.commit(); }, + 'The transaction should be inactive so calling commit should throw.'); + releaseTxnFunction(); + db.close(); +}, 'Calling txn.commit() when txn is inactive should throw.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + createNotBooksStore(testCase, db); + }); + // Txn1 should commit before txn2, even though txn2 uses commit(). + const txn1 = db.transaction(['books'], 'readwrite'); + txn1.objectStore('books').put({isbn: 'one', title: 'title1'}); + const releaseTxnFunction = keepAlive(testCase, txn1, 'books'); + + const txn2 = db.transaction(['books'], 'readwrite'); + txn2.objectStore('books').put({isbn:'one', title:'title2'}); + txn2.commit(); + + // Exercise the IndexedDB transaction ordering by executing one with a + // different scope. A readonly transaction is used here because + // implementations are not required to run non-overlapping readwrite + // transactions in parallel, and some implementations (ex: Firefox) + // will not. + const txn3 = db.transaction(['not_books'], 'readonly'); + txn3.objectStore('not_books').getAllKeys(); + txn3.oncomplete = function() { + releaseTxnFunction(); + } + await Promise.all([promiseForTransaction(testCase, txn1), + promiseForTransaction(testCase, txn2)]); + + // Read the data back to verify that txn2 executed last. + const txn4 = db.transaction(['books'], 'readonly'); + const getRequest4 = txn4.objectStore('books').get('one'); + await promiseForTransaction(testCase, txn4); + assert_equals(getRequest4.result.title, 'title2'); + db.close(); +}, 'Transactions with same scope should stay in program order, even if one ' + + 'calls commit.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + // Txn1 creates the book 'one' so the 'add()' below fails. + const txn1 = db.transaction(['books'], 'readwrite'); + txn1.objectStore('books').add({isbn:'one', title:'title1'}); + txn1.commit(); + await promiseForTransaction(testCase, txn1); + + // Txn2 should abort, because the 'add' call is invalid, and commit() was + // called. + const txn2 = db.transaction(['books'], 'readwrite'); + const objectStore2 = txn2.objectStore('books'); + objectStore2.put({isbn:'two', title:'title2'}); + const addRequest = objectStore2.add({isbn:'one', title:'title2'}); + txn2.commit(); + txn2.oncomplete = () => { assert_unreached( + 'Transaction with invalid "add" call should not be completed.'); }; + + // Wait for the transaction to complete. We have to explicitly wait for the + // error signal on the transaction because of the nature of the test tooling. + await Promise.all([ + requestWatcher(testCase, addRequest).wait_for('error'), + transactionWatcher(testCase, txn2).wait_for(['error', 'abort']) + ]); + + // Read the data back to verify that txn2 was aborted. + const txn3 = db.transaction(['books'], 'readonly'); + const objectStore3 = txn3.objectStore('books'); + const getRequest1 = objectStore3.get('one'); + const getRequest2 = objectStore3.count('two'); + await promiseForTransaction(testCase, txn3); + assert_equals(getRequest1.result.title, 'title1'); + assert_equals(getRequest2.result, 0); + db.close(); +}, 'Transactions that explicitly commit and have errors should abort.'); + + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn1 = db.transaction(['books'], 'readwrite'); + txn1.objectStore('books').add({isbn: 'one', title: 'title1'}); + txn1.commit(); + await promiseForTransaction(testCase, txn1); + + // The second add request will throw an error, but the onerror handler will + // appropriately catch the error allowing the valid put request on the + // transaction to commit. + const txn2 = db.transaction(['books'], 'readwrite'); + const objectStore2 = txn2.objectStore('books'); + objectStore2.put({isbn: 'two', title:'title2'}); + const addRequest = objectStore2.add({isbn: 'one', title:'unreached_title'}); + addRequest.onerror = (event) => { + event.preventDefault(); + addRequest.transaction.commit(); + }; + + // Wait for the transaction to complete. We have to explicitly wait for the + // error signal on the transaction because of the nature of the test tooling. + await transactionWatcher(testCase,txn2).wait_for(['error', 'complete']) + + // Read the data back to verify that txn2 was committed. + const txn3 = db.transaction(['books'], 'readonly'); + const objectStore3 = txn3.objectStore('books'); + const getRequest1 = objectStore3.get('one'); + const getRequest2 = objectStore3.get('two'); + await promiseForTransaction(testCase, txn3); + assert_equals(getRequest1.result.title, 'title1'); + assert_equals(getRequest2.result.title, 'title2'); + db.close(); +}, 'Transactions that handle all errors properly should behave as ' + + 'expected when an explicit commit is called in an onerror handler.'); diff --git a/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html b/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html new file mode 100644 index 0000000000..16bdacf6c6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-partitioned-basic.tentative.sub.html @@ -0,0 +1,55 @@ + + +IndexedDB: partitioned storage test + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idb-partitioned-coverage.tentative.sub.html b/testing/web-platform/tests/IndexedDB/idb-partitioned-coverage.tentative.sub.html new file mode 100644 index 0000000000..ae0884cb52 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-partitioned-coverage.tentative.sub.html @@ -0,0 +1,12 @@ + + +IndexedDB: partitioned storage test + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idb-partitioned-persistence.tentative.sub.html b/testing/web-platform/tests/IndexedDB/idb-partitioned-persistence.tentative.sub.html new file mode 100644 index 0000000000..65a0a085e2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb-partitioned-persistence.tentative.sub.html @@ -0,0 +1,63 @@ + + +IndexedDB: partitioned storage test + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idb_binary_key_conversion.htm b/testing/web-platform/tests/IndexedDB/idb_binary_key_conversion.htm new file mode 100644 index 0000000000..b55e6324b3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb_binary_key_conversion.htm @@ -0,0 +1,79 @@ + + +Verify the coversion of various types of BufferSource + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idb_webworkers.htm b/testing/web-platform/tests/IndexedDB/idb_webworkers.htm new file mode 100644 index 0000000000..5a061c2650 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idb_webworkers.htm @@ -0,0 +1,31 @@ + +IndexedDB inside of a WebWorker + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-advance-continue-async.htm b/testing/web-platform/tests/IndexedDB/idbcursor-advance-continue-async.htm new file mode 100644 index 0000000000..ff37515063 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-advance-continue-async.htm @@ -0,0 +1,181 @@ + +IDBCursor asyncness + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-advance-exception-order.html b/testing/web-platform/tests/IndexedDB/idbcursor-advance-exception-order.html new file mode 100644 index 0000000000..1dfe4ff55b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-advance-exception-order.html @@ -0,0 +1,91 @@ + + +IndexedDB: IDBCursor advance() Exception Ordering + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-advance-invalid.htm b/testing/web-platform/tests/IndexedDB/idbcursor-advance-invalid.htm new file mode 100644 index 0000000000..67c5e93df0 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-advance-invalid.htm @@ -0,0 +1,192 @@ + +IDBCursor.advance() - invalid + + + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-advance.htm b/testing/web-platform/tests/IndexedDB/idbcursor-advance.htm new file mode 100644 index 0000000000..624ed14f1f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-advance.htm @@ -0,0 +1,247 @@ + +IDBCursor.advance() + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-continue-exception-order.htm b/testing/web-platform/tests/IndexedDB/idbcursor-continue-exception-order.htm new file mode 100644 index 0000000000..29c874fdb6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-continue-exception-order.htm @@ -0,0 +1,81 @@ + +IndexedDB: IDBCursor continue() Exception Ordering + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-continue.htm b/testing/web-platform/tests/IndexedDB/idbcursor-continue.htm new file mode 100644 index 0000000000..db98c2261b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-continue.htm @@ -0,0 +1,248 @@ + +IDBCursor.continue() + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exception-order.htm b/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exception-order.htm new file mode 100644 index 0000000000..477dabc60e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exception-order.htm @@ -0,0 +1,380 @@ + + + +IDBCursor.continuePrimaryKey() - Exception Orders + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exceptions.htm b/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exceptions.htm new file mode 100644 index 0000000000..862c9c951b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey-exceptions.htm @@ -0,0 +1,107 @@ + + +IndexedDB: IDBCursor continuePrimaryKey() exception throwing + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey.htm b/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey.htm new file mode 100644 index 0000000000..0de88c0aef --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-continuePrimaryKey.htm @@ -0,0 +1,134 @@ + + +IndexedDB: IDBCursor method continuePrimaryKey() + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-delete-exception-order.htm b/testing/web-platform/tests/IndexedDB/idbcursor-delete-exception-order.htm new file mode 100644 index 0000000000..b84ca11ed4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-delete-exception-order.htm @@ -0,0 +1,76 @@ + +IndexedDB: IDBCursor delete() Exception Ordering + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-direction-index-keyrange.htm b/testing/web-platform/tests/IndexedDB/idbcursor-direction-index-keyrange.htm new file mode 100644 index 0000000000..2b3ff34318 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-direction-index-keyrange.htm @@ -0,0 +1,60 @@ + + +IDBCursor direction - index with keyrange + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-direction-index.htm b/testing/web-platform/tests/IndexedDB/idbcursor-direction-index.htm new file mode 100644 index 0000000000..be22337884 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-direction-index.htm @@ -0,0 +1,57 @@ + +IDBCursor direction - index + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore-keyrange.htm b/testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore-keyrange.htm new file mode 100644 index 0000000000..b458ef0cbf --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore-keyrange.htm @@ -0,0 +1,54 @@ + + +IDBCursor direction - object store with keyrange + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore.htm new file mode 100644 index 0000000000..c099651a29 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-direction-objectstore.htm @@ -0,0 +1,56 @@ + +IDBCursor direction - object store + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-direction.htm b/testing/web-platform/tests/IndexedDB/idbcursor-direction.htm new file mode 100644 index 0000000000..1f2dedd76b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-direction.htm @@ -0,0 +1,76 @@ + +IDBCursor.direction + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-iterating-update.htm b/testing/web-platform/tests/IndexedDB/idbcursor-iterating-update.htm new file mode 100644 index 0000000000..0a7282b68f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-iterating-update.htm @@ -0,0 +1,58 @@ + + +IndexedDB: Index iteration with cursor updates/deletes + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-key.htm b/testing/web-platform/tests/IndexedDB/idbcursor-key.htm new file mode 100644 index 0000000000..e3b22f8bd6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-key.htm @@ -0,0 +1,57 @@ + +IDBCursor.key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-primarykey.htm b/testing/web-platform/tests/IndexedDB/idbcursor-primarykey.htm new file mode 100644 index 0000000000..d6832c5ede --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-primarykey.htm @@ -0,0 +1,61 @@ + +IDBCursor.primaryKey + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-request-source.html b/testing/web-platform/tests/IndexedDB/idbcursor-request-source.html new file mode 100644 index 0000000000..8ed4a8dee2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-request-source.html @@ -0,0 +1,31 @@ + + +IndexedDB: The source of requests made against cursors + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-request.any.js b/testing/web-platform/tests/IndexedDB/idbcursor-request.any.js new file mode 100644 index 0000000000..2e1216a736 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-request.any.js @@ -0,0 +1,41 @@ +// META: script=resources/support.js + +function cursorRequestTest({ useIndex, useKeyCursor }) { + indexeddb_test( + (t, db) => { + const objStore = db.createObjectStore("my_objectstore"); + objStore.add("data", 1); + objStore.createIndex("my_index", ""); + }, + (t, db) => { + const tx = db.transaction("my_objectstore", "readonly", {durability: 'relaxed'}); + let source = tx.objectStore("my_objectstore"); + if (useIndex) source = source.index('my_index'); + const req = useKeyCursor ? source.openKeyCursor() : source.openCursor(); + let cursor; + + req.onsuccess = t.step_func(() => { + cursor = req.result; + assert_equals(cursor.request, req, 'cursor.request'); + assert_readonly(cursor, 'request'); + assert_equals(cursor.request, cursor.request, 'cursor.request does not change'); + }); + + req.transaction.oncomplete = t.step_func(() => { + setTimeout(t.step_func(() => { + assert_equals(cursor.request, req, 'cursor.request after transaction complete'); + t.done(); + }), 0); + }); + + req.transaction.onerror = t.unreached_func('Transaction error'); + }, + `cursor.request from ${useIndex ? 'IDBIndex' : 'IDBObjectStore'}.${useKeyCursor ? 'openKeyCursor' : 'openCursor'}` + ); +} + +for (const useIndex of [false, true]) { + for (const useKeyCursor of [false, true]) { + cursorRequestTest({ useIndex, useKeyCursor }); + } +} diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-reused.htm b/testing/web-platform/tests/IndexedDB/idbcursor-reused.htm new file mode 100644 index 0000000000..feb35a55f8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-reused.htm @@ -0,0 +1,69 @@ + +IDBCursor is reused + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-source.htm b/testing/web-platform/tests/IndexedDB/idbcursor-source.htm new file mode 100644 index 0000000000..81acda33cc --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-source.htm @@ -0,0 +1,66 @@ + +IDBCursor.source + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor-update-exception-order.htm b/testing/web-platform/tests/IndexedDB/idbcursor-update-exception-order.htm new file mode 100644 index 0000000000..8ac08635bb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor-update-exception-order.htm @@ -0,0 +1,98 @@ + +IndexedDB: IDBCursor update() Exception Ordering + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index.htm new file mode 100644 index 0000000000..4c0c0b697a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index.htm @@ -0,0 +1,57 @@ + +IDBCursor.advance() - index - iterate cursor number of times specified by count + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index2.htm new file mode 100644 index 0000000000..04842f71c3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index2.htm @@ -0,0 +1,47 @@ + +IDBCursor.advance() - attempt to pass a count parameter that is not a number + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index3.htm new file mode 100644 index 0000000000..a797286e7c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index3.htm @@ -0,0 +1,47 @@ + +IDBCursor.advance() - index - attempt to advance backwards + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index5.htm new file mode 100644 index 0000000000..5e60aefd5a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index5.htm @@ -0,0 +1,55 @@ + +IDBCursor.advance() - index - iterate to the next record + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index6.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index6.htm new file mode 100644 index 0000000000..3a1168f57a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index6.htm @@ -0,0 +1,37 @@ + + +IDBCursor.advance() - index - throw TypeError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index7.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index7.htm new file mode 100644 index 0000000000..f5ecc6144c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index7.htm @@ -0,0 +1,39 @@ + + +IDBCursor.advance() - index - throw TransactionInactiveError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index8.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index8.htm new file mode 100644 index 0000000000..1f9ff9c453 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index8.htm @@ -0,0 +1,38 @@ + + +IDBCursor.advance() - index - throw InvalidStateError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_index9.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index9.htm new file mode 100644 index 0000000000..1756419c6d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_index9.htm @@ -0,0 +1,37 @@ + + +IDBCursor.advance() - index - throw InvalidStateError caused by object store been deleted + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore.htm new file mode 100644 index 0000000000..c9226c5667 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore.htm @@ -0,0 +1,54 @@ + + IDBCursor.advance() - object store - iterate cursor number of times specified by count + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore2.htm new file mode 100644 index 0000000000..3d46f0c675 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore2.htm @@ -0,0 +1,40 @@ + + +IDBCursor.advance() - object store - throw TypeError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore3.htm new file mode 100644 index 0000000000..c91e4acaab --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore3.htm @@ -0,0 +1,42 @@ + + +IDBCursor.advance() - object store - throw TransactionInactiveError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore4.htm new file mode 100644 index 0000000000..766a56daf4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore4.htm @@ -0,0 +1,41 @@ + + +IDBCursor.advance() - object store - throw InvalidStateError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore5.htm new file mode 100644 index 0000000000..2c6fa640ae --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_advance_objectstore5.htm @@ -0,0 +1,36 @@ + + +IDBCursor.advance() - object store - throw InvalidStateError caused by object store been deleted + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_delete_objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_delete_objectstore.htm new file mode 100644 index 0000000000..86b4abf113 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_delete_objectstore.htm @@ -0,0 +1,114 @@ + +IDBObjectStore.delete() and IDBCursor.continue() - object store - remove a record from the object store while iterating cursor + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index.htm new file mode 100644 index 0000000000..cfc0ae3fe9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index.htm @@ -0,0 +1,52 @@ + +IDBCursor.continue() - index - iterate to the next record + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index2.htm new file mode 100644 index 0000000000..56b9218fd1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index2.htm @@ -0,0 +1,49 @@ + +IDBCursor.continue() - index - attempt to pass a key parameter that is not a valid key + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index3.htm new file mode 100644 index 0000000000..b9f5945402 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index3.htm @@ -0,0 +1,54 @@ + +IDBCursor.continue() - index - attempt to iterate to the previous record when the direction is set for the next record + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index4.htm new file mode 100644 index 0000000000..f851b87ddf --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index4.htm @@ -0,0 +1,65 @@ + +IDBCursor.continue() - index - attempt to iterate to the next record when the direction is set for the previous record + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index5.htm new file mode 100644 index 0000000000..3e70873bbb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index5.htm @@ -0,0 +1,64 @@ + +IDBCursor.continue() - index - iterate using 'prevunique' + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index6.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index6.htm new file mode 100644 index 0000000000..1933bfcf99 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index6.htm @@ -0,0 +1,64 @@ + +IDBCursor.continue() - index - iterate using nextunique + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index7.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index7.htm new file mode 100644 index 0000000000..61bfe85b27 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index7.htm @@ -0,0 +1,38 @@ + + +IDBCursor.continue() - index - throw TransactionInactiveError + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_index8.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index8.htm new file mode 100644 index 0000000000..e4cbe7261f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_index8.htm @@ -0,0 +1,38 @@ + + +IDBCursor.continue() - index - throw InvalidStateError caused by object store been deleted + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_invalid.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_invalid.htm new file mode 100644 index 0000000000..c177c7f565 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_invalid.htm @@ -0,0 +1,54 @@ + +IDBCursor.continue() - attempt to call continue two times + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore.htm new file mode 100644 index 0000000000..f82aa99949 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore.htm @@ -0,0 +1,46 @@ + +IDBCursor.continue() - object store - iterate to the next record + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore2.htm new file mode 100644 index 0000000000..8b79c64615 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore2.htm @@ -0,0 +1,40 @@ + +IDBCursor.continue() - object store - attempt to pass a key parameter is not a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore3.htm new file mode 100644 index 0000000000..7d96d7fec9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore3.htm @@ -0,0 +1,40 @@ + +IDBCursor.continue() - object store - attempt to iterate to the previous record when the direction is set for the next record + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore4.htm new file mode 100644 index 0000000000..5056a7364f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore4.htm @@ -0,0 +1,57 @@ + +IDBCursor.continue() - object store - attempt to iterate to the next record when the direction is set for the previous record + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore5.htm new file mode 100644 index 0000000000..a0c3663ab4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore5.htm @@ -0,0 +1,42 @@ + + +IDBCursor.continue() - object store - throw TransactionInactiveError + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore6.htm b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore6.htm new file mode 100644 index 0000000000..7a2b50752c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_continue_objectstore6.htm @@ -0,0 +1,37 @@ + + +IDBCursor.continue() - object store - throw InvalidStateError caused by object store been deleted + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_index.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index.htm new file mode 100644 index 0000000000..6d1b4e35c9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index.htm @@ -0,0 +1,69 @@ + +IDBCursor.delete() - index - remove a record from the object store + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_index2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index2.htm new file mode 100644 index 0000000000..054432d65d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index2.htm @@ -0,0 +1,42 @@ + +IDBCursor.delete() - index - attempt to remove a record in a read-only transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_index3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index3.htm new file mode 100644 index 0000000000..afe945e646 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index3.htm @@ -0,0 +1,40 @@ + +IDBCursor.delete() - index - attempt to remove a record in an inactive transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_index4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index4.htm new file mode 100644 index 0000000000..8eb6915b88 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index4.htm @@ -0,0 +1,38 @@ + + +IDBCursor.delete() - index - throw InvalidStateError caused by object store been deleted + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_index5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index5.htm new file mode 100644 index 0000000000..76ce6d0e50 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_index5.htm @@ -0,0 +1,39 @@ + + +IDBCursor.delete() - index - throw InvalidStateError when the cursor is being iterated + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore.htm new file mode 100644 index 0000000000..f79206295a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore.htm @@ -0,0 +1,65 @@ + +IDBCursor.delete() - object store - remove a record from the object store + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore2.htm new file mode 100644 index 0000000000..ef3c1e57a2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore2.htm @@ -0,0 +1,40 @@ + +IDBCursor.delete() - object store - attempt to remove a record in a read-only transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore3.htm new file mode 100644 index 0000000000..4a4ea736c4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore3.htm @@ -0,0 +1,39 @@ + +IDBCursor.delete() - index - attempt to remove a record in an inactive transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore4.htm new file mode 100644 index 0000000000..5ecdb4bf17 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore4.htm @@ -0,0 +1,37 @@ + + +IDBCursor.delete() - object store - throw InvalidStateError caused by object store been deleted + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore5.htm new file mode 100644 index 0000000000..e17ade88f5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_delete_objectstore5.htm @@ -0,0 +1,41 @@ + + +IDBCursor.delete() - object store - throw InvalidStateError when the cursor is being iterated + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_iterating.htm b/testing/web-platform/tests/IndexedDB/idbcursor_iterating.htm new file mode 100644 index 0000000000..4930d1eb1e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_iterating.htm @@ -0,0 +1,109 @@ + +IDBCursor.continue() - objectstore - delete next element, and iterate to it + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_iterating_index.htm b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_index.htm new file mode 100644 index 0000000000..be480a0815 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_index.htm @@ -0,0 +1,53 @@ + +IDBCursor.continue() - index - delete next element, and iterate to it + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_iterating_index2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_index2.htm new file mode 100644 index 0000000000..d7af6afdc7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_index2.htm @@ -0,0 +1,53 @@ + +IDBCursor.continue() - index - add next element, and iterate to it + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore.htm new file mode 100644 index 0000000000..12cec14570 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore.htm @@ -0,0 +1,50 @@ + +IDBCursor.continue() - objectstore - delete next element, and iterate to it + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore2.htm new file mode 100644 index 0000000000..2bd9749edf --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_iterating_objectstore2.htm @@ -0,0 +1,50 @@ + +IDBCursor.continue() - objectstore - add next element, and iterate to it + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index.htm new file mode 100644 index 0000000000..ce7def4e3c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index.htm @@ -0,0 +1,64 @@ + +IDBCursor.update() - index - modify a record in the object store + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index2.htm new file mode 100644 index 0000000000..dee4d19435 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index2.htm @@ -0,0 +1,40 @@ + +IDBCursor.update() - index - attempt to modify a record in a read-only transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index3.htm new file mode 100644 index 0000000000..a7d87eed82 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index3.htm @@ -0,0 +1,41 @@ + +IDBCursor.update() - index - attempt to modify a record in an inactive transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index4.htm new file mode 100644 index 0000000000..c7b05270da --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index4.htm @@ -0,0 +1,39 @@ + + +IDBCursor.update() - index - attempt to modify a record when object store been deleted + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index5.htm new file mode 100644 index 0000000000..b4395f901b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index5.htm @@ -0,0 +1,45 @@ + +IDBCursor.update() - index - throw DataCloneError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index6.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index6.htm new file mode 100644 index 0000000000..dd39329035 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index6.htm @@ -0,0 +1,41 @@ + +IDBCursor.update() - index - no argument + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index7.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index7.htm new file mode 100644 index 0000000000..5cba5ababf --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index7.htm @@ -0,0 +1,41 @@ + +IDBCursor.update() - index - throw DataError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index8.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_index8.htm new file mode 100644 index 0000000000..14b72ba3fd --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index8.htm @@ -0,0 +1,45 @@ + +IDBCursor.update() - index - throw InvalidStateError when the cursor is being iterated + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_index9.any.js b/testing/web-platform/tests/IndexedDB/idbcursor_update_index9.any.js new file mode 100644 index 0000000000..aec277e56b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_index9.any.js @@ -0,0 +1,43 @@ +// META: script=resources/support-promises.js + +promise_test(async t => { + const db = await createDatabase(t, db => { + const store = db.createObjectStore('store'); + store.createIndex('index', 'value'); + store.put({value: 1}, 1); + store.put({value: 2}, 2); + store.put({value: 3}, 3); + }); + + { + // Iterate over all index entries until an upper bound is reached. + // On each record found, increment the value used as the index + // key, which will make it show again up later in the iteration. + const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + const range = IDBKeyRange.upperBound(9); + const index = tx.objectStore('store').index('index'); + const request = index.openCursor(range); + request.onsuccess = t.step_func(e => { + const cursor = e.target.result; + if (!cursor) + return; + + const record = cursor.value; + record.value += 1; + cursor.update(record); + + cursor.continue(); + }); + + await promiseForTransaction(t, tx); + } + + { + const tx = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const results = await promiseForRequest(t, tx.objectStore('store').getAll()); + assert_array_equals( + results.map(record => record.value), + [10, 10, 10], + 'Values should all be incremented until bound reached'); + } +}, 'Index cursor - indexed values updated during iteration'); diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore.htm new file mode 100644 index 0000000000..e1fdff6047 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore.htm @@ -0,0 +1,60 @@ + +IDBCursor.update() - objectstore - modify a record in the object store + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore2.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore2.htm new file mode 100644 index 0000000000..73dcd34f5b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore2.htm @@ -0,0 +1,38 @@ + +IDBCursor.update() - object store - attempt to modify a record in a read-only transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore3.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore3.htm new file mode 100644 index 0000000000..3582f0967c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore3.htm @@ -0,0 +1,40 @@ + +IDBCursor.update() - object store - attempt to modify a record in an inactive transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore4.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore4.htm new file mode 100644 index 0000000000..b467c296ed --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore4.htm @@ -0,0 +1,39 @@ + +IDBCursor.update() - index - modify a record in the object store + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore5.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore5.htm new file mode 100644 index 0000000000..e358caa392 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore5.htm @@ -0,0 +1,41 @@ + + +IDBCursor.update() - object store - attempt to modify a record when object store been deleted + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore6.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore6.htm new file mode 100644 index 0000000000..26d42c116d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore6.htm @@ -0,0 +1,43 @@ + +IDBCursor.update() - object store - throw DataCloneError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore7.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore7.htm new file mode 100644 index 0000000000..fc850bbcf1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore7.htm @@ -0,0 +1,39 @@ + +IDBCursor.update() - object store - no argument + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore8.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore8.htm new file mode 100644 index 0000000000..4d3439794e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore8.htm @@ -0,0 +1,39 @@ + +IDBCursor.update() - object store - throw DataError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore9.htm b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore9.htm new file mode 100644 index 0000000000..39220f67be --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbcursor_update_objectstore9.htm @@ -0,0 +1,45 @@ + + +IDBCursor.update() - object store - throw InvalidStateError when the cursor is being iterated + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase-createObjectStore-exception-order.htm b/testing/web-platform/tests/IndexedDB/idbdatabase-createObjectStore-exception-order.htm new file mode 100644 index 0000000000..1ca2ce1d7c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase-createObjectStore-exception-order.htm @@ -0,0 +1,84 @@ + +IndexedDB: IDBDatabase createObjectStore() Exception Ordering + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase-deleteObjectStore-exception-order.htm b/testing/web-platform/tests/IndexedDB/idbdatabase-deleteObjectStore-exception-order.htm new file mode 100644 index 0000000000..4d98a31f12 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase-deleteObjectStore-exception-order.htm @@ -0,0 +1,45 @@ + +IndexedDB: IDBDatabase deleteObjectStore() Exception Ordering + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase-transaction-exception-order.html b/testing/web-platform/tests/IndexedDB/idbdatabase-transaction-exception-order.html new file mode 100644 index 0000000000..d06efe1d2f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase-transaction-exception-order.html @@ -0,0 +1,68 @@ + + +IndexedDB: IDBDatabase transaction() Exception Ordering + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_close.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_close.htm new file mode 100644 index 0000000000..8ebebaf1b8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_close.htm @@ -0,0 +1,44 @@ + +IDBDatabase.close() - unblock the version change transaction created by an open database request + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_close2.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_close2.htm new file mode 100644 index 0000000000..26bc4ce638 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_close2.htm @@ -0,0 +1,39 @@ + +IDBDatabase.close() - unblock the delete database request + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore-createIndex-emptyname.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore-createIndex-emptyname.htm new file mode 100644 index 0000000000..161902c2ab --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore-createIndex-emptyname.htm @@ -0,0 +1,45 @@ + + +IDBDatabase.createObjectStore() and IDBObjectStore.createIndex() - both with empty name + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore.htm new file mode 100644 index 0000000000..3379ab58f5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore.htm @@ -0,0 +1,29 @@ + +IDBDatabase.createObjectStore() - returns an instance of IDBObjectStore + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-1000ends.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-1000ends.htm new file mode 100644 index 0000000000..6997562d3a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-1000ends.htm @@ -0,0 +1,37 @@ + +IDBDatabase.createObjectStore() - create 1000 object stores, add one item and delete + + + + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-emptyname.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-emptyname.htm new file mode 100644 index 0000000000..0ed28e9e7e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore10-emptyname.htm @@ -0,0 +1,38 @@ + + +IDBDatabase.createObjectStore() - empty name + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore11.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore11.htm new file mode 100644 index 0000000000..f1a9310c07 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore11.htm @@ -0,0 +1,25 @@ + + +IDBDatabase.createObjectStore() - attempting to create an existing object store with a different keyPath throw ConstraintError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore2.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore2.htm new file mode 100644 index 0000000000..55c73d6228 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore2.htm @@ -0,0 +1,33 @@ + +IDBDatabase.createObjectStore() - object store 'name' and 'keyPath' properties are correctly set + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore3.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore3.htm new file mode 100644 index 0000000000..d0006bfe1f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore3.htm @@ -0,0 +1,24 @@ + +IDBDatabase.createObjectStore() - attempt to create an object store outside of a version change transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore4.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore4.htm new file mode 100644 index 0000000000..bd5989335a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore4.htm @@ -0,0 +1,27 @@ + +IDBDatabase.createObjectStore() - attempt to create an object store that already exists + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore5.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore5.htm new file mode 100644 index 0000000000..a30b73c594 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore5.htm @@ -0,0 +1,33 @@ + +IDBDatabase.createObjectStore() - object store's name appears in database's list + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore6.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore6.htm new file mode 100644 index 0000000000..54a2df81e9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore6.htm @@ -0,0 +1,30 @@ + +IDBDatabase.createObjectStore() - attempt to create an object store with an invalid key path + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore7.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore7.htm new file mode 100644 index 0000000000..b2a7a03b1c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore7.htm @@ -0,0 +1,25 @@ + +IDBDatabase.createObjectStore() - create an object store with an unknown optional parameter + + + + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore8-parameters.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore8-parameters.htm new file mode 100644 index 0000000000..99a473d418 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore8-parameters.htm @@ -0,0 +1,39 @@ + + +IDBObjectStoreParameters + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore9-invalidparameters.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore9-invalidparameters.htm new file mode 100644 index 0000000000..65b7535abb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_createObjectStore9-invalidparameters.htm @@ -0,0 +1,29 @@ + + +createObjectStore: Invalid optionalParameters + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm new file mode 100644 index 0000000000..e3f6a775c5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm @@ -0,0 +1,25 @@ + +IDBDatabase.deleteObjectStore() - object store's name is removed from database's list + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore2.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore2.htm new file mode 100644 index 0000000000..91f118ef62 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore2.htm @@ -0,0 +1,31 @@ + +IDBDatabase.deleteObjectStore() - attempt to remove an object store outside of a version change transaction + + + + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm new file mode 100644 index 0000000000..3ddbe8ec62 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm @@ -0,0 +1,23 @@ + +IDBDatabase.deleteObjectStore() - attempt to remove an object store that does not exist + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm new file mode 100644 index 0000000000..0a5e1b83cf --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm @@ -0,0 +1,42 @@ + + +IDBDatabase.deleteObjectStore() - the object store is not reused + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_transaction.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction.htm new file mode 100644 index 0000000000..8e8264f8ea --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction.htm @@ -0,0 +1,24 @@ + +IDBDatabase.transaction() - attempt to open a transaction with invalid scope + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_transaction2.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction2.htm new file mode 100644 index 0000000000..37b1122919 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction2.htm @@ -0,0 +1,27 @@ + +IDBDatabase.transaction() - opening a transaction defaults to a read-only mode + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_transaction3.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction3.htm new file mode 100644 index 0000000000..1eea31f764 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction3.htm @@ -0,0 +1,28 @@ + +IDBDatabase.transaction() - attempt to open a transaction from closed database connection + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_transaction4.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction4.htm new file mode 100644 index 0000000000..3a164c25f5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction4.htm @@ -0,0 +1,26 @@ + +IDBDatabase.transaction() - attempt to open a transaction with invalid mode + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_transaction5.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction5.htm new file mode 100644 index 0000000000..451939731f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbdatabase_transaction5.htm @@ -0,0 +1,22 @@ + + +IDBDatabase.transaction() - If storeNames is an empty list, the implementation must throw a DOMException of type InvalidAccessError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-databases-opaque-origin.html b/testing/web-platform/tests/IndexedDB/idbfactory-databases-opaque-origin.html new file mode 100644 index 0000000000..ff5b668664 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-databases-opaque-origin.html @@ -0,0 +1,97 @@ + + +IDBFactory.databases() and opaque origins + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-opaque-origin.html b/testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-opaque-origin.html new file mode 100644 index 0000000000..0714389537 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-opaque-origin.html @@ -0,0 +1,101 @@ + + +IDBFactory.deleteDatabase() and opaque origins + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-request-success.html b/testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-request-success.html new file mode 100644 index 0000000000..130c427a40 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-deleteDatabase-request-success.html @@ -0,0 +1,28 @@ + + +IDBFactory deleteDatabase(): request properties on success + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-open-error-properties.html b/testing/web-platform/tests/IndexedDB/idbfactory-open-error-properties.html new file mode 100644 index 0000000000..c4bc3ffaa5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-open-error-properties.html @@ -0,0 +1,28 @@ + + +IndexedDB: Test IDBFactory open() error event properties + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-open-opaque-origin.html b/testing/web-platform/tests/IndexedDB/idbfactory-open-opaque-origin.html new file mode 100644 index 0000000000..a71da9afb3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-open-opaque-origin.html @@ -0,0 +1,105 @@ + + +IDBFactory.open() and opaque origins + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-open-request-error.html b/testing/web-platform/tests/IndexedDB/idbfactory-open-request-error.html new file mode 100644 index 0000000000..cfd6862afa --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-open-request-error.html @@ -0,0 +1,66 @@ + + +IDBFactory open(): request properties on error + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-open-request-success.html b/testing/web-platform/tests/IndexedDB/idbfactory-open-request-success.html new file mode 100644 index 0000000000..fb6ff9034d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-open-request-success.html @@ -0,0 +1,54 @@ + + +IDBFactory open(): request properties on success + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory-origin-isolation.html b/testing/web-platform/tests/IndexedDB/idbfactory-origin-isolation.html new file mode 100644 index 0000000000..eaf9800d7c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory-origin-isolation.html @@ -0,0 +1,41 @@ + +Databases on different origins use separate locking + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_cmp.htm b/testing/web-platform/tests/IndexedDB/idbfactory_cmp.htm new file mode 100644 index 0000000000..e896743ff6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_cmp.htm @@ -0,0 +1,21 @@ + + +IDBFactory.cmp() - compared keys return correct value + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_cmp2.htm b/testing/web-platform/tests/IndexedDB/idbfactory_cmp2.htm new file mode 100644 index 0000000000..68f87333db --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_cmp2.htm @@ -0,0 +1,41 @@ + + +IDBFactory.cmp() - invalid key + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_cmp3.htm b/testing/web-platform/tests/IndexedDB/idbfactory_cmp3.htm new file mode 100644 index 0000000000..749fd7b861 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_cmp3.htm @@ -0,0 +1,27 @@ + + +IDBFactory.cmp() - compared keys in different types + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_cmp4.htm b/testing/web-platform/tests/IndexedDB/idbfactory_cmp4.htm new file mode 100644 index 0000000000..757e7c2397 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_cmp4.htm @@ -0,0 +1,40 @@ + + +IDBFactory.cmp() - comparison of binary keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase.htm b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase.htm new file mode 100644 index 0000000000..28c18cccbb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase.htm @@ -0,0 +1,25 @@ + +IDBFactory.deleteDatabase() - request has no source + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase2.htm b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase2.htm new file mode 100644 index 0000000000..e503c3437f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase2.htm @@ -0,0 +1,27 @@ + +IDBFactory.deleteDatabase() - result of the request is set to undefined + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase3.htm b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase3.htm new file mode 100644 index 0000000000..2895013f27 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase3.htm @@ -0,0 +1,33 @@ + +IDBFactory.deleteDatabase() - success event + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase4.htm b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase4.htm new file mode 100644 index 0000000000..5a0d90bf50 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_deleteDatabase4.htm @@ -0,0 +1,62 @@ + +Test events opening a second database when one connection is open already + + + + + +
+ + + diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open.htm new file mode 100644 index 0000000000..8e0b2412c9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open.htm @@ -0,0 +1,18 @@ + +IDBFactory.open() - request has no source + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open10.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open10.htm new file mode 100644 index 0000000000..6340bd3cdf --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open10.htm @@ -0,0 +1,93 @@ + +IDBFactory.open() - error in upgradeneeded resets db + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open11.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open11.htm new file mode 100644 index 0000000000..d4012bea55 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open11.htm @@ -0,0 +1,62 @@ + +IDBFactory.open() - second open's transaction is available to get objectStores + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open12.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open12.htm new file mode 100644 index 0000000000..ee713ef352 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open12.htm @@ -0,0 +1,50 @@ + +IDBFactory.open() - upgradeneeded gets VersionChangeEvent + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open2.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open2.htm new file mode 100644 index 0000000000..00ebbd3d0f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open2.htm @@ -0,0 +1,21 @@ + +IDBFactory.open() - database 'name' and 'version' are correctly set + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open3.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open3.htm new file mode 100644 index 0000000000..19cd5c5254 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open3.htm @@ -0,0 +1,28 @@ + +IDBFactory.open() - no version opens current database + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open4.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open4.htm new file mode 100644 index 0000000000..6983ca0737 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open4.htm @@ -0,0 +1,20 @@ + +IDBFactory.open() - new database has default version + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open5.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open5.htm new file mode 100644 index 0000000000..f6ddb17001 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open5.htm @@ -0,0 +1,18 @@ + +IDBFactory.open() - new database is empty + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open6.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open6.htm new file mode 100644 index 0000000000..2b2cb334e4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open6.htm @@ -0,0 +1,36 @@ + +IDBFactory.open() - open database with a lower version than current + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open7.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open7.htm new file mode 100644 index 0000000000..ccb3d06748 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open7.htm @@ -0,0 +1,41 @@ + +IDBFactory.open() - open database with a higher version than current + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open8.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open8.htm new file mode 100644 index 0000000000..04c57df2ed --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open8.htm @@ -0,0 +1,27 @@ + +IDBFactory.open() - error in version change transaction aborts open + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbfactory_open9.htm b/testing/web-platform/tests/IndexedDB/idbfactory_open9.htm new file mode 100644 index 0000000000..36a9ef814c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbfactory_open9.htm @@ -0,0 +1,71 @@ + +IDBFactory.open() - errors in version argument + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex-cross-realm-methods.html b/testing/web-platform/tests/IndexedDB/idbindex-cross-realm-methods.html new file mode 100644 index 0000000000..1e431d3772 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-cross-realm-methods.html @@ -0,0 +1,99 @@ + + +Cross-realm IDBIndex methods from detached iframe work as expected + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-getAll-enforcerange.html b/testing/web-platform/tests/IndexedDB/idbindex-getAll-enforcerange.html new file mode 100644 index 0000000000..73b55b7d86 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-getAll-enforcerange.html @@ -0,0 +1,27 @@ + + +IndexedDB: IDBIndex getAll() uses [EnforceRange] + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-getAllKeys-enforcerange.html b/testing/web-platform/tests/IndexedDB/idbindex-getAllKeys-enforcerange.html new file mode 100644 index 0000000000..31dc787f68 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-getAllKeys-enforcerange.html @@ -0,0 +1,27 @@ + + +IndexedDB: IDBIndex getAllKeys() uses [EnforceRange] + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-multientry-arraykeypath.htm b/testing/web-platform/tests/IndexedDB/idbindex-multientry-arraykeypath.htm new file mode 100644 index 0000000000..303eef7e92 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-multientry-arraykeypath.htm @@ -0,0 +1,23 @@ + + +IDBIndex.multiEntry: array keyPath with multiEntry + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex-multientry-big.htm b/testing/web-platform/tests/IndexedDB/idbindex-multientry-big.htm new file mode 100644 index 0000000000..43eb4034e7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-multientry-big.htm @@ -0,0 +1,59 @@ + + +IDBIndex.multiEntry - a 1000 entry multiEntry array + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex-multientry.htm b/testing/web-platform/tests/IndexedDB/idbindex-multientry.htm new file mode 100644 index 0000000000..d5aee222ea --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-multientry.htm @@ -0,0 +1,53 @@ + + +IDBIndex.multiEntry - adding keys + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex-objectStore-SameObject.html b/testing/web-platform/tests/IndexedDB/idbindex-objectStore-SameObject.html new file mode 100644 index 0000000000..018c818d1d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-objectStore-SameObject.html @@ -0,0 +1,28 @@ + + +IndexedDB: Verify [SameObject] behavior of IDBIndex's objectStore attribute + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-query-exception-order.html b/testing/web-platform/tests/IndexedDB/idbindex-query-exception-order.html new file mode 100644 index 0000000000..2c1a335112 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-query-exception-order.html @@ -0,0 +1,67 @@ + + +IndexedDB: IDBIndex query method Ordering + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-rename-abort.html b/testing/web-platform/tests/IndexedDB/idbindex-rename-abort.html new file mode 100644 index 0000000000..07863081b2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-rename-abort.html @@ -0,0 +1,110 @@ + + +IndexedDB: index renaming support in aborted transactions + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-rename-errors.html b/testing/web-platform/tests/IndexedDB/idbindex-rename-errors.html new file mode 100644 index 0000000000..2339cf1022 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-rename-errors.html @@ -0,0 +1,132 @@ + + +IndexedDB: index renaming error handling + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-rename.html b/testing/web-platform/tests/IndexedDB/idbindex-rename.html new file mode 100644 index 0000000000..db06a7e237 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-rename.html @@ -0,0 +1,301 @@ + + + +IndexedDB: index renaming support + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex-request-source.html b/testing/web-platform/tests/IndexedDB/idbindex-request-source.html new file mode 100644 index 0000000000..72688c467a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex-request-source.html @@ -0,0 +1,34 @@ + + +IndexedDB: The source of requests made against indexes + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_batchGetAll.tentative.any.js b/testing/web-platform/tests/IndexedDB/idbindex_batchGetAll.tentative.any.js new file mode 100644 index 0000000000..fe21445e83 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_batchGetAll.tentative.any.js @@ -0,0 +1,185 @@ +// META: title=Batch Get All Index +// META: script=resources/support.js + +'use strict'; + +const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); +const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); + +function batchgetall_test(storeName, func, name) { + indexeddb_test((t, connection, tx) => { + var store; + var index; + switch (storeName) { + case 'generated': + store = connection.createObjectStore( + 'generated', {autoIncrement: true, keyPath: 'id'}); + index = store.createIndex('test_idx', 'upper'); + alphabet.forEach(letter => { + store.put({ch: letter, upper: letter.toUpperCase()}); + }); + break; + case 'out-of-line': + store = connection.createObjectStore('out-of-line', null); + index = store.createIndex('test_idx', 'upper'); + alphabet.forEach(letter => { + store.put({ch: letter, upper: letter.toUpperCase()}, letter); + }); + break; + case 'out-of-line-not-unique': + store = connection.createObjectStore('out-of-line-not-unique', null); + index = store.createIndex('test_idx', 'half'); + alphabet.forEach(letter => { + if (letter <= 'd') + store.put({ch: letter, half: 'first'}, letter); + else if (letter < 'x') + store.put({ch: letter, half: 'second'}, letter); + else + store.put({ch: letter, half: 'third'}, letter); + }); + break; + case 'out-of-line-multi': + store = connection.createObjectStore('out-of-line-multi', null); + index = store.createIndex('test_idx', 'attribs', {multiEntry: true}); + alphabet.forEach(function(letter) { + let attrs = []; + if (['a', 'e', 'i', 'o', 'u'].indexOf(letter) != -1) + attrs.push('vowel'); + else + attrs.push('consonant'); + if (letter == 'a') + attrs.push('first'); + if (letter == 'z') + attrs.push('last'); + store.put({ch: letter, attribs: attrs}, letter); + }); + break; + case 'empty': + store = connection.createObjectStore('empty', null); + store.createIndex('test_idx', 'upper'); + break; + default: + t.fail(`Unsupported storeName: ${storeName}`); + } + }, func, name); +} + +function createBatchGetAllRequest(t, storeName, connection, ranges, maxCount) { + const transaction = connection.transaction(storeName, 'readonly'); + const store = transaction.objectStore(storeName); + const index = store.index('test_idx'); + const req = index.batchGetAll(ranges, maxCount); + req.onerror = t.unreached_func('batchGetsAll request should succeed'); + return req; +} + +function assertTwoDArrayEquals(result, expected) { + assert_equals(JSON.stringify(result), JSON.stringify(expected)); +} + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest(t, 'out-of-line', connection, ['C']); + req.onsuccess = t.step_func(evt => { + let expected = [[{'ch': 'c', 'upper': 'C'}]]; + let result = evt.target.result; + assert_class_string(result, 'Array', 'result should be an array'); + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Single getAll'); + +batchgetall_test('out-of-line', (t, connection) => { + const req = + createBatchGetAllRequest(t, 'out-of-line', connection, ['C', 'D', 'E']); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [ + [{'ch': 'c', 'upper': 'C'}], [{'ch': 'd', 'upper': 'D'}], + [{'ch': 'e', 'upper': 'E'}] + ]; + assert_class_string(result, 'Array', 'result should be an array'); + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Multiple getAll'); + +batchgetall_test('out-of-line', (t, connection) => { + var req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound('C', 'E')]); + req.onsuccess = t.step_func(function(evt) { + let result = evt.target.result; + let expected = [[ + {'ch': 'c', 'upper': 'C'}, {'ch': 'd', 'upper': 'D'}, + {'ch': 'e', 'upper': 'E'} + ]]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range'); + +batchgetall_test('out-of-line', (t, connection) => { + var req = createBatchGetAllRequest( + t, 'out-of-line', connection, + [IDBKeyRange.bound('C', 'M'), IDBKeyRange.bound('O', 'Z')], 3); + req.onsuccess = t.step_func(function(evt) { + let result = evt.target.result; + let expected = [ + [ + {'ch': 'c', 'upper': 'C'}, {'ch': 'd', 'upper': 'D'}, + {'ch': 'e', 'upper': 'E'} + ], + [ + {'ch': 'o', 'upper': 'O'}, {'ch': 'p', 'upper': 'P'}, + {'ch': 'q', 'upper': 'Q'} + ] + ]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range with maxCount'); + +batchgetall_test('out-of-line', (t, connection) => { + var req = createBatchGetAllRequest( + t, 'out-of-line', connection, ['Doesn\'t exist1', 'Doesn\'t exist2']); + req.onsuccess = t.step_func(function(evt) { + let result = evt.target.result; + let expected = [[], []]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Non existent key'); + +batchgetall_test('out-of-line-not-unique', (t, connection) => { + var req = createBatchGetAllRequest( + t, 'out-of-line-not-unique', connection, ['first', 'third']); + req.onsuccess = t.step_func(function(evt) { + let result = evt.target.result; + let expected = [ + [ + {'ch': 'a', 'half': 'first'}, {'ch': 'b', 'half': 'first'}, + {'ch': 'c', 'half': 'first'}, {'ch': 'd', 'half': 'first'} + ], + [ + {'ch': 'x', 'half': 'third'}, {'ch': 'y', 'half': 'third'}, + {'ch': 'z', 'half': 'third'} + ] + ]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Retrieve multiEntry key'); + +batchgetall_test('out-of-line-multi', (t, connection) => { + var req = + createBatchGetAllRequest(t, 'out-of-line-multi', connection, ['vowel']); + req.onsuccess = t.step_func(function(evt) { + let result = evt.target.result; + let expected = [[ + {'ch': 'a', 'attribs': ['vowel', 'first']}, + {'ch': 'e', 'attribs': ['vowel']}, {'ch': 'i', 'attribs': ['vowel']}, + {'ch': 'o', 'attribs': ['vowel']}, {'ch': 'u', 'attribs': ['vowel']} + ]]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Retrieve one key multiple values'); \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count.htm b/testing/web-platform/tests/IndexedDB/idbindex_count.htm new file mode 100644 index 0000000000..5b45b5223b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_count.htm @@ -0,0 +1,37 @@ + + +IDBIndex.count() - returns the number of records in the index + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count2.htm b/testing/web-platform/tests/IndexedDB/idbindex_count2.htm new file mode 100644 index 0000000000..2a68770df9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_count2.htm @@ -0,0 +1,37 @@ + + +IDBIndex.count() - returns the number of records that have keys within the range + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count3.htm b/testing/web-platform/tests/IndexedDB/idbindex_count3.htm new file mode 100644 index 0000000000..a94e898554 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_count3.htm @@ -0,0 +1,28 @@ + + +IDBIndex.count() - returns the number of records that have keys with the key + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count4.htm b/testing/web-platform/tests/IndexedDB/idbindex_count4.htm new file mode 100644 index 0000000000..ce19968bf1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_count4.htm @@ -0,0 +1,37 @@ + + +IDBIndex.count() - throw DataError when using invalid key + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get.htm b/testing/web-platform/tests/IndexedDB/idbindex_get.htm new file mode 100644 index 0000000000..861d7e54d1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get.htm @@ -0,0 +1,36 @@ + + +IDBIndex.get() - returns the record + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get2.htm b/testing/web-platform/tests/IndexedDB/idbindex_get2.htm new file mode 100644 index 0000000000..66d2fee5cb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get2.htm @@ -0,0 +1,39 @@ + + +IDBIndex.get() - returns the record where the index contains duplicate values + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get3.htm b/testing/web-platform/tests/IndexedDB/idbindex_get3.htm new file mode 100644 index 0000000000..62a0a4f3ba --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get3.htm @@ -0,0 +1,27 @@ + + +IDBIndex.get() - attempt to retrieve a record that doesn't exist + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get4.htm b/testing/web-platform/tests/IndexedDB/idbindex_get4.htm new file mode 100644 index 0000000000..369c288071 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get4.htm @@ -0,0 +1,39 @@ + + +IDBIndex.get() - returns the record with the first key in the range + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get5.htm b/testing/web-platform/tests/IndexedDB/idbindex_get5.htm new file mode 100644 index 0000000000..9b0bfe4b35 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get5.htm @@ -0,0 +1,26 @@ + + +IDBIndex.get() - throw DataError when using invalid key + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get6.htm b/testing/web-platform/tests/IndexedDB/idbindex_get6.htm new file mode 100644 index 0000000000..ca51b8492f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get6.htm @@ -0,0 +1,29 @@ + + +IDBIndex.get() - throw InvalidStateError when the index is deleted + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get7.htm b/testing/web-platform/tests/IndexedDB/idbindex_get7.htm new file mode 100644 index 0000000000..5e9511a0b1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get7.htm @@ -0,0 +1,32 @@ + + +IDBIndex.get() - throw TransactionInactiveError on aborted transaction + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get8.htm b/testing/web-platform/tests/IndexedDB/idbindex_get8.htm new file mode 100644 index 0000000000..a2565419b9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_get8.htm @@ -0,0 +1,27 @@ + + +IDBIndex.get() - throw InvalidStateError on index deleted by aborted upgrade + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getAll.html b/testing/web-platform/tests/IndexedDB/idbindex_getAll.html new file mode 100644 index 0000000000..bd2a021386 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getAll.html @@ -0,0 +1,216 @@ + +IndexedDB: Test IDBIndex.getAll. + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html b/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html new file mode 100644 index 0000000000..5640bfdee7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html @@ -0,0 +1,192 @@ + +IndexedDB: Test IDBIndex.getAllKeys. + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey.htm new file mode 100644 index 0000000000..101e8f06b7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey.htm @@ -0,0 +1,38 @@ + + +IDBIndex.getKey() - returns the record's primary key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm new file mode 100644 index 0000000000..488368d7f4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm @@ -0,0 +1,39 @@ + + +IDBIndex.getKey() - returns the record's primary key where the index contains duplicate values + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm new file mode 100644 index 0000000000..40ed76d174 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm @@ -0,0 +1,28 @@ + + +IDBIndex.getKey() - attempt to retrieve the primary key of a record that doesn't exist + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm new file mode 100644 index 0000000000..8c81a272ae --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm @@ -0,0 +1,38 @@ + + +IDBIndex.getKey() - returns the key of the first record within the range + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm new file mode 100644 index 0000000000..3155131397 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm @@ -0,0 +1,26 @@ + + +IDBIndex.getKey() - throw DataError when using invalid key + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm new file mode 100644 index 0000000000..b71967d4fb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm @@ -0,0 +1,29 @@ + + +IDBIndex.getKey() - throw InvalidStateError when the index is deleted + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm new file mode 100644 index 0000000000..6a64df3116 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm @@ -0,0 +1,32 @@ + + +IDBIndex.getKey() - throw TransactionInactiveError on aborted transaction + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm new file mode 100644 index 0000000000..cf0affb210 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm @@ -0,0 +1,27 @@ + + +IDBIndex.getKey() - throw InvalidStateError on index deleted by aborted upgrade + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_indexNames.htm b/testing/web-platform/tests/IndexedDB/idbindex_indexNames.htm new file mode 100644 index 0000000000..7da76021c8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_indexNames.htm @@ -0,0 +1,34 @@ + + +IDBIndex.getKey() - returns the record's primary key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_keyPath.any.js b/testing/web-platform/tests/IndexedDB/idbindex_keyPath.any.js new file mode 100644 index 0000000000..40721462a3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_keyPath.any.js @@ -0,0 +1,74 @@ +// META: title=IndexedDB: IDBIndex keyPath attribute +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store', {keyPath: ['a', 'b']}); + store.createIndex('index', ['a', 'b']); + }, + (t, db) => { + const tx = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + const index = store.index('index'); + assert_equals(typeof index.keyPath, 'object', 'keyPath is an object'); + assert_true(Array.isArray(index.keyPath), 'keyPath is an array'); + + assert_equals( + index.keyPath, index.keyPath, + 'Same object instance is returned each time keyPath is inspected'); + + const tx2 = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const store2 = tx2.objectStore('store'); + const index2 = store2.index('index'); + + assert_not_equals( + index.keyPath, index2.keyPath, + 'Different instances are returned from different index instances.'); + + t.done(); + }, + `IDBIndex's keyPath attribute returns the same object.`); + + indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store', {autoIncrement: true}); + store.createIndex('index', ['a']); + + store.add({a: 1, b: 2, c: 3}) + }, + (t, db) => { + const tx = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + const index = store.index('index'); + const cursorReq = index.openCursor(); + + cursorReq.onsuccess = t.step_func_done((e) => { + const expectedKeyValue = [1]; + const actualKeyValue = e.target.result.key; + + assert_array_equals(actualKeyValue, expectedKeyValue, "An array keypath should yield an array key"); + }); + }, + `IDBIndex's keyPath array with a single value`); + + indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store', {autoIncrement: true}); + store.createIndex('index', ['a', 'b']); + + store.add({a: 1, b: 2, c: 3}) + }, + (t, db) => { + const tx = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + const index = store.index('index'); + const cursorReq = index.openCursor(); + + cursorReq.onsuccess = t.step_func_done((e) => { + const expectedKeyValue = [1, 2]; + const actualKeyValue = e.target.result.key; + + assert_array_equals(actualKeyValue, expectedKeyValue, "An array keypath should yield an array key"); + }); + }, + `IDBIndex's keyPath array with multiple values`); diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openCursor.htm b/testing/web-platform/tests/IndexedDB/idbindex_openCursor.htm new file mode 100644 index 0000000000..7baf2cf9ed --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openCursor.htm @@ -0,0 +1,29 @@ + + +IDBIndex.openCursor() - throw InvalidStateError when the index is deleted + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openCursor2.htm b/testing/web-platform/tests/IndexedDB/idbindex_openCursor2.htm new file mode 100644 index 0000000000..88dcdbac36 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openCursor2.htm @@ -0,0 +1,32 @@ + + +IDBIndex.openCursor() - throw TransactionInactiveError on aborted transaction + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openCursor3.htm b/testing/web-platform/tests/IndexedDB/idbindex_openCursor3.htm new file mode 100644 index 0000000000..91a98464e0 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openCursor3.htm @@ -0,0 +1,27 @@ + + +IDBIndex.openCursor() - throw InvalidStateError on index deleted by aborted upgrade + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor.htm b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor.htm new file mode 100644 index 0000000000..9436684c3d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor.htm @@ -0,0 +1,28 @@ + + +IDBIndex.openKeyCursor() - throw DataError when using a invalid key + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor2.htm b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor2.htm new file mode 100644 index 0000000000..ec97345a87 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor2.htm @@ -0,0 +1,29 @@ + + +IDBIndex.openKeyCursor() - throw InvalidStateError when the index is deleted + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor3.htm b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor3.htm new file mode 100644 index 0000000000..c7416be38d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor3.htm @@ -0,0 +1,32 @@ + + +IDBIndex.openKeyCursor() - throw TransactionInactiveError on aborted transaction + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor4.htm b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor4.htm new file mode 100644 index 0000000000..bcc1511c90 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_openKeyCursor4.htm @@ -0,0 +1,27 @@ + + +IDBIndex.openKeyCursor() - throw InvalidStateError on index deleted by aborted upgrade + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbindex_reverse_cursor.any.js b/testing/web-platform/tests/IndexedDB/idbindex_reverse_cursor.any.js new file mode 100644 index 0000000000..88c367466d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_reverse_cursor.any.js @@ -0,0 +1,60 @@ +// META: title=Reverse Cursor Validity +// META: script=resources/support-promises.js + +async function iterateAndReturnAllCursorResult(testCase, cursor) { + return new Promise((resolve, reject) => { + let results = []; + cursor.onsuccess = testCase.step_func(function(e) { + let cursor = e.target.result; + if (!cursor) { + resolve(results); + return; + } + results.push(cursor.value); + cursor.continue(); + }); + cursor.onerror = reject; + }); +} + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + db.createObjectStore('objectStore', {keyPath: 'key'}) + .createIndex('index', 'indexedOn'); + }); + const txn1 = db.transaction(['objectStore'], 'readwrite'); + txn1.objectStore('objectStore').add({'key': 'firstItem', 'indexedOn': 3}); + const txn2 = db.transaction(['objectStore'], 'readwrite'); + txn2.objectStore('objectStore').put({'key': 'firstItem', 'indexedOn': -1}); + const txn3= db.transaction(['objectStore'], 'readwrite'); + txn3.objectStore('objectStore').add({'key': 'secondItem', 'indexedOn': 2}); + + const txn4 = db.transaction(['objectStore'], 'readonly'); + cursor = txn4.objectStore('objectStore').index('index').openCursor(IDBKeyRange.bound(0, 10), "prev"); + let results = await iterateAndReturnAllCursorResult(testCase, cursor); + + assert_equals(results.length, 1); + + await promiseForTransaction(testCase, txn4); + db.close(); +}, 'Reverse cursor sees update from separate transactions.'); + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + db.createObjectStore('objectStore', {keyPath: 'key'}) + .createIndex('index', 'indexedOn'); + }); + const txn = db.transaction(['objectStore'], 'readwrite'); + txn.objectStore('objectStore').add({'key': '1', 'indexedOn': 2}); + txn.objectStore('objectStore').put({'key': '1', 'indexedOn': -1}); + txn.objectStore('objectStore').add({'key': '2', 'indexedOn': 1}); + + const txn2 = db.transaction(['objectStore'], 'readonly'); + cursor = txn2.objectStore('objectStore').index('index').openCursor(IDBKeyRange.bound(0, 10), "prev"); + let results = await iterateAndReturnAllCursorResult(testCase, cursor); + + assert_equals(1, results.length); + + await promiseForTransaction(testCase, txn2); + db.close(); +}, 'Reverse cursor sees in-transaction update.'); diff --git a/testing/web-platform/tests/IndexedDB/idbindex_tombstones.any.js b/testing/web-platform/tests/IndexedDB/idbindex_tombstones.any.js new file mode 100644 index 0000000000..7a2dcc9cb1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbindex_tombstones.any.js @@ -0,0 +1,66 @@ +// META: title=Index Tombstones +// META: script=resources/support-promises.js + +// This test is used to trigger a special case in Chrome with how it deals with +// index creation & modification. This had caused issues before. +// See https://crbug.com/1033996 + +async function iterateAndReturnAllCursorResult(testCase, cursorRequest) { + return new Promise((resolve, reject) => { + let results = []; + cursorRequest.onsuccess = testCase.step_func(function(event) { + const cursor = event.target.result; + if (!cursor) { + resolve(results); + return; + } + results.push(cursor.value); + cursor.continue(); + }); + cursorRequest.onerror = reject; + }); +} + +async function createTombstones(testCase, db) { + const txn1 = db.transaction(['objectStore'], 'readwrite'); + txn1.objectStore('objectStore').add({key: 'firstItem', indexedOn: 1}); + txn1.objectStore('objectStore').add({key: 'secondItem', indexedOn: 2}); + txn1.objectStore('objectStore').add({key: 'thirdItem', indexedOn: 3}); + const txn2 = db.transaction(['objectStore'], 'readwrite'); + txn2.objectStore('objectStore').put({key: 'firstItem', indexedOn: -10}); + txn2.objectStore('objectStore').put({key: 'secondItem', indexedOn: 4}); + txn2.objectStore('objectStore').put({key: 'thirdItem', indexedOn: 10}); + await promiseForTransaction(testCase, txn1); + await promiseForTransaction(testCase, txn2); +} + +async function run_test(testCase, transactionMode, direction) { + const db = await createDatabase(testCase, db => { + db.createObjectStore('objectStore', {keyPath: 'key'}) + .createIndex('index', 'indexedOn'); + }); + await createTombstones(testCase, db); + + const txn = db.transaction(['objectStore'], transactionMode); + cursor = txn.objectStore('objectStore').index('index').openCursor( + IDBKeyRange.bound(-11, 11), direction); + let results = await iterateAndReturnAllCursorResult(testCase, cursor); + assert_equals(results.length, 3); + db.close(); +} + +promise_test(async testCase => { + await run_test(testCase, 'readonly', 'next'); +}, 'Forward iteration over an index in a readonly transaction'); + +promise_test(async testCase => { + await run_test(testCase, 'readonly', 'prev'); +}, 'Backward iteration over an index in a readonly transaction'); + +promise_test(async testCase => { + await run_test(testCase, 'readwrite', 'next'); +}, 'Forward iteration over an index in a readwrite transaction'); + +promise_test(async testCase => { + await run_test(testCase, 'readwrite', 'prev'); +}, 'Backward iteration over an index in a readwrite transaction'); diff --git a/testing/web-platform/tests/IndexedDB/idbkeyrange-includes.htm b/testing/web-platform/tests/IndexedDB/idbkeyrange-includes.htm new file mode 100644 index 0000000000..96769ae0a9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbkeyrange-includes.htm @@ -0,0 +1,140 @@ + + +IndexedDB: IDBKeyRange.includes() + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbkeyrange.htm b/testing/web-platform/tests/IndexedDB/idbkeyrange.htm new file mode 100644 index 0000000000..a387dc74e6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbkeyrange.htm @@ -0,0 +1,94 @@ + + +IDBKeyRange Tests + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbkeyrange_incorrect.htm b/testing/web-platform/tests/IndexedDB/idbkeyrange_incorrect.htm new file mode 100644 index 0000000000..ec72a7e7ae --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbkeyrange_incorrect.htm @@ -0,0 +1,92 @@ + + + + + + IDBKeyRange Tests - Incorrect + + + + + + + + + + + + +
+ + \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-add-put-exception-order.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-add-put-exception-order.html new file mode 100644 index 0000000000..bbcc120a7e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-add-put-exception-order.html @@ -0,0 +1,74 @@ + + +IndexedDB: IDBObjectStore add()/put() Exception Ordering + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-clear-exception-order.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-clear-exception-order.html new file mode 100644 index 0000000000..206d21300a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-clear-exception-order.html @@ -0,0 +1,51 @@ + + +IndexedDB: IDBObjectStore clear() Exception Ordering + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-cross-realm-methods.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-cross-realm-methods.html new file mode 100644 index 0000000000..edb4b9b373 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-cross-realm-methods.html @@ -0,0 +1,154 @@ + + +Cross-realm IDBObjectStore methods from detached iframe work as expected + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-delete-exception-order.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-delete-exception-order.html new file mode 100644 index 0000000000..aa6ae1c285 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-delete-exception-order.html @@ -0,0 +1,69 @@ + + +IndexedDB: IDBObjectStore delete() Exception Ordering + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-deleteIndex-exception-order.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-deleteIndex-exception-order.html new file mode 100644 index 0000000000..48bbe40c4d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-deleteIndex-exception-order.html @@ -0,0 +1,68 @@ + + +IndexedDB: IDBObjectStore deleteIndex() Exception Ordering + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-getAll-enforcerange.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-getAll-enforcerange.html new file mode 100644 index 0000000000..c408aff715 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-getAll-enforcerange.html @@ -0,0 +1,25 @@ + + +IndexedDB: IDBObjectStore getAll() uses [EnforceRange] + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-getAllKeys-enforcerange.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-getAllKeys-enforcerange.html new file mode 100644 index 0000000000..f8e77aecba --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-getAllKeys-enforcerange.html @@ -0,0 +1,25 @@ + + +IndexedDB: IDBIObjectStore getAllKeys() uses [EnforceRange] + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-index-finished.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-index-finished.html new file mode 100644 index 0000000000..a45c66ed70 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-index-finished.html @@ -0,0 +1,26 @@ + + +IndexedDB: IDBObjectStore index() when transaction is finished + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-query-exception-order.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-query-exception-order.html new file mode 100644 index 0000000000..53ae04b088 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-query-exception-order.html @@ -0,0 +1,65 @@ + + +IndexedDB: IDBObjectStore query method Ordering + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-abort.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-abort.html new file mode 100644 index 0000000000..b4bfc914ed --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-abort.html @@ -0,0 +1,120 @@ + + +IndexedDB: object store renaming support in aborted transactions + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-errors.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-errors.html new file mode 100644 index 0000000000..de72c5cf48 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-errors.html @@ -0,0 +1,121 @@ + + +IndexedDB: object store renaming error handling + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-store.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-store.html new file mode 100644 index 0000000000..649f9faef3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-rename-store.html @@ -0,0 +1,369 @@ + + + +IndexedDB: object store renaming support + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-request-source.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-request-source.html new file mode 100644 index 0000000000..c5947564ea --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-request-source.html @@ -0,0 +1,39 @@ + + +IndexedDB: The source of requests made against object stores + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore-transaction-SameObject.html b/testing/web-platform/tests/IndexedDB/idbobjectstore-transaction-SameObject.html new file mode 100644 index 0000000000..2b5a027c45 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore-transaction-SameObject.html @@ -0,0 +1,26 @@ + + +IndexedDB: Verify [SameObject] behavior of IDBObjectStore's transaction attribute + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm new file mode 100644 index 0000000000..33ea094388 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm @@ -0,0 +1,35 @@ + + +IDBObjectStore.add() - add with an inline key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm new file mode 100644 index 0000000000..d84004250d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.add() - Attempt to call 'add' without an key parameter when the object store uses out-of-line keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm new file mode 100644 index 0000000000..b1d9f71fd0 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.add() - Attempt to add a record where the record's key does not meet the constraints of a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm new file mode 100644 index 0000000000..fc5a7bcebb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.add() - Attempt to add a record where the record's in-line key is not defined + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm new file mode 100644 index 0000000000..ec82989b01 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.add() - Attempt to add a record where the out of line key provided does not meet the constraints of a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm new file mode 100644 index 0000000000..10bf8a18ce --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm @@ -0,0 +1,32 @@ + + +IDBObjectStore.add() - Add a record where a value being indexed does not meet the constraints of a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm new file mode 100644 index 0000000000..a6f897911b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm @@ -0,0 +1,31 @@ + + +IDBObjectStore.add() - If the transaction this IDBObjectStore belongs to has its mode set to readonly, throw ReadOnlyError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm new file mode 100644 index 0000000000..453082340f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm @@ -0,0 +1,25 @@ + + +IDBObjectStore.add() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm new file mode 100644 index 0000000000..6f6e3eab27 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm @@ -0,0 +1,36 @@ + + +IDBObjectStore.add() - add with an out-of-line key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm new file mode 100644 index 0000000000..9209e7505d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm @@ -0,0 +1,39 @@ + + +IDBObjectStore.add() - record with same key already exists + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm new file mode 100644 index 0000000000..35d88fe3a2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm @@ -0,0 +1,40 @@ + + +IDBObjectStore.add() - add where an index has unique:true specified + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm new file mode 100644 index 0000000000..0cb124ff4b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm @@ -0,0 +1,34 @@ + + +IDBObjectStore.add() - object store's key path is an object attribute + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm new file mode 100644 index 0000000000..b6ff5a5a50 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.add() - autoIncrement and inline keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm new file mode 100644 index 0000000000..cd63917c3f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.add() - autoIncrement and out-of-line keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm new file mode 100644 index 0000000000..c827adf6ef --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.add() - object store has autoIncrement:true and the key path is an object attribute + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm new file mode 100644 index 0000000000..27061afd9c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm @@ -0,0 +1,27 @@ + + +IDBObjectStore.add() - Attempt to add a record that does not meet the constraints of an object store's inline key requirements + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll.tentative.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll.tentative.any.js new file mode 100644 index 0000000000..3aeb855359 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll.tentative.any.js @@ -0,0 +1,143 @@ +// META: title=Batch Get All +// META: script=resources/support.js + +'use strict'; + +const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); + +function batchgetall_test(storeName, func, name) { + indexeddb_test((t, connection, tx) => { + var store; + switch (storeName) { + case 'generated': + store = connection.createObjectStore( + 'generated', {autoIncrement: true, keyPath: 'id'}); + alphabet.forEach(letter => { + store.put({ch: letter}); + }); + break; + case 'out-of-line': + store = connection.createObjectStore('out-of-line', null); + alphabet.forEach(letter => { + store.put(`value-${letter}`, letter); + }); + break; + case 'empty': + store = connection.createObjectStore('empty', null); + break; + default: + t.fail(`Unsupported storeName: ${storeName}`); + } + }, func, name); +} + +function createBatchGetAllRequest(t, storeName, connection, ranges, maxCount) { + const transaction = connection.transaction(storeName, 'readonly'); + const store = transaction.objectStore(storeName); + const req = store.batchGetAll(ranges, maxCount); + req.onerror = t.unreached_func('batchGetAll request should succeed'); + return req; +} + +function assertTwoDArrayEquals(result, expected) { + assert_equals(JSON.stringify(result), JSON.stringify(expected)); +} + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest(t, 'out-of-line', connection, ['c']); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [['value-c']]; + assertTwoDArrayEquals(result, expected) + t.done(); + }); +}, 'Single item get'); + +batchgetall_test('empty', (t, connection) => { + const req = createBatchGetAllRequest(t, 'empty', connection); + req.onsuccess = t.step_func(evt => { + assert_array_equals( + evt.target.result, [], + 'getAll() on empty object store should return an empty array'); + t.done(); + }); +}, 'batchGetAll on empty object store'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, ['c', 'dd', 'e', 'ff']); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [['value-c'], [], ['value-e'], []]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'batchGetAll with non-existing values'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound('a', 'z')], 5); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [['value-a', 'value-b', 'value-c', 'value-d', 'value-e']]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range with maxCount'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound('a', 'e')]); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [['value-a', 'value-b', 'value-c', 'value-d', 'value-e']]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range'); + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest(t, 'out-of-line', connection, [ + IDBKeyRange.bound('g', 'k', false, true), + IDBKeyRange.bound('g', 'k', true, false) + ]); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [ + ['value-g', 'value-h', 'value-i', 'value-j'], + ['value-h', 'value-i', 'value-j', 'value-k'] + ]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get upper/lower excluded'); + +batchgetall_test('generated', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'generated', connection, + [IDBKeyRange.bound(4, 15), IDBKeyRange.bound(5, 15)], 3); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [ + [{ch: 'd', id: 4}, {ch: 'e', id: 5}, {ch: 'f', id: 6}], + [{ch: 'e', id: 5}, {ch: 'f', id: 6}, {ch: 'g', id: 7}] + ]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range (generated) with maxCount'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound('a', 'e')], 0); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [['value-a', 'value-b', 'value-c', 'value-d', 'value-e']]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'zero maxCount'); \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll_largeValue.tentative.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll_largeValue.tentative.any.js new file mode 100644 index 0000000000..497196e642 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_batchGetAll_largeValue.tentative.any.js @@ -0,0 +1,118 @@ +// META: title=Batch Get All (big value) +// META: script=resources/support.js +// META: script=resources/support-promises.js + +'use strict'; + +// engines that have special code paths for large values. +const wrapThreshold = 128 * 1024; +const keys = Array.from({length: 10}, (item, index) => index); +const values = + Array.from(keys, (item, index) => largeValue(wrapThreshold, index)); + +function batchgetall_test(storeName, func, name) { + indexeddb_test((t, connection, tx) => { + let store = connection.createObjectStore(storeName, null); + for (let i = 0; i < keys.length; i++) { + store.put(values[i], keys[i]) + } + }, func, name); +} + +function createBatchGetAllRequest(t, storeName, connection, ranges, maxCount) { + const transaction = connection.transaction(storeName, 'readonly'); + const store = transaction.objectStore(storeName); + const req = store.batchGetAll(ranges, maxCount); + req.onerror = t.unreached_func('batchGetAll request should succeed'); + return req; +} + +function assertTwoDArrayEquals(result, expected) { + assert_equals(JSON.stringify(result), JSON.stringify(expected)); +} + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest(t, 'out-of-line', connection, [2]); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [[values[2]]]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Single item get'); + + +batchgetall_test('empty', (t, connection) => { + const req = createBatchGetAllRequest(t, 'empty', connection); + req.onsuccess = t.step_func(evt => { + assert_array_equals( + evt.target.result, [], + 'getAll() on empty object store should return an empty array'); + t.done(); + }); +}, 'batchGetAll on empty object store'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = + createBatchGetAllRequest(t, 'out-of-line', connection, [1, 'a', 4, 'z']); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [[values[1]], [], [values[4]], []]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'batchGetAll with non-existing values'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound(0, 10)], 5); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [[values[0], values[1], values[2], values[3], values[4]]]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range with maxCount'); + + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound(0, 4)]); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [[values[0], values[1], values[2], values[3], values[4]]]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get bound range'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest(t, 'out-of-line', connection, [ + IDBKeyRange.bound(0, 4, false, true), IDBKeyRange.bound(0, 4, true, false) + ]); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [ + [values[0], values[1], values[2], values[3]], + [values[1], values[2], values[3], values[4]] + ]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'Get upper/lower excluded'); + + +batchgetall_test('out-of-line', (t, connection) => { + const req = createBatchGetAllRequest( + t, 'out-of-line', connection, [IDBKeyRange.bound(1, 4)], 0); + req.onsuccess = t.step_func(evt => { + let result = evt.target.result; + let expected = [[values[1], values[2], values[3], values[4]]]; + assertTwoDArrayEquals(result, expected); + t.done(); + }); +}, 'zero maxCount'); \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_clear.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear.htm new file mode 100644 index 0000000000..51b6da72d7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear.htm @@ -0,0 +1,41 @@ + + +IDBObjectStore.clear() - Verify clear removes all records + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_clear2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear2.htm new file mode 100644 index 0000000000..a4f15bde02 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear2.htm @@ -0,0 +1,43 @@ + + +IDBObjectStore.clear() - clear removes all records from an index + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_clear3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear3.htm new file mode 100644 index 0000000000..2bb44ec31c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear3.htm @@ -0,0 +1,36 @@ + + +IDBObjectStore.clear() - If the transaction this IDBObjectStore belongs to has its mode set to readonly, throw ReadOnlyError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_clear4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear4.htm new file mode 100644 index 0000000000..f5e1cad563 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_clear4.htm @@ -0,0 +1,25 @@ + + +IDBObjectStore.clear() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_count.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_count.htm new file mode 100644 index 0000000000..6466d58041 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_count.htm @@ -0,0 +1,35 @@ + + +IDBObjectStore.count() - returns the number of records in the object store + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_count2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_count2.htm new file mode 100644 index 0000000000..6152eaf76e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_count2.htm @@ -0,0 +1,35 @@ + + +IDBObjectStore.count() - returns the number of records that have keys within the range + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_count3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_count3.htm new file mode 100644 index 0000000000..3d5fd17a22 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_count3.htm @@ -0,0 +1,31 @@ + + +IDBObjectStore.count() - returns the number of records that have keys with the key + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_count4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_count4.htm new file mode 100644 index 0000000000..c328a91e33 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_count4.htm @@ -0,0 +1,25 @@ + + +IDBObjectStore.count() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex.htm new file mode 100644 index 0000000000..ebd6377e49 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex.htm @@ -0,0 +1,30 @@ + + +IDBObjectStore.createIndex() - returns an IDBIndex and the properties are set correctly + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex10.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex10.htm new file mode 100644 index 0000000000..46678b1b6c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex10.htm @@ -0,0 +1,24 @@ + + +IDBDatabase.createIndex() - If an index with the name name already exists in this object store, the implementation must throw a DOMException of type ConstraintError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex11.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex11.htm new file mode 100644 index 0000000000..e458977212 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex11.htm @@ -0,0 +1,23 @@ + + +IDBDatabase.createIndex() - If keyPath is not a valid key path, the implementation must throw a DOMException of type SyntaxError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex12.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex12.htm new file mode 100644 index 0000000000..a74ac6f5a1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex12.htm @@ -0,0 +1,31 @@ + + +IDBDatabase.createIndex() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex13.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex13.htm new file mode 100644 index 0000000000..673a54fb00 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex13.htm @@ -0,0 +1,31 @@ + + +IDBDatabase.createIndex() - Operate out versionchange throw InvalidStateError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm new file mode 100644 index 0000000000..53aaec2a87 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm @@ -0,0 +1,89 @@ + +IndexedDB: Exception Order of IDBObjectStore.createIndex() + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex15-autoincrement.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex15-autoincrement.htm new file mode 100644 index 0000000000..679b5d05aa --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex15-autoincrement.htm @@ -0,0 +1,106 @@ + + +IDBObjectStore.createIndex() - AutoIncrement in Compound Index + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex2.htm new file mode 100644 index 0000000000..cac6c79967 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex2.htm @@ -0,0 +1,41 @@ + + +IDBObjectStore.createIndex() - attempt to create an index that requires unique values on an object store already contains duplicates + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex3-usable-right-away.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex3-usable-right-away.htm new file mode 100644 index 0000000000..510f17f173 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex3-usable-right-away.htm @@ -0,0 +1,38 @@ + + +IDBObjectStore.createIndex() - the index is usable right after being made + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex4-deleteIndex-event_order.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex4-deleteIndex-event_order.htm new file mode 100644 index 0000000000..bc5915f54a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex4-deleteIndex-event_order.htm @@ -0,0 +1,66 @@ + + +IDBObjectStore.createIndex() - Event ordering for a later deleted index + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex5-emptykeypath.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex5-emptykeypath.htm new file mode 100644 index 0000000000..b004a218ff --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex5-emptykeypath.htm @@ -0,0 +1,38 @@ + + +IDBObjectStore.createIndex() - empty keyPath + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm new file mode 100644 index 0000000000..db7398d360 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex6-event_order.htm @@ -0,0 +1,75 @@ + + +IDBObjectStore.createIndex() - event order when unique constraint is triggered + + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex7-event_order.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex7-event_order.htm new file mode 100644 index 0000000000..9be4c563f4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex7-event_order.htm @@ -0,0 +1,80 @@ + + +IDBObjectStore.createIndex() - Event ordering for ConstraintError on request + + + + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex8-valid_keys.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex8-valid_keys.htm new file mode 100644 index 0000000000..10c2b29c57 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex8-valid_keys.htm @@ -0,0 +1,54 @@ + + +IDBObjectStore.createIndex() - index can be valid keys + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex9-emptyname.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex9-emptyname.htm new file mode 100644 index 0000000000..3e1ef3c600 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex9-emptyname.htm @@ -0,0 +1,41 @@ + + +IDBObjectStore.createIndex() - empty name + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm new file mode 100644 index 0000000000..880309d01a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm @@ -0,0 +1,46 @@ + + +IDBObjectStore.delete() - delete removes record (inline keys) + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm new file mode 100644 index 0000000000..eb71169905 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm @@ -0,0 +1,27 @@ + + +IDBObjectStore.delete() - key doesn't match any records + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm new file mode 100644 index 0000000000..1ea9dd9958 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.delete() - object store's key path is an object attribute + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm new file mode 100644 index 0000000000..9d074bff85 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm @@ -0,0 +1,48 @@ + + +IDBObjectStore.delete() - delete removes record (out-of-line keys) + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm new file mode 100644 index 0000000000..f7696e6efa --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm @@ -0,0 +1,32 @@ + +IDBObjectStore.delete() - removes all of the records in the range + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm new file mode 100644 index 0000000000..70d8af32fe --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm @@ -0,0 +1,36 @@ + + +IDBObjectStore.delete() - If the transaction this IDBObjectStore belongs to has its mode set to readonly, throw ReadOnlyError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm new file mode 100644 index 0000000000..a65885cc2b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm @@ -0,0 +1,27 @@ + + +IDBObjectStore.delete() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm new file mode 100644 index 0000000000..f12af6fc53 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm @@ -0,0 +1,44 @@ + + +IDBObjectStore.deleteIndex() - removes the index + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm new file mode 100644 index 0000000000..5ccc8fdb1b --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm @@ -0,0 +1,50 @@ + + +Attempting to use deleted IDBObjectStore + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get.any.js new file mode 100644 index 0000000000..638ec6e814 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get.any.js @@ -0,0 +1,28 @@ +// META: title=IDBObjectStore.get() - key is a number +// META: script=resources/support.js +// @author Microsoft + +"use strict"; + +let db; +const t = async_test(); +const record = { key: 3.14159265, property: "data" }; + +const open_rq = createdb(t); +open_rq.onupgradeneeded = event => { + db = event.target.result; + db.createObjectStore("store", { keyPath: "key" }) + .add(record); +} + +open_rq.onsuccess = event => { + const rq = db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store") + .get(record.key); + + rq.onsuccess = t.step_func(event => { + assert_equals(event.target.result.key, record.key); + assert_equals(event.target.result.property, record.property); + t.done(); + }); +} diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get2.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get2.any.js new file mode 100644 index 0000000000..488a9043ef --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get2.any.js @@ -0,0 +1,28 @@ +// META: title=IDBObjectStore.get() - key is a string +// META: script=resources/support.js +// @author Microsoft + +"use strict"; + +let db; +const t = async_test(); +const record = { key: "this is a key that's a string", property: "data" }; + +const open_rq = createdb(t); +open_rq.onupgradeneeded = event => { + db = event.target.result; + db.createObjectStore("store", { keyPath: "key" }) + .add(record); +}; + +open_rq.onsuccess = event => { + const rq = db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store") + .get(record.key); + + rq.onsuccess = t.step_func(event => { + assert_equals(event.target.result.key, record.key); + assert_equals(event.target.result.property, record.property); + t.done(); + }); +}; diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get3.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get3.any.js new file mode 100644 index 0000000000..3ab6c7c754 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get3.any.js @@ -0,0 +1,28 @@ +// META: title=IDBObjectStore.get() - key is a Date +// META: script=resources/support.js +// @author Microsoft + +"use strict"; + +let db; +const t = async_test(); +const record = { key: new Date(), property: "data" }; + +const open_rq = createdb(t); +open_rq.onupgradeneeded = event => { + db = event.target.result; + db.createObjectStore("store", { keyPath: "key" }) + .add(record); +}; + +open_rq.onsuccess = event => { + const rq = db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store") + .get(record.key); + + rq.onsuccess = t.step_func(event => { + assert_equals(event.target.result.key.valueOf(), record.key.valueOf()); + assert_equals(event.target.result.property, record.property); + t.done(); + }); +}; diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get4.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get4.any.js new file mode 100644 index 0000000000..a69717ce4e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get4.any.js @@ -0,0 +1,19 @@ +// META: title=IDBObjectStore.get() - attempt to retrieve a record that doesn't exist +// META: script=resources/support.js +// @author Microsoft + +"use strict"; + +let db; +const t = async_test(); + +const open_rq = createdb(t); +open_rq.onupgradeneeded = event => { + db = event.target.result; + const rq = db.createObjectStore("store", { keyPath: "key" }) + .get(1); + rq.onsuccess = t.step_func(event => { + assert_equals(event.target.results, undefined); + t.done(); + }); +}; diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get5.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get5.any.js new file mode 100644 index 0000000000..1e3bb0fe64 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get5.any.js @@ -0,0 +1,29 @@ +// META: title=IDBObjectStore.get() - returns the record with the first key in the range +// META: script=resources/support.js +// @author Microsoft + +"use strict"; + +let db; +const t = async_test(); +const open_rq = createdb(t); + +open_rq.onupgradeneeded = event => { + db = event.target.result; + const os = db.createObjectStore("store"); + + for (let i = 0; i < 10; i++) { + os.add(`data${i}`, i); + } +}; + +open_rq.onsuccess = event => { + const rq = db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store") + .get(IDBKeyRange.bound(3, 6)); + + rq.onsuccess = t.step_func(event => { + assert_equals(event.target.result, "data3", "get(3-6)"); + t.done(); + }); +}; diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get6.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get6.any.js new file mode 100644 index 0000000000..e20af4afc9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get6.any.js @@ -0,0 +1,24 @@ +// META: title=IDBObjectStore.get() - throw TransactionInactiveError on aborted transaction +// META: script=resources/support.js +// @author YuichiNukiyama + +"use strict"; + +let db; +const t = async_test(); + +const open_rq = createdb(t); +open_rq.onupgradeneeded = event => { + db = event.target.result; + db.createObjectStore("store", { keyPath: "key" }); +}; + +open_rq.onsuccess = event => { + const store = db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store"); + store.transaction.abort(); + assert_throws_dom("TransactionInactiveError", function () { + store.get(1); + }, "throw TransactionInactiveError on aborted transaction."); + t.done(); +}; diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_get7.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_get7.any.js new file mode 100644 index 0000000000..863ba0ac69 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_get7.any.js @@ -0,0 +1,23 @@ +// META: title=IDBObjectStore.get() - throw DataError when using invalid key +// META: script=resources/support.js +// @author YuichiNukiyama + +"use strict"; + +let db; +const t = async_test(); + +const open_rq = createdb(t); +open_rq.onupgradeneeded = event => { + db = event.target.result; + db.createObjectStore("store", { keyPath: "key" }); +} + +open_rq.onsuccess = () => { + const store = db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store"); + assert_throws_dom("DataError", () => { + store.get(null) + }, "throw DataError when using invalid key."); + t.done(); +} diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_getAll.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_getAll.any.js new file mode 100644 index 0000000000..db7098f71e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_getAll.any.js @@ -0,0 +1,148 @@ +// META: title=IndexedDB: Test IDBObjectStore.getAll +// META: script=resources/support.js + +'use strict'; + +const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); + +function getall_test(func, name) { + indexeddb_test( + (t, connection, tx) => { + let store = connection.createObjectStore('generated', + { autoIncrement: true, keyPath: 'id' }); + alphabet.forEach(letter => { + store.put({ ch: letter }); + }); + + store = connection.createObjectStore('out-of-line', null); + alphabet.forEach(letter => { + store.put(`value-${letter}`, letter); + }); + + store = connection.createObjectStore('empty', null); + }, + func, + name + ); +} + +function createGetAllRequest(t, storeName, connection, keyRange, maxCount) { + const transaction = connection.transaction(storeName, 'readonly'); + const store = transaction.objectStore(storeName); + const req = store.getAll(keyRange, maxCount); + req.onerror = t.unreached_func('getAll request should succeed'); + return req; +} + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, 'c'); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['value-c']); + t.done(); + }); +}, 'Single item get'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'generated', connection, 3); + req.onsuccess = t.step_func(evt => { + const data = evt.target.result; + assert_true(Array.isArray(data)); + assert_equals(data.length, 1); + assert_equals(data[0].id, 3); + assert_equals(data[0].ch, 'c'); + t.done(); + }); +}, 'Single item get (generated key)'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'empty', connection); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, [], + 'getAll() on empty object store should return an empty array'); + t.done(); + }); +}, 'getAll on empty object store'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, alphabet.map(c => `value-${c}`)); + t.done(); + }); +}, 'Get all values'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, undefined, + 10); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, 'abcdefghij'.split('').map(c => `value-${c}`)); + t.done(); + }); +}, 'Test maxCount'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'm')); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, 'ghijklm'.split('').map(c => `value-${c}`)); + t.done(); + }); +}, 'Get bound range'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'm'), 3); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['g', 'h', 'i'].map(c => `value-${c}`)); + t.done(); + }); +}, 'Get bound range with maxCount'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'k', false, true)); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['g', 'h', 'i', 'j'].map(c => `value-${c}`)); + t.done(); + }); +}, 'Get upper excluded'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'k', true, false)); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['h', 'i', 'j', 'k'].map(c => `value-${c}`)); + t.done(); + }); +}, 'Get lower excluded'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'generated', connection, + IDBKeyRange.bound(4, 15), 3); + req.onsuccess = t.step_func(evt => { + const data = evt.target.result; + assert_true(Array.isArray(data)); + assert_array_equals(data.map(e => e.ch), ['d', 'e', 'f']); + assert_array_equals(data.map(e => e.id), [4, 5, 6]); + t.done(); + }); +}, 'Get bound range (generated) with maxCount'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, + "Doesn't exist"); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, [], + 'getAll() using a nonexistent key should return an empty array'); + t.done(); + }); + req.onerror = t.unreached_func('getAll request should succeed'); +}, 'Non existent key'); + +getall_test((t, connection) => { + const req = createGetAllRequest(t, 'out-of-line', connection, undefined, 0); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, alphabet.map(c => `value-${c}`)); + t.done(); + }); +}, 'zero maxCount'); diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_getAllKeys.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_getAllKeys.any.js new file mode 100644 index 0000000000..951c479873 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_getAllKeys.any.js @@ -0,0 +1,148 @@ +// META: title=IndexedDB: Test IDBObjectStore.getAllKeys +// META: script=resources/support.js + +'use strict'; + +const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); + +function getall_test(func, name) { + indexeddb_test( + (t, connection, tx) => { + let store = connection.createObjectStore('generated', + { autoIncrement: true, keyPath: 'id' }); + alphabet.forEach(letter => { + store.put({ ch: letter }); + }); + + store = connection.createObjectStore('out-of-line', null); + alphabet.forEach(letter => { + store.put(`value-${letter}`, letter); + }); + + store = connection.createObjectStore('empty', null); + }, + func, + name + ); +} + +function createGetAllKeysRequest(t, storeName, connection, keyRange, maxCount) { + const transaction = connection.transaction(storeName, 'readonly'); + const store = transaction.objectStore(storeName); + const req = store.getAllKeys(keyRange, maxCount); + req.onerror = t.unreached_func('getAllKeys request should succeed'); + return req; +} + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, 'c'); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['c']); + t.done(); + }); +}, 'Single item get'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'generated', connection, 3); + req.onsuccess = t.step_func(evt => { + const data = evt.target.result; + assert_true(Array.isArray(data)); + assert_array_equals(data, [3]); + t.done(); + }); +}, 'Single item get (generated key)'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'empty', connection); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, [], + 'getAllKeys() on empty object store should return an empty ' + + 'array'); + t.done(); + }); +}, 'getAllKeys on empty object store'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, alphabet); + t.done(); + }); +}, 'Get all values'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined, + 10); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, 'abcdefghij'.split('')); + t.done(); + }); +}, 'Test maxCount'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'm')); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, 'ghijklm'.split('')); + t.done(); + }); +}, 'Get bound range'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'm'), 3); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['g', 'h', 'i']); + t.done(); + }); +}, 'Get bound range with maxCount'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'k', false, true)); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['g', 'h', 'i', 'j']); + t.done(); + }); +}, 'Get upper excluded'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, + IDBKeyRange.bound('g', 'k', true, false)); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, ['h', 'i', 'j', 'k']); + t.done(); + }); +}, 'Get lower excluded'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'generated', connection, + IDBKeyRange.bound(4, 15), 3); + req.onsuccess = t.step_func(evt => { + const data = evt.target.result; + assert_true(Array.isArray(data)); + assert_array_equals(data, [4, 5, 6]); + t.done(); + }); +}, 'Get bound range (generated) with maxCount'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, + "Doesn't exist"); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, [], + 'getAllKeys() using a nonexistent key should return an ' + + 'empty array'); + t.done(); + }); + req.onerror = t.unreached_func('getAllKeys request should succeed'); +}, 'Non existent key'); + +getall_test((t, connection) => { + const req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined, + 0); + req.onsuccess = t.step_func(evt => { + assert_array_equals(evt.target.result, alphabet); + t.done(); + }); +}, 'zero maxCount'); diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_getKey.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_getKey.any.js new file mode 100644 index 0000000000..f0dc13d45c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_getKey.any.js @@ -0,0 +1,89 @@ +// META: title=IndexedDB: Test IDBObjectStore.getKey() +// META: script=resources/support.js + +'use strict'; + +function getkey_test(func, name) { + indexeddb_test( + (t, db, tx) => { + const basic = db.createObjectStore('basic'); + const key_path_store = db.createObjectStore('key path', + { keyPath: 'id' }); + const key_generator_store = db.createObjectStore('key generator', + { autoIncrement: true }); + const key_generator_and_path_store = db.createObjectStore( + 'key generator and key path', + { autoIncrement: true, key_path: 'id' }); + + for (let i = 1; i <= 10; ++i) { + basic.put(`value: ${i}`, i); + key_path_store.put({ id: i }); + key_generator_store.put(`value: ${i}`); + key_generator_and_path_store.put({}); + } + }, + func, + name + ); +} + +getkey_test((t, db) => { + const tx = db.transaction('basic', 'readonly', {durability: 'relaxed'}); + const store = tx.objectStore('basic'); + assert_throws_js(TypeError, () => store.getKey()); + assert_throws_dom('DataError', () => store.getKey(null)); + assert_throws_dom('DataError', () => store.getKey({})); + t.done(); +}, 'IDBObjectStore.getKey() - invalid parameters'); + +[ + 'basic', + 'key path', + 'key generator', + 'key generator and key path' +].forEach(store_name => { + getkey_test((t, db) => { + const tx = db.transaction(store_name); + const store = tx.objectStore(store_name); + const request = store.getKey(5); + request.onerror = t.unreached_func('request failed'); + request.onsuccess = t.step_func(() => + assert_equals(request.result, 5)); + tx.onabort = t.unreached_func('transaction aborted'); + tx.oncomplete = t.step_func(() => t.done()); + }, `IDBObjectStore.getKey() - ${store_name} - key`); + + getkey_test((t, db) => { + const tx = db.transaction(store_name); + const store = tx.objectStore(store_name); + const request = store.getKey(IDBKeyRange.lowerBound(4.5)); + request.onerror = t.unreached_func('request failed'); + request.onsuccess = t.step_func(() => + assert_equals(request.result, 5)); + tx.onabort = t.unreached_func('transaction aborted'); + tx.oncomplete = t.step_func(() => t.done()); + }, `IDBObjectStore.getKey() - ${store_name} - range`); + + getkey_test((t, db) => { + const tx = db.transaction(store_name); + const store = tx.objectStore(store_name); + const request = store.getKey(11); + request.onerror = t.unreached_func('request failed'); + request.onsuccess = t.step_func(() => + assert_equals(request.result, undefined)); + tx.onabort = t.unreached_func('transaction aborted'); + tx.oncomplete = t.step_func(() => t.done()); + }, `IDBObjectStore.getKey() - ${store_name} - key - no match`); + + getkey_test((t, db) => { + const tx = db.transaction(store_name); + const store = tx.objectStore(store_name); + const request = store.getKey(IDBKeyRange.lowerBound(11)); + request.onerror = t.unreached_func('request failed'); + request.onsuccess = t.step_func(() => + assert_equals(request.result, undefined) + ); + tx.onabort = t.unreached_func('transaction aborted'); + tx.oncomplete = t.step_func(() => t.done()); + }, `IDBObjectStore.getKey() - ${store_name} - range - no match`); +}); diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_index.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_index.htm new file mode 100644 index 0000000000..74d473a5ed --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_index.htm @@ -0,0 +1,31 @@ + + +IDBObjectStore.index() - returns an index + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_keyPath.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_keyPath.any.js new file mode 100644 index 0000000000..b12958bc8a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_keyPath.any.js @@ -0,0 +1,27 @@ +// META: title=IndexedDB: IDBObjectStore keyPath attribute - same object +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + db.createObjectStore('store', {keyPath: ['a', 'b']}); + }, + (t, db) => { + const tx = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + assert_equals(typeof store.keyPath, 'object', 'keyPath is an object'); + assert_true(Array.isArray(store.keyPath), 'keyPath is an array'); + + assert_equals( + store.keyPath, store.keyPath, + 'Same object instance is returned each time keyPath is inspected'); + + const tx2 = db.transaction('store', 'readonly', {durability: 'relaxed'}); + const store2 = tx2.objectStore('store'); + + assert_not_equals( + store.keyPath, store2.keyPath, + 'Different instances are returned from different store instances.'); + + t.done(); + }, + `IDBObjectStore's keyPath attribute returns the same object.`); diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor.htm new file mode 100644 index 0000000000..3085ecf013 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor.htm @@ -0,0 +1,42 @@ + +IDBObjectStore.openCursor() - iterate through 100 objects + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor_invalid.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor_invalid.htm new file mode 100644 index 0000000000..e12db3bb64 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_openCursor_invalid.htm @@ -0,0 +1,33 @@ + +IDBObjectStore.openCursor() - invalid + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_openKeyCursor.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_openKeyCursor.htm new file mode 100644 index 0000000000..483fe29a48 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_openKeyCursor.htm @@ -0,0 +1,133 @@ + +IDBObjectStore.openKeyCursor() + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm new file mode 100644 index 0000000000..e277ce54a2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm @@ -0,0 +1,35 @@ + + +IDBObjectStore.put() - put with an inline key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm new file mode 100644 index 0000000000..6882e8e4b5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.put() - Attempt to call 'put' without an key parameter when the object store uses out-of-line keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm new file mode 100644 index 0000000000..a5ed2db357 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.put() - Attempt to put a record where the record's key does not meet the constraints of a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm new file mode 100644 index 0000000000..0693980277 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.put() - Attempt to put a record where the record's in-line key is not defined + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm new file mode 100644 index 0000000000..8ae6561fc5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm @@ -0,0 +1,29 @@ + + +IDBObjectStore.put() - Attempt to put a record where the out of line key provided does not meet the constraints of a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm new file mode 100644 index 0000000000..bc5647f4c1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm @@ -0,0 +1,32 @@ + + +IDBObjectStore.put() - Put a record where a value being indexed does not meet the constraints of a valid key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm new file mode 100644 index 0000000000..e7affaddd4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm @@ -0,0 +1,31 @@ + + +IDBObjectStore.put() - If the transaction this IDBObjectStore belongs to has its mode set to readonly, throw ReadOnlyError + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm new file mode 100644 index 0000000000..e298ba8849 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm @@ -0,0 +1,25 @@ + + +IDBObjectStore.put() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError + + + + + +
+ diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm new file mode 100644 index 0000000000..733e2cb154 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm @@ -0,0 +1,36 @@ + + +IDBObjectStore.put() - put with an out-of-line key + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm new file mode 100644 index 0000000000..b7792bdaf1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm @@ -0,0 +1,48 @@ + + +IDBObjectStore.put() - record with same key already exists + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm new file mode 100644 index 0000000000..4a59836eb6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm @@ -0,0 +1,40 @@ + + +IDBObjectStore.put() - put where an index has unique:true specified + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm new file mode 100644 index 0000000000..6e945e27d2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm @@ -0,0 +1,34 @@ + + +IDBObjectStore.put() - object store's key path is an object attribute + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm new file mode 100644 index 0000000000..f0b6f0b98d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.put() - autoIncrement and inline keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm new file mode 100644 index 0000000000..e41959f211 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.put() - autoIncrement and out-of-line keys + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm new file mode 100644 index 0000000000..2bec639d32 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm @@ -0,0 +1,47 @@ + + +IDBObjectStore.put() - object store has autoIncrement:true and the key path is an object attribute + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm new file mode 100644 index 0000000000..dff9415d69 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm @@ -0,0 +1,27 @@ + + +IDBObjectStore.put() - Attempt to put a record that does not meet the constraints of an object store's inline key requirements + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbrequest-onupgradeneeded.htm b/testing/web-platform/tests/IndexedDB/idbrequest-onupgradeneeded.htm new file mode 100644 index 0000000000..c156dba619 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbrequest-onupgradeneeded.htm @@ -0,0 +1,146 @@ + + +IndexedDB: UpgradeNeeded Tests + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbrequest_error.html b/testing/web-platform/tests/IndexedDB/idbrequest_error.html new file mode 100644 index 0000000000..73dd13383f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbrequest_error.html @@ -0,0 +1,25 @@ + + +IDBRequest.error + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbrequest_result.html b/testing/web-platform/tests/IndexedDB/idbrequest_result.html new file mode 100644 index 0000000000..69c4853246 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbrequest_result.html @@ -0,0 +1,25 @@ + + +IDBRequest.result + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction-db-SameObject.html b/testing/web-platform/tests/IndexedDB/idbtransaction-db-SameObject.html new file mode 100644 index 0000000000..5116dff5ff --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction-db-SameObject.html @@ -0,0 +1,24 @@ + + +IndexedDB: Verify [SameObject] behavior of IDBTransaction's db attribute + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-exception-order.html b/testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-exception-order.html new file mode 100644 index 0000000000..2ce4e13e2d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-exception-order.html @@ -0,0 +1,26 @@ + + +IndexedDB: IDBTransaction objectStore() Exception Ordering + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-finished.html b/testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-finished.html new file mode 100644 index 0000000000..afe5bec0f8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction-objectStore-finished.html @@ -0,0 +1,24 @@ + + +IndexedDB: IDBTransaction objectStore() when transaction is finished + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction-oncomplete.htm b/testing/web-platform/tests/IndexedDB/idbtransaction-oncomplete.htm new file mode 100644 index 0000000000..722802c1cc --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction-oncomplete.htm @@ -0,0 +1,53 @@ + +IDBTransaction - complete event + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction.htm b/testing/web-platform/tests/IndexedDB/idbtransaction.htm new file mode 100644 index 0000000000..d08e170eb6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction.htm @@ -0,0 +1,63 @@ + +IDBTransaction + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction_abort.htm b/testing/web-platform/tests/IndexedDB/idbtransaction_abort.htm new file mode 100644 index 0000000000..3c64352b08 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction_abort.htm @@ -0,0 +1,41 @@ + + +IDBTransaction - abort + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/idbtransaction_objectStoreNames.html b/testing/web-platform/tests/IndexedDB/idbtransaction_objectStoreNames.html new file mode 100644 index 0000000000..efec1d2470 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbtransaction_objectStoreNames.html @@ -0,0 +1,165 @@ + +IndexedDB: IDBTransaction.objectStoreNames attribute + + + + diff --git a/testing/web-platform/tests/IndexedDB/idbversionchangeevent.htm b/testing/web-platform/tests/IndexedDB/idbversionchangeevent.htm new file mode 100644 index 0000000000..9ea7e6d491 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbversionchangeevent.htm @@ -0,0 +1,87 @@ + +IDBVersionChangeEvent fired in upgradeneeded, versionchange and deleteDatabase + + + + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/idlharness.any.js b/testing/web-platform/tests/IndexedDB/idlharness.any.js new file mode 100644 index 0000000000..12c304589a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idlharness.any.js @@ -0,0 +1,25 @@ +// META: global=window,worker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: timeout=long + +idl_test( + ['IndexedDB'], + ['html', 'dom'], + idl_array => { + idl_array.add_objects({ + IDBCursor: [], + IDBCursorWithValue: [], + IDBDatabase: [], + IDBFactory: [self.indexedDB], + IDBIndex: [], + IDBKeyRange: [IDBKeyRange.only(0)], + IDBObjectStore: [], + IDBOpenDBRequest: [], + IDBRequest: [], + IDBTransaction: [], + IDBVersionChangeEvent: ['new IDBVersionChangeEvent("type")'], + DOMStringList: [], + }); + } +); diff --git a/testing/web-platform/tests/IndexedDB/index_sort_order.htm b/testing/web-platform/tests/IndexedDB/index_sort_order.htm new file mode 100644 index 0000000000..2f6d474ea6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/index_sort_order.htm @@ -0,0 +1,51 @@ + + +Verify key sort order in an index is 'number < Date < DOMString' + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/interleaved-cursors-large.html b/testing/web-platform/tests/IndexedDB/interleaved-cursors-large.html new file mode 100644 index 0000000000..9e17f9e112 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/interleaved-cursors-large.html @@ -0,0 +1,12 @@ + + + +IndexedDB: Interleaved iteration of multiple cursors + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/interleaved-cursors-small.html b/testing/web-platform/tests/IndexedDB/interleaved-cursors-small.html new file mode 100644 index 0000000000..2751113f5f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/interleaved-cursors-small.html @@ -0,0 +1,14 @@ + + + +IndexedDB: Interleaved iteration of multiple cursors + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/key-conversion-exceptions.htm b/testing/web-platform/tests/IndexedDB/key-conversion-exceptions.htm new file mode 100644 index 0000000000..9fdab58eb1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/key-conversion-exceptions.htm @@ -0,0 +1,199 @@ + + +IndexedDB: Exceptions thrown during key conversion + + + + + diff --git a/testing/web-platform/tests/IndexedDB/key_invalid.htm b/testing/web-platform/tests/IndexedDB/key_invalid.htm new file mode 100644 index 0000000000..cf649b07d0 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/key_invalid.htm @@ -0,0 +1,131 @@ + + + +Invalid key + + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/key_valid.html b/testing/web-platform/tests/IndexedDB/key_valid.html new file mode 100644 index 0000000000..678b4c4f4e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/key_valid.html @@ -0,0 +1,75 @@ + + + + +Valid key + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keygenerator-constrainterror.htm b/testing/web-platform/tests/IndexedDB/keygenerator-constrainterror.htm new file mode 100644 index 0000000000..6d61ea2f06 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keygenerator-constrainterror.htm @@ -0,0 +1,73 @@ + + +Keygenerator ConstraintError when using same id as already generated + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keygenerator-explicit.html b/testing/web-platform/tests/IndexedDB/keygenerator-explicit.html new file mode 100644 index 0000000000..e2d65e14b6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keygenerator-explicit.html @@ -0,0 +1,146 @@ + + +Key Generator behavior with explicit keys generator overflow + + + + + diff --git a/testing/web-platform/tests/IndexedDB/keygenerator-inject.html b/testing/web-platform/tests/IndexedDB/keygenerator-inject.html new file mode 100644 index 0000000000..57f3a53848 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keygenerator-inject.html @@ -0,0 +1,119 @@ + + +Key Generator behavior with explicit keys and value injection + + + + + diff --git a/testing/web-platform/tests/IndexedDB/keygenerator-overflow.htm b/testing/web-platform/tests/IndexedDB/keygenerator-overflow.htm new file mode 100644 index 0000000000..2dd6a8dca8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keygenerator-overflow.htm @@ -0,0 +1,70 @@ + + +Keygenerator overflow + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keygenerator.htm b/testing/web-platform/tests/IndexedDB/keygenerator.htm new file mode 100644 index 0000000000..b4eeef9515 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keygenerator.htm @@ -0,0 +1,65 @@ + + +Keygenerator + + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keyorder.htm b/testing/web-platform/tests/IndexedDB/keyorder.htm new file mode 100644 index 0000000000..7e8b3d4126 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keyorder.htm @@ -0,0 +1,175 @@ + + + +Key sort order + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keypath-exceptions.htm b/testing/web-platform/tests/IndexedDB/keypath-exceptions.htm new file mode 100644 index 0000000000..c23d4d2268 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keypath-exceptions.htm @@ -0,0 +1,281 @@ + + +IndexedDB: Exceptions in extracting keys from values (ES bindings) + + + + + diff --git a/testing/web-platform/tests/IndexedDB/keypath-special-identifiers.htm b/testing/web-platform/tests/IndexedDB/keypath-special-identifiers.htm new file mode 100644 index 0000000000..55f40314ee --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keypath-special-identifiers.htm @@ -0,0 +1,66 @@ + + +IndexedDB: Special-cased identifiers in extracting keys from values (ES bindings) + + + + + diff --git a/testing/web-platform/tests/IndexedDB/keypath.htm b/testing/web-platform/tests/IndexedDB/keypath.htm new file mode 100644 index 0000000000..06f5947d35 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keypath.htm @@ -0,0 +1,150 @@ + + + +Keypath + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keypath_invalid.htm b/testing/web-platform/tests/IndexedDB/keypath_invalid.htm new file mode 100644 index 0000000000..6aa33c854a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keypath_invalid.htm @@ -0,0 +1,65 @@ + + + +Invalid keypath + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/keypath_maxsize.htm b/testing/web-platform/tests/IndexedDB/keypath_maxsize.htm new file mode 100644 index 0000000000..069f4f7eca --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/keypath_maxsize.htm @@ -0,0 +1,63 @@ + + +Keypath + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/large-requests-abort.html b/testing/web-platform/tests/IndexedDB/large-requests-abort.html new file mode 100644 index 0000000000..38c73ff406 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/large-requests-abort.html @@ -0,0 +1,244 @@ + + + +IndexedDB: transactions with large request results are aborted correctly + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/list_ordering.htm b/testing/web-platform/tests/IndexedDB/list_ordering.htm new file mode 100644 index 0000000000..a3c36de389 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/list_ordering.htm @@ -0,0 +1,61 @@ + + +objectStoreNames and indexNames order + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/name-scopes.html b/testing/web-platform/tests/IndexedDB/name-scopes.html new file mode 100644 index 0000000000..d92f706e0a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/name-scopes.html @@ -0,0 +1,134 @@ + + + + IndexedDB: scoping for database / object store / index names, and index keys + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/nested-cloning-large-multiple.html b/testing/web-platform/tests/IndexedDB/nested-cloning-large-multiple.html new file mode 100644 index 0000000000..97bcaddfb2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/nested-cloning-large-multiple.html @@ -0,0 +1,54 @@ + + + +IndexedDB: large nested objects are cloned correctly + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/nested-cloning-large.html b/testing/web-platform/tests/IndexedDB/nested-cloning-large.html new file mode 100644 index 0000000000..8b3cbc5726 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/nested-cloning-large.html @@ -0,0 +1,49 @@ + + + +IndexedDB: large nested objects are cloned correctly + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/nested-cloning-small.html b/testing/web-platform/tests/IndexedDB/nested-cloning-small.html new file mode 100644 index 0000000000..e92251410a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/nested-cloning-small.html @@ -0,0 +1,47 @@ + + + +IndexedDB: small nested objects are cloned correctly + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/objectstore_keyorder.htm b/testing/web-platform/tests/IndexedDB/objectstore_keyorder.htm new file mode 100644 index 0000000000..ad294f66a1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/objectstore_keyorder.htm @@ -0,0 +1,49 @@ + + +Verify key sort order in an object store is 'number < Date < DOMString' + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/open-request-queue.html b/testing/web-platform/tests/IndexedDB/open-request-queue.html new file mode 100644 index 0000000000..b4371f2a2e --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/open-request-queue.html @@ -0,0 +1,63 @@ + + +IndexedDB: open and delete requests are processed as a FIFO queue + + + + + diff --git a/testing/web-platform/tests/IndexedDB/parallel-cursors-upgrade.html b/testing/web-platform/tests/IndexedDB/parallel-cursors-upgrade.html new file mode 100644 index 0000000000..99ea65d9d6 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/parallel-cursors-upgrade.html @@ -0,0 +1,52 @@ + + + +IndexedDB: Parallel iteration of cursors in upgradeneeded + + + + + diff --git a/testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes-cursors.any.js b/testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes-cursors.any.js new file mode 100644 index 0000000000..ff71000683 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes-cursors.any.js @@ -0,0 +1,88 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +// META: script=resources/support-promises.js +// META: script=resources/reading-autoincrement-common.js + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_id'); + + const result = await getAllViaCursor(testCase, index); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].key, i, 'Autoincrement index key'); + assert_equals(result[i - 1].primaryKey, i, 'Autoincrement primary key'); + assert_equals(result[i - 1].value.id, i, 'Autoincrement key in value'); + assert_equals(result[i - 1].value.name, nameForId(i), + 'String property in value'); + } + + database.close(); +}, 'IDBIndex.openCursor() iterates over an index on the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_id'); + + const result = await getAllKeysViaCursor(testCase, index); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].key, i, 'Autoincrement index key'); + assert_equals(result[i - 1].primaryKey, i, 'Autoincrement primary key'); + } + + database.close(); +}, 'IDBIndex.openKeyCursor() iterates over an index on the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_name'); + + const stringSortedIds = idsSortedByStringCompare(); + + const result = await getAllViaCursor(testCase, index); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].key, nameForId(stringSortedIds[i - 1]), + 'Index key'); + assert_equals(result[i - 1].primaryKey, stringSortedIds[i - 1], + 'Autoincrement primary key'); + assert_equals(result[i - 1].value.id, stringSortedIds[i - 1], + 'Autoincrement key in value'); + assert_equals(result[i - 1].value.name, nameForId(stringSortedIds[i - 1]), + 'String property in value'); + } + + database.close(); +}, 'IDBIndex.openCursor() iterates over an index not covering the ' + + 'autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_name'); + + const stringSortedIds = idsSortedByStringCompare(); + + const result = await getAllKeysViaCursor(testCase, index); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].key, nameForId(stringSortedIds[i - 1]), + 'Index key'); + assert_equals(result[i - 1].primaryKey, stringSortedIds[i - 1], + 'Autoincrement primary key'); + } + + database.close(); +}, 'IDBIndex.openKeyCursor() iterates over an index not covering the ' + + 'autoincrement key'); diff --git a/testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes.any.js b/testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes.any.js new file mode 100644 index 0000000000..abff3dd8b5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/reading-autoincrement-indexes.any.js @@ -0,0 +1,108 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +// META: script=resources/support-promises.js +// META: script=resources/reading-autoincrement-common.js + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_id'); + const request = index.getAll(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].id, i, 'Autoincrement key'); + assert_equals(result[i - 1].name, nameForId(i), 'String property'); + } + + database.close(); +}, 'IDBIndex.getAll() for an index on the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_id'); + const request = index.getAllKeys(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) + assert_equals(result[i - 1], i, 'Autoincrement key'); + + database.close(); +}, 'IDBIndex.getAllKeys() for an index on the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_id'); + + for (let i = 1; i <= 32; ++i) { + const request = index.get(i); + const result = await promiseForRequest(testCase, request); + assert_equals(result.id, i, 'autoincrement key'); + assert_equals(result.name, nameForId(i), 'string property'); + } + + database.close(); +}, 'IDBIndex.get() for an index on the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const stringSortedIds = idsSortedByStringCompare(); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_name'); + const request = index.getAll(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].id, stringSortedIds[i - 1], + 'autoincrement key'); + assert_equals(result[i - 1].name, nameForId(stringSortedIds[i - 1]), + 'string property'); + } + + database.close(); +}, 'IDBIndex.getAll() for an index not covering the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const stringSortedIds = idsSortedByStringCompare(); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_name'); + const request = index.getAllKeys(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) + assert_equals(result[i - 1], stringSortedIds[i - 1], 'String property'); + + database.close(); +}, 'IDBIndex.getAllKeys() returns correct result for an index not covering ' + + 'the autoincrement key'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const index = store.index('by_name'); + + for (let i = 1; i <= 32; ++i) { + const request = index.get(nameForId(i)); + const result = await promiseForRequest(testCase, request); + assert_equals(result.id, i, 'Autoincrement key'); + assert_equals(result.name, nameForId(i), 'String property'); + } + + database.close(); +}, 'IDBIndex.get() for an index not covering the autoincrement key'); diff --git a/testing/web-platform/tests/IndexedDB/reading-autoincrement-store-cursors.any.js b/testing/web-platform/tests/IndexedDB/reading-autoincrement-store-cursors.any.js new file mode 100644 index 0000000000..da02057e89 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/reading-autoincrement-store-cursors.any.js @@ -0,0 +1,38 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +// META: script=resources/support-promises.js +// META: script=resources/reading-autoincrement-common.js + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + + const result = await getAllViaCursor(testCase, store); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].key, i, 'Autoincrement key'); + assert_equals(result[i - 1].primaryKey, i, 'Autoincrement primary key'); + assert_equals(result[i - 1].value.id, i, 'Autoincrement key in value'); + assert_equals(result[i - 1].value.name, nameForId(i), + 'string property in value'); + } + + database.close(); +}, 'IDBObjectStore.openCursor() iterates over an autoincrement store'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + + const result = await getAllKeysViaCursor(testCase, store); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].key, i, 'Incorrect autoincrement key'); + assert_equals(result[i - 1].primaryKey, i, 'Incorrect primary key'); + } + + database.close(); +}, 'IDBObjectStore.openKeyCursor() iterates over an autoincrement store'); diff --git a/testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js b/testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js new file mode 100644 index 0000000000..531d5417bb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/reading-autoincrement-store.any.js @@ -0,0 +1,49 @@ +// META: global=window,dedicatedworker,sharedworker,serviceworker +// META: script=resources/support-promises.js +// META: script=resources/reading-autoincrement-common.js + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const request = store.getAll(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) { + assert_equals(result[i - 1].id, i, 'Autoincrement key'); + assert_equals(result[i - 1].name, nameForId(i), 'String property'); + } + + database.close(); +}, 'IDBObjectStore.getAll() for an autoincrement store'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + const request = store.getAllKeys(); + const result = await promiseForRequest(testCase, request); + assert_equals(result.length, 32); + for (let i = 1; i <= 32; ++i) + assert_equals(result[i - 1], i, 'Autoincrement key'); + + database.close(); +}, 'IDBObjectStore.getAllKeys() for an autoincrement store'); + +promise_test(async testCase => { + const database = await setupAutoincrementDatabase(testCase); + + const transaction = database.transaction(['store'], 'readonly'); + const store = transaction.objectStore('store'); + + for (let i = 1; i <= 32; ++i) { + const request = store.get(i); + const result = await promiseForRequest(testCase, request); + assert_equals(result.id, i, 'Autoincrement key'); + assert_equals(result.name, nameForId(i), 'String property'); + } + + database.close(); +}, 'IDBObjectStore.get() for an autoincrement store'); diff --git a/testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html b/testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html new file mode 100644 index 0000000000..8194052391 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html @@ -0,0 +1,27 @@ + + +readyState is valid when the execution context is destroyed + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/request-abort-ordering.html b/testing/web-platform/tests/IndexedDB/request-abort-ordering.html new file mode 100644 index 0000000000..4374d8de70 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/request-abort-ordering.html @@ -0,0 +1,83 @@ + + + +IndexedDB: request abort events are delivered in order + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/request-event-ordering.html b/testing/web-platform/tests/IndexedDB/request-event-ordering.html new file mode 100644 index 0000000000..71eda0dd1d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/request-event-ordering.html @@ -0,0 +1,369 @@ + + + +IndexedDB: request result events are delivered in order + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/request_bubble-and-capture.htm b/testing/web-platform/tests/IndexedDB/request_bubble-and-capture.htm new file mode 100644 index 0000000000..8238e2c9ca --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/request_bubble-and-capture.htm @@ -0,0 +1,69 @@ + + +Bubbling and capturing of request events + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/resources/cross-origin-helper-frame.html b/testing/web-platform/tests/IndexedDB/resources/cross-origin-helper-frame.html new file mode 100644 index 0000000000..997c5a2b72 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/cross-origin-helper-frame.html @@ -0,0 +1,37 @@ + + +Performs IndexedDB tasks in response to postMessage + diff --git a/testing/web-platform/tests/IndexedDB/resources/file_to_save.txt b/testing/web-platform/tests/IndexedDB/resources/file_to_save.txt new file mode 100644 index 0000000000..3f5238e841 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/file_to_save.txt @@ -0,0 +1 @@ +File to save to IndexedDB. \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-basic-iframe.tentative.html b/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-basic-iframe.tentative.html new file mode 100644 index 0000000000..ed6bbf272f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-basic-iframe.tentative.html @@ -0,0 +1,80 @@ + + + diff --git a/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-coverage-iframe.tentative.html b/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-coverage-iframe.tentative.html new file mode 100644 index 0000000000..a7be7e2cc9 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-coverage-iframe.tentative.html @@ -0,0 +1,601 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-persistence-iframe.tentative.html b/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-persistence-iframe.tentative.html new file mode 100644 index 0000000000..ad6869f945 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/idb-partitioned-persistence-iframe.tentative.html @@ -0,0 +1,76 @@ + + + diff --git a/testing/web-platform/tests/IndexedDB/resources/idbfactory-origin-isolation-iframe.html b/testing/web-platform/tests/IndexedDB/resources/idbfactory-origin-isolation-iframe.html new file mode 100644 index 0000000000..0f16bcadaa --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/idbfactory-origin-isolation-iframe.html @@ -0,0 +1,50 @@ + +This iframe keeps a transaction on a database alive indefinitely to test + diff --git a/testing/web-platform/tests/IndexedDB/resources/idbworker.js b/testing/web-platform/tests/IndexedDB/resources/idbworker.js new file mode 100644 index 0000000000..04a421fa38 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/idbworker.js @@ -0,0 +1,34 @@ +var db + +self.addEventListener('message', MessageHandler, false) + +function MessageHandler(e) +{ + var open_rq, idb = self.indexedDB || self.msIndexedDB || self.webkitIndexedDB || self.mozIndexedDB + + if (!idb) + { + self.postMessage(false) + return + } + else + self.postMessage(true) + + open_rq = idb.open("webworker101", 1) + + open_rq.onupgradeneeded = function(e) { + db = e.target.result + db.createObjectStore("store") + .add("test", 1) + } + open_rq.onsuccess = function(e) { + db = e.target.result + db.onerror = function() { self.postMessage("db.error") } + db.transaction("store", "readonly", {durability: 'relaxed'}).objectStore("store").get(1).onsuccess = function(e) { + self.postMessage(e.target.result) + db.close() + } + } + open_rq.onerror = function() { self.postMessage("open.error") } + open_rq.onblocked = function() { self.postMessage("open.blocked") } +} diff --git a/testing/web-platform/tests/IndexedDB/resources/interleaved-cursors-common.js b/testing/web-platform/tests/IndexedDB/resources/interleaved-cursors-common.js new file mode 100644 index 0000000000..09ed078c1f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/interleaved-cursors-common.js @@ -0,0 +1,188 @@ +// Infrastructure shared by interleaved-cursors-{small,large}.html + +// Number of objects that each iterator goes over. +const itemCount = 10; + +// Ratio of small objects to large objects. +const largeObjectRatio = 5; + +// Size of large objects. This should exceed the size of a block in the storage +// method underlying the browser's IndexedDB implementation. For example, this +// needs to exceed the LevelDB block size on Chrome, and the SQLite block size +// on Firefox. +const largeObjectSize = 48 * 1024; + +function objectKey(cursorIndex, itemIndex) { + return `${cursorIndex}-key-${itemIndex}`; +} + +function objectValue(cursorIndex, itemIndex) { + if ((cursorIndex * itemCount + itemIndex) % largeObjectRatio === 0) { + // We use a typed array (as opposed to a string) because IndexedDB + // implementations may serialize strings using UTF-8 or UTF-16, yielding + // larger IndexedDB entries than we'd expect. It's very unlikely that an + // IndexedDB implementation would use anything other than the raw buffer to + // serialize a typed array. + const buffer = new Uint8Array(largeObjectSize); + + // Some IndexedDB implementations, like LevelDB, compress their data blocks + // before storing them to disk. We use a simple 32-bit xorshift PRNG, which + // should be sufficient to foil any fast generic-purpose compression scheme. + + // 32-bit xorshift - the seed can't be zero + let state = 1000 + (cursorIndex * itemCount + itemIndex); + + for (let i = 0; i < largeObjectSize; ++i) { + state ^= state << 13; + state ^= state >> 17; + state ^= state << 5; + buffer[i] = state & 0xff; + } + + return buffer; + } + return [cursorIndex, 'small', itemIndex]; +} + +// Writes the objects to be read by one cursor. Returns a promise that resolves +// when the write completes. +// +// We want to avoid creating a large transaction, because that is outside the +// test's scope, and it's a bad practice. So we break up the writes across +// multiple transactions. For simplicity, each transaction writes all the +// objects that will be read by a cursor. +function writeCursorObjects(database, cursorIndex) { + return new Promise((resolve, reject) => { + const transaction = database.transaction('cache', 'readwrite', {durability: 'relaxed'}); + transaction.onabort = () => { reject(transaction.error); }; + + const store = transaction.objectStore('cache'); + for (let i = 0; i < itemCount; ++i) { + store.put({ + key: objectKey(cursorIndex, i), value: objectValue(cursorIndex, i)}); + } + transaction.oncomplete = resolve; + }); +} + +// Returns a promise that resolves when the store has been populated. +function populateTestStore(testCase, database, cursorCount) { + let promiseChain = Promise.resolve(); + + for (let i = 0; i < cursorCount; ++i) + promiseChain = promiseChain.then(() => writeCursorObjects(database, i)); + + return promiseChain; +} + +// Reads cursors in an interleaved fashion, as shown below. +// +// Given N cursors, each of which points to the beginning of a K-item sequence, +// the following accesses will be made. +// +// OC(i) = open cursor i +// RD(i, j) = read result of cursor i, which should be at item j +// CC(i) = continue cursor i +// | = wait for onsuccess on the previous OC or CC +// +// OC(1) | RD(1, 1) OC(2) | RD(2, 1) OC(3) | ... | RD(n-1, 1) CC(n) | +// RD(n, 1) CC(1) | RD(1, 2) CC(2) | RD(2, 2) CC(3) | ... | RD(n-1, 2) CC(n) | +// RD(n, 2) CC(1) | RD(1, 3) CC(2) | RD(2, 3) CC(3) | ... | RD(n-1, 3) CC(n) | +// ... +// RD(n, k-1) CC(1) | RD(1, k) CC(2) | RD(2, k) CC(3) | ... | RD(n-1, k) CC(n) | +// RD(n, k) done +function interleaveCursors(testCase, store, cursorCount) { + return new Promise((resolve, reject) => { + // The cursors used for iteration are stored here so each cursor's onsuccess + // handler can call continue() on the next cursor. + const cursors = []; + + // The results of IDBObjectStore.openCursor() calls are stored here so we + // we can change the requests' onsuccess handler after every + // IDBCursor.continue() call. + const requests = []; + + const checkCursorState = (cursorIndex, itemIndex) => { + const cursor = cursors[cursorIndex]; + assert_equals(cursor.key, objectKey(cursorIndex, itemIndex)); + assert_equals(cursor.value.key, objectKey(cursorIndex, itemIndex)); + assert_equals( + cursor.value.value.join('-'), + objectValue(cursorIndex, itemIndex).join('-')); + }; + + const openCursor = (cursorIndex, callback) => { + const request = store.openCursor( + IDBKeyRange.lowerBound(objectKey(cursorIndex, 0))); + requests[cursorIndex] = request; + + request.onsuccess = testCase.step_func(() => { + const cursor = request.result; + cursors[cursorIndex] = cursor; + checkCursorState(cursorIndex, 0); + callback(); + }); + request.onerror = event => reject(request.error); + }; + + const readItemFromCursor = (cursorIndex, itemIndex, callback) => { + const request = requests[cursorIndex]; + request.onsuccess = testCase.step_func(() => { + const cursor = request.result; + cursors[cursorIndex] = cursor; + checkCursorState(cursorIndex, itemIndex); + callback(); + }); + + const cursor = cursors[cursorIndex]; + cursor.continue(); + }; + + // We open all the cursors one at a time, then cycle through the cursors and + // call continue() on each of them. This access pattern causes maximal + // trashing to an LRU cursor cache. Eviction scheme aside, any cache will + // have to evict some cursors, and this access pattern verifies that the + // cache correctly restores the state of evicted cursors. + const steps = []; + for (let cursorIndex = 0; cursorIndex < cursorCount; ++cursorIndex) + steps.push(openCursor.bind(null, cursorIndex)); + for (let itemIndex = 1; itemIndex < itemCount; ++itemIndex) { + for (let cursorIndex = 0; cursorIndex < cursorCount; ++cursorIndex) + steps.push(readItemFromCursor.bind(null, cursorIndex, itemIndex)); + } + + const runStep = (stepIndex) => { + if (stepIndex === steps.length) { + resolve(); + return; + } + steps[stepIndex](() => { runStep(stepIndex + 1); }); + }; + runStep(0); + }); +} + +function cursorTest(cursorCount) { + promise_test(testCase => { + return createDatabase(testCase, (database, transaction) => { + const store = database.createObjectStore('cache', + { keyPath: 'key', autoIncrement: true }); + }).then(database => { + return populateTestStore(testCase, database, cursorCount).then( + () => database); + }).then(database => { + database.close(); + }).then(() => { + return openDatabase(testCase); + }).then(database => { + const transaction = database.transaction('cache', 'readonly', {durability: 'relaxed'}); + transaction.onabort = () => { reject(transaction.error); }; + + const store = transaction.objectStore('cache'); + return interleaveCursors(testCase, store, cursorCount).then( + () => database); + }).then(database => { + database.close(); + }); + }, `${cursorCount} cursors`); +} diff --git a/testing/web-platform/tests/IndexedDB/resources/nested-cloning-common.js b/testing/web-platform/tests/IndexedDB/resources/nested-cloning-common.js new file mode 100644 index 0000000000..db5f710ceb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/nested-cloning-common.js @@ -0,0 +1,211 @@ +'use strict'; + +// Should be large enough to trigger large value handling in the IndexedDB +// engines that have special code paths for large values. +const wrapThreshold = 128 * 1024; + +// Returns an IndexedDB value created from a descriptor. +// +// See the bottom of the file for descriptor samples. +function createValue(descriptor) { + if (typeof(descriptor) != 'object') + return descriptor; + + if (Array.isArray(descriptor)) + return descriptor.map((element) => createValue(element)); + + if (!descriptor.hasOwnProperty('type')) { + const value = {}; + for (let property of Object.getOwnPropertyNames(descriptor)) + value[property] = createValue(descriptor[property]); + return value; + } + + switch (descriptor.type) { + case 'blob': + return new Blob( + [largeValue(descriptor.size, descriptor.seed)], + { type: descriptor.mimeType }); + case 'buffer': + return largeValue(descriptor.size, descriptor.seed); + } +} + +// Checks an IndexedDB value against a descriptor. +// +// Returns a Promise that resolves if the value passes the check. +// +// See the bottom of the file for descriptor samples. +function checkValue(testCase, value, descriptor) { + if (typeof(descriptor) != 'object') { + assert_equals( + descriptor, value, + 'IndexedDB result should match put() argument'); + return Promise.resolve(); + } + + if (Array.isArray(descriptor)) { + assert_true( + Array.isArray(value), + 'IndexedDB result type should match put() argument'); + assert_equals( + descriptor.length, value.length, + 'IndexedDB result array size should match put() argument'); + + const subChecks = []; + for (let i = 0; i < descriptor.length; ++i) + subChecks.push(checkValue(testCase, value[i], descriptor[i])); + return Promise.all(subChecks); + } + + if (!descriptor.hasOwnProperty('type')) { + assert_array_equals( + Object.getOwnPropertyNames(value).sort(), + Object.getOwnPropertyNames(descriptor).sort(), + 'IndexedDB result object properties should match put() argument'); + const subChecks = []; + return Promise.all(Object.getOwnPropertyNames(descriptor).map(property => + checkValue(testCase, value[property], descriptor[property]))); + } + + switch (descriptor.type) { + case 'blob': + assert_class_string( + value, 'Blob', + 'IndexedDB result class should match put() argument'); + assert_equals( + descriptor.mimeType, value.type, + 'IndexedDB result Blob MIME type should match put() argument'); + assert_equals(descriptor.size, value.size, 'incorrect Blob size'); + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = testCase.step_func(() => { + if (reader.error) { + reject(reader.error); + return; + } + const view = new Uint8Array(reader.result); + assert_equals( + view.join(','), + largeValue(descriptor.size, descriptor.seed).join(','), + 'IndexedDB result Blob content should match put() argument'); + resolve(); + }); + reader.readAsArrayBuffer(value); + }); + + case 'buffer': + assert_class_string( + value, 'Uint8Array', + 'IndexedDB result type should match put() argument'); + assert_equals( + value.join(','), + largeValue(descriptor.size, descriptor.seed).join(','), + 'IndexedDB result typed array content should match put() argument'); + return Promise.resolve(); + } +} + +function cloningTestInternal(label, valueDescriptors, options) { + promise_test(testCase => { + return createDatabase(testCase, (database, transaction) => { + let store; + if (options.useKeyGenerator) { + store = database.createObjectStore( + 'test-store', { keyPath: 'primaryKey', autoIncrement: true }); + } else { + store = database.createObjectStore('test-store'); + } + for (let i = 0; i < valueDescriptors.length; ++i) { + if (options.useKeyGenerator) { + store.put(createValue(valueDescriptors[i])); + } else { + store.put(createValue(valueDescriptors[i]), i + 1); + } + } + }).then(database => { + const transaction = database.transaction(['test-store'], 'readonly'); + const store = transaction.objectStore('test-store'); + const subChecks = []; + let resultIndex = 0; + for (let i = 0; i < valueDescriptors.length; ++i) { + subChecks.push(new Promise((resolve, reject) => { + const requestIndex = i; + const primaryKey = requestIndex + 1; + const request = store.get(primaryKey); + request.onerror = + testCase.step_func(() => { reject(request.error); }); + request.onsuccess = testCase.step_func(() => { + assert_equals( + resultIndex, requestIndex, + 'IDBRequest success events should be fired in request order'); + ++resultIndex; + + const result = request.result; + if (options.useKeyGenerator) { + assert_equals( + result.primaryKey, primaryKey, + 'IndexedDB result should have auto-incremented primary key'); + delete result.primaryKey; + } + resolve(checkValue( + testCase, result, valueDescriptors[requestIndex])); + }); + })); + } + + subChecks.push(new Promise((resolve, reject) => { + const requestIndex = valueDescriptors.length; + const request = store.getAll(); + request.onerror = + testCase.step_func(() => { reject(request.error); }); + request.onsuccess = testCase.step_func(() => { + assert_equals( + resultIndex, requestIndex, + 'IDBRequest success events should be fired in request order'); + ++resultIndex; + const result = request.result; + if (options.useKeyGenerator) { + for (let i = 0; i < valueDescriptors.length; ++i) { + const primaryKey = i + 1; + assert_equals( + result[i].primaryKey, primaryKey, + 'IndexedDB result should have auto-incremented primary key'); + delete result[i].primaryKey; + } + } + resolve(checkValue(testCase, result, valueDescriptors)); + }); + })); + + return Promise.all(subChecks); + }); + }, label); +} + +// Performs a series of put()s and verifies that get()s and getAll() match. +// +// Each element of the valueDescriptors array is fed into createValue(), and the +// resulting value is written to IndexedDB via a put() request. After the writes +// complete, the values are read in the same order in which they were written. +// Last, all the results are read one more time via a getAll(). +// +// The test verifies that the get() / getAll() results match the arguments to +// put() and that the order in which the get() result events are fired matches +// the order of the get() requests. +function cloningTest(label, valueDescriptors) { + cloningTestInternal(label, valueDescriptors, { useKeyGenerator: false }); +} + +// cloningTest, with coverage for key generators. +// +// This creates two tests. One test performs a series of put()s and verifies +// that get()s and getAll() match, exactly like cloningTestWithoutKeyGenerator. +// The other test performs the same put()s in an object store with a key +// generator, and checks that the key generator works properly. +function cloningTestWithKeyGenerator(label, valueDescriptors) { + cloningTestInternal(label, valueDescriptors, { useKeyGenerator: false }); + cloningTestInternal( + label + " with key generator", valueDescriptors, + { useKeyGenerator: true }); +} diff --git a/testing/web-platform/tests/IndexedDB/resources/reading-autoincrement-common.js b/testing/web-platform/tests/IndexedDB/resources/reading-autoincrement-common.js new file mode 100644 index 0000000000..45c8ffef92 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/reading-autoincrement-common.js @@ -0,0 +1,93 @@ +// Returns the "name" property written to the object with the given ID. +function nameForId(id) { + return `Object ${id}`; +} + +// Initial database setup used by all the reading-autoincrement tests. +async function setupAutoincrementDatabase(testCase) { + const database = await createDatabase(testCase, database => { + const store = database.createObjectStore( + 'store', { autoIncrement: true, keyPath: 'id' }); + store.createIndex('by_name', 'name', { unique: true }); + store.createIndex('by_id', 'id', { unique: true }); + + // Cover writing from the initial upgrade transaction. + for (let i = 1; i <= 16; ++i) { + if (i % 2 == 0) { + store.put({name: nameForId(i), id: i}); + } else { + store.put({name: nameForId(i)}); + } + } + }); + + // Cover writing from a subsequent transaction. + const transaction = database.transaction(['store'], 'readwrite'); + const store = transaction.objectStore('store'); + for (let i = 17; i <= 32; ++i) { + if (i % 2 == 0) { + store.put({name: nameForId(i), id: i}); + } else { + store.put({name: nameForId(i)}); + } + } + await promiseForTransaction(testCase, transaction); + + return database; +} + +// Returns the IDs used by the object store, sorted as strings. +// +// This is used to determine the correct order of records when retrieved from an +// index that uses stringified IDs. +function idsSortedByStringCompare() { + const stringIds = []; + for (let i = 1; i <= 32; ++i) + stringIds.push(i); + stringIds.sort((a, b) => indexedDB.cmp(`${a}`, `${b}`)); + return stringIds; +} + +async function iterateCursor(testCase, cursorRequest, callback) { + // This uses requestWatcher() directly instead of using promiseForRequest() + // inside the loop to avoid creating multiple EventWatcher instances. In turn, + // this avoids ending up with O(N) listeners for the request and O(N^2) + // dispatched events. + const eventWatcher = requestWatcher(testCase, cursorRequest); + while (true) { + const event = await eventWatcher.wait_for('success'); + const cursor = event.target.result; + if (cursor === null) + return; + callback(cursor); + cursor.continue(); + } +} + +// Returns equivalent information to getAllKeys() by iterating a cursor. +// +// Returns an array with one dictionary per entry in the source. The dictionary +// has the properties "key" and "primaryKey". +async function getAllKeysViaCursor(testCase, cursorSource) { + const results = []; + await iterateCursor(testCase, cursorSource.openKeyCursor(), cursor => { + results.push({ key: cursor.key, primaryKey: cursor.primaryKey }); + }); + return results; +} + +// Returns equivalent information to getAll() by iterating a cursor. +// +// Returns an array with one dictionary per entry in the source. The dictionary +// has the properties "key", "primaryKey" and "value". +async function getAllViaCursor(testCase, cursorSource) { + const results = []; + await iterateCursor(testCase, cursorSource.openCursor(), cursor => { + results.push({ + key: cursor.key, + primaryKey: cursor.primaryKey, + value: cursor.value, + }); + }); + return results; +} \ No newline at end of file diff --git a/testing/web-platform/tests/IndexedDB/resources/support-promises.js b/testing/web-platform/tests/IndexedDB/resources/support-promises.js new file mode 100644 index 0000000000..9128bfe151 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/support-promises.js @@ -0,0 +1,355 @@ +'use strict'; + +// Returns an IndexedDB database name that is unique to the test case. +function databaseName(testCase) { + return 'db' + self.location.pathname + '-' + testCase.name; +} + +// EventWatcher covering all the events defined on IndexedDB requests. +// +// The events cover IDBRequest and IDBOpenDBRequest. +function requestWatcher(testCase, request) { + return new EventWatcher(testCase, request, + ['blocked', 'error', 'success', 'upgradeneeded']); +} + +// EventWatcher covering all the events defined on IndexedDB transactions. +// +// The events cover IDBTransaction. +function transactionWatcher(testCase, request) { + return new EventWatcher(testCase, request, ['abort', 'complete', 'error']); +} + +// Promise that resolves with an IDBRequest's result. +// +// The promise only resolves if IDBRequest receives the "success" event. Any +// other event causes the promise to reject with an error. This is correct in +// most cases, but insufficient for indexedDB.open(), which issues +// "upgradeneded" events under normal operation. +function promiseForRequest(testCase, request) { + const eventWatcher = requestWatcher(testCase, request); + return eventWatcher.wait_for('success').then(event => event.target.result); +} + +// Promise that resolves when an IDBTransaction completes. +// +// The promise resolves with undefined if IDBTransaction receives the "complete" +// event, and rejects with an error for any other event. +function promiseForTransaction(testCase, request) { + const eventWatcher = transactionWatcher(testCase, request); + return eventWatcher.wait_for('complete').then(() => {}); +} + +// Migrates an IndexedDB database whose name is unique for the test case. +// +// newVersion must be greater than the database's current version. +// +// migrationCallback will be called during a versionchange transaction and will +// given the created database, the versionchange transaction, and the database +// open request. +// +// Returns a promise. If the versionchange transaction goes through, the promise +// resolves to an IndexedDB database that should be closed by the caller. If the +// versionchange transaction is aborted, the promise resolves to an error. +function migrateDatabase(testCase, newVersion, migrationCallback) { + return migrateNamedDatabase( + testCase, databaseName(testCase), newVersion, migrationCallback); +} + +// Migrates an IndexedDB database. +// +// newVersion must be greater than the database's current version. +// +// migrationCallback will be called during a versionchange transaction and will +// given the created database, the versionchange transaction, and the database +// open request. +// +// Returns a promise. If the versionchange transaction goes through, the promise +// resolves to an IndexedDB database that should be closed by the caller. If the +// versionchange transaction is aborted, the promise resolves to an error. +function migrateNamedDatabase( + testCase, databaseName, newVersion, migrationCallback) { + // We cannot use eventWatcher.wait_for('upgradeneeded') here, because + // the versionchange transaction auto-commits before the Promise's then + // callback gets called. + return new Promise((resolve, reject) => { + const request = indexedDB.open(databaseName, newVersion); + request.onupgradeneeded = testCase.step_func(event => { + const database = event.target.result; + const transaction = event.target.transaction; + let shouldBeAborted = false; + let requestEventPromise = null; + + // We wrap IDBTransaction.abort so we can set up the correct event + // listeners and expectations if the test chooses to abort the + // versionchange transaction. + const transactionAbort = transaction.abort.bind(transaction); + transaction.abort = () => { + transaction._willBeAborted(); + transactionAbort(); + } + transaction._willBeAborted = () => { + requestEventPromise = new Promise((resolve, reject) => { + request.onerror = event => { + event.preventDefault(); + resolve(event.target.error); + }; + request.onsuccess = () => reject(new Error( + 'indexedDB.open should not succeed for an aborted ' + + 'versionchange transaction')); + }); + shouldBeAborted = true; + } + + // If migration callback returns a promise, we'll wait for it to resolve. + // This simplifies some tests. + const callbackResult = migrationCallback(database, transaction, request); + if (!shouldBeAborted) { + request.onerror = null; + request.onsuccess = null; + requestEventPromise = promiseForRequest(testCase, request); + } + + // requestEventPromise needs to be the last promise in the chain, because + // we want the event that it resolves to. + resolve(Promise.resolve(callbackResult).then(() => requestEventPromise)); + }); + request.onerror = event => reject(event.target.error); + request.onsuccess = () => { + const database = request.result; + testCase.add_cleanup(() => { database.close(); }); + reject(new Error( + 'indexedDB.open should not succeed without creating a ' + + 'versionchange transaction')); + }; + }).then(databaseOrError => { + if (databaseOrError instanceof IDBDatabase) + testCase.add_cleanup(() => { databaseOrError.close(); }); + return databaseOrError; + }); +} + +// Creates an IndexedDB database whose name is unique for the test case. +// +// setupCallback will be called during a versionchange transaction, and will be +// given the created database, the versionchange transaction, and the database +// open request. +// +// Returns a promise that resolves to an IndexedDB database. The caller should +// close the database. +function createDatabase(testCase, setupCallback) { + return createNamedDatabase(testCase, databaseName(testCase), setupCallback); +} + +// Creates an IndexedDB database. +// +// setupCallback will be called during a versionchange transaction, and will be +// given the created database, the versionchange transaction, and the database +// open request. +// +// Returns a promise that resolves to an IndexedDB database. The caller should +// close the database. +function createNamedDatabase(testCase, databaseName, setupCallback) { + const request = indexedDB.deleteDatabase(databaseName); + return promiseForRequest(testCase, request).then(() => { + testCase.add_cleanup(() => { indexedDB.deleteDatabase(databaseName); }); + return migrateNamedDatabase(testCase, databaseName, 1, setupCallback) + }); +} + +// Opens an IndexedDB database without performing schema changes. +// +// The given version number must match the database's current version. +// +// Returns a promise that resolves to an IndexedDB database. The caller should +// close the database. +function openDatabase(testCase, version) { + return openNamedDatabase(testCase, databaseName(testCase), version); +} + +// Opens an IndexedDB database without performing schema changes. +// +// The given version number must match the database's current version. +// +// Returns a promise that resolves to an IndexedDB database. The caller should +// close the database. +function openNamedDatabase(testCase, databaseName, version) { + const request = indexedDB.open(databaseName, version); + return promiseForRequest(testCase, request).then(database => { + testCase.add_cleanup(() => { database.close(); }); + return database; + }); +} + +// The data in the 'books' object store records in the first example of the +// IndexedDB specification. +const BOOKS_RECORD_DATA = [ + { title: 'Quarry Memories', author: 'Fred', isbn: 123456 }, + { title: 'Water Buffaloes', author: 'Fred', isbn: 234567 }, + { title: 'Bedrock Nights', author: 'Barney', isbn: 345678 }, +]; + +// Creates a 'books' object store whose contents closely resembles the first +// example in the IndexedDB specification. +const createBooksStore = (testCase, database) => { + const store = database.createObjectStore('books', + { keyPath: 'isbn', autoIncrement: true }); + store.createIndex('by_author', 'author'); + store.createIndex('by_title', 'title', { unique: true }); + for (const record of BOOKS_RECORD_DATA) + store.put(record); + return store; +} + +// Creates a 'books' object store whose contents closely resembles the first +// example in the IndexedDB specification, just without autoincrementing. +const createBooksStoreWithoutAutoIncrement = (testCase, database) => { + const store = database.createObjectStore('books', + { keyPath: 'isbn' }); + store.createIndex('by_author', 'author'); + store.createIndex('by_title', 'title', { unique: true }); + for (const record of BOOKS_RECORD_DATA) + store.put(record); + return store; +} + +// Creates a 'not_books' object store used to test renaming into existing or +// deleted store names. +function createNotBooksStore(testCase, database) { + const store = database.createObjectStore('not_books'); + store.createIndex('not_by_author', 'author'); + store.createIndex('not_by_title', 'title', { unique: true }); + return store; +} + +// Verifies that an object store's indexes match the indexes used to create the +// books store in the test database's version 1. +// +// The errorMessage is used if the assertions fail. It can state that the +// IndexedDB implementation being tested is incorrect, or that the testing code +// is using it incorrectly. +function checkStoreIndexes (testCase, store, errorMessage) { + assert_array_equals( + store.indexNames, ['by_author', 'by_title'], errorMessage); + const authorIndex = store.index('by_author'); + const titleIndex = store.index('by_title'); + return Promise.all([ + checkAuthorIndexContents(testCase, authorIndex, errorMessage), + checkTitleIndexContents(testCase, titleIndex, errorMessage), + ]); +} + +// Verifies that an object store's key generator is in the same state as the +// key generator created for the books store in the test database's version 1. +// +// The errorMessage is used if the assertions fail. It can state that the +// IndexedDB implementation being tested is incorrect, or that the testing code +// is using it incorrectly. +function checkStoreGenerator(testCase, store, expectedKey, errorMessage) { + const request = store.put( + { title: 'Bedrock Nights ' + expectedKey, author: 'Barney' }); + return promiseForRequest(testCase, request).then(result => { + assert_equals(result, expectedKey, errorMessage); + }); +} + +// Verifies that an object store's contents matches the contents used to create +// the books store in the test database's version 1. +// +// The errorMessage is used if the assertions fail. It can state that the +// IndexedDB implementation being tested is incorrect, or that the testing code +// is using it incorrectly. +function checkStoreContents(testCase, store, errorMessage) { + const request = store.get(123456); + return promiseForRequest(testCase, request).then(result => { + assert_equals(result.isbn, BOOKS_RECORD_DATA[0].isbn, errorMessage); + assert_equals(result.author, BOOKS_RECORD_DATA[0].author, errorMessage); + assert_equals(result.title, BOOKS_RECORD_DATA[0].title, errorMessage); + }); +} + +// Verifies that index matches the 'by_author' index used to create the +// by_author books store in the test database's version 1. +// +// The errorMessage is used if the assertions fail. It can state that the +// IndexedDB implementation being tested is incorrect, or that the testing code +// is using it incorrectly. +function checkAuthorIndexContents(testCase, index, errorMessage) { + const request = index.get(BOOKS_RECORD_DATA[2].author); + return promiseForRequest(testCase, request).then(result => { + assert_equals(result.isbn, BOOKS_RECORD_DATA[2].isbn, errorMessage); + assert_equals(result.title, BOOKS_RECORD_DATA[2].title, errorMessage); + }); +} + +// Verifies that an index matches the 'by_title' index used to create the books +// store in the test database's version 1. +// +// The errorMessage is used if the assertions fail. It can state that the +// IndexedDB implementation being tested is incorrect, or that the testing code +// is using it incorrectly. +function checkTitleIndexContents(testCase, index, errorMessage) { + const request = index.get(BOOKS_RECORD_DATA[2].title); + return promiseForRequest(testCase, request).then(result => { + assert_equals(result.isbn, BOOKS_RECORD_DATA[2].isbn, errorMessage); + assert_equals(result.author, BOOKS_RECORD_DATA[2].author, errorMessage); + }); +} + +// Returns an Uint8Array with pseudorandom data. +// +// The PRNG should be sufficient to defeat compression schemes, but it is not +// cryptographically strong. +function largeValue(size, seed) { + const buffer = new Uint8Array(size); + + // 32-bit xorshift - the seed can't be zero + let state = 1000 + seed; + + for (let i = 0; i < size; ++i) { + state ^= state << 13; + state ^= state >> 17; + state ^= state << 5; + buffer[i] = state & 0xff; + } + + return buffer; +} + +async function deleteAllDatabases(testCase) { + const dbs_to_delete = await indexedDB.databases(); + for( const db_info of dbs_to_delete) { + let request = indexedDB.deleteDatabase(db_info.name); + let eventWatcher = requestWatcher(testCase, request); + await eventWatcher.wait_for('success'); + } +} + +// Keeps the passed transaction alive indefinitely (by making requests +// against the named store). Returns a function that asserts that the +// transaction has not already completed and then ends the request loop so that +// the transaction may autocommit and complete. +function keepAlive(testCase, transaction, storeName) { + let completed = false; + transaction.addEventListener('complete', () => { completed = true; }); + + let keepSpinning = true; + + function spin() { + if (!keepSpinning) + return; + transaction.objectStore(storeName).get(0).onsuccess = spin; + } + spin(); + + return testCase.step_func(() => { + assert_false(completed, 'Transaction completed while kept alive'); + keepSpinning = false; + }); +} + +// Return a promise that resolves after a setTimeout finishes to break up the +// scope of a function's execution. +function timeoutPromise(ms) { + return new Promise(resolve => { setTimeout(resolve, ms); }); +} diff --git a/testing/web-platform/tests/IndexedDB/resources/support.js b/testing/web-platform/tests/IndexedDB/resources/support.js new file mode 100644 index 0000000000..18ed971ad7 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/support.js @@ -0,0 +1,225 @@ +/* Delete created databases + * + * Go through each finished test, see if it has an associated database. Close + * that and delete the database. */ +add_completion_callback(function(tests) +{ + for (var i in tests) + { + if(tests[i].db) + { + tests[i].db.close(); + self.indexedDB.deleteDatabase(tests[i].db.name); + } + } +}); + +function fail(test, desc) { + return test.step_func(function(e) { + if (e && e.message && e.target.error) + assert_unreached(desc + " (" + e.target.error.name + ": " + e.message + ")"); + else if (e && e.message) + assert_unreached(desc + " (" + e.message + ")"); + else if (e && e.target.readyState === 'done' && e.target.error) + assert_unreached(desc + " (" + e.target.error.name + ")"); + else + assert_unreached(desc); + }); +} + +function createdb(test, dbname, version) +{ + var rq_open = createdb_for_multiple_tests(dbname, version); + return rq_open.setTest(test); +} + +function createdb_for_multiple_tests(dbname, version) { + var rq_open, + fake_open = {}, + test = null, + dbname = (dbname ? dbname : "testdb-" + new Date().getTime() + Math.random() ); + + if (version) + rq_open = self.indexedDB.open(dbname, version); + else + rq_open = self.indexedDB.open(dbname); + + function auto_fail(evt, current_test) { + /* Fail handlers, if we haven't set on/whatever/, don't + * expect to get event whatever. */ + rq_open.manually_handled = {}; + + rq_open.addEventListener(evt, function(e) { + if (current_test !== test) { + return; + } + + test.step(function() { + if (!rq_open.manually_handled[evt]) { + assert_unreached("unexpected open." + evt + " event"); + } + + if (e.target.result + '' == '[object IDBDatabase]' && + !this.db) { + this.db = e.target.result; + + this.db.onerror = fail(test, 'unexpected db.error'); + this.db.onabort = fail(test, 'unexpected db.abort'); + this.db.onversionchange = + fail(test, 'unexpected db.versionchange'); + } + }); + }); + rq_open.__defineSetter__("on" + evt, function(h) { + rq_open.manually_handled[evt] = true; + if (!h) + rq_open.addEventListener(evt, function() {}); + else + rq_open.addEventListener(evt, test.step_func(h)); + }); + } + + // add a .setTest method to the IDBOpenDBRequest object + Object.defineProperty(rq_open, 'setTest', { + enumerable: false, + value: function(t) { + test = t; + + auto_fail("upgradeneeded", test); + auto_fail("success", test); + auto_fail("blocked", test); + auto_fail("error", test); + + return this; + } + }); + + return rq_open; +} + +function assert_key_equals(actual, expected, description) { + assert_equals(indexedDB.cmp(actual, expected), 0, description); +} + +// Usage: +// indexeddb_test( +// (test_object, db_connection, upgrade_tx, open_request) => { +// // Database creation logic. +// }, +// (test_object, db_connection, open_request) => { +// // Test logic. +// test_object.done(); +// }, +// 'Test case description'); +function indexeddb_test(upgrade_func, open_func, description, options) { + async_test(function(t) { + options = Object.assign({upgrade_will_abort: false}, options); + var dbname = location + '-' + t.name; + var del = indexedDB.deleteDatabase(dbname); + del.onerror = t.unreached_func('deleteDatabase should succeed'); + var open = indexedDB.open(dbname, 1); + open.onupgradeneeded = t.step_func(function() { + var db = open.result; + t.add_cleanup(function() { + // If open didn't succeed already, ignore the error. + open.onerror = function(e) { + e.preventDefault(); + }; + db.close(); + indexedDB.deleteDatabase(db.name); + }); + var tx = open.transaction; + upgrade_func(t, db, tx, open); + }); + if (options.upgrade_will_abort) { + open.onsuccess = t.unreached_func('open should not succeed'); + } else { + open.onerror = t.unreached_func('open should succeed'); + open.onsuccess = t.step_func(function() { + var db = open.result; + if (open_func) + open_func(t, db, open); + }); + } + }, description); +} + +// Call with a Test and an array of expected results in order. Returns +// a function; call the function when a result arrives and when the +// expected number appear the order will be asserted and test +// completed. +function expect(t, expected) { + var results = []; + return result => { + results.push(result); + if (results.length === expected.length) { + assert_array_equals(results, expected); + t.done(); + } + }; +} + +// Checks to see if the passed transaction is active (by making +// requests against the named store). +function is_transaction_active(tx, store_name) { + try { + const request = tx.objectStore(store_name).get(0); + request.onerror = e => { + e.preventDefault(); + e.stopPropagation(); + }; + return true; + } catch (ex) { + assert_equals(ex.name, 'TransactionInactiveError', + 'Active check should either not throw anything, or throw ' + + 'TransactionInactiveError'); + return false; + } +} + +// Keeps the passed transaction alive indefinitely (by making requests +// against the named store). Returns a function that asserts that the +// transaction has not already completed and then ends the request loop so that +// the transaction may autocommit and complete. +function keep_alive(tx, store_name) { + let completed = false; + tx.addEventListener('complete', () => { completed = true; }); + + let keepSpinning = true; + + function spin() { + if (!keepSpinning) + return; + tx.objectStore(store_name).get(0).onsuccess = spin; + } + spin(); + + return () => { + assert_false(completed, 'Transaction completed while kept alive'); + keepSpinning = false; + }; +} + +// Returns a new function. After it is called |count| times, |func| +// will be called. +function barrier_func(count, func) { + let n = 0; + return () => { + if (++n === count) + func(); + }; +} + +// Create an IndexedDB by executing script on the given remote context +// with |dbName| and |version|. +async function createIndexedDBForTesting(rc, dbName, version) { + await rc.executeScript((dbName, version) => { + let request = indexedDB.open(dbName, version); + request.onupgradeneeded = () => { + request.result.createObjectStore('store'); + } + request.onversionchange = () => { + fail(t, 'unexpectedly received versionchange event.'); + } + }, [dbName, version]); +} diff --git a/testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html b/testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html new file mode 100644 index 0000000000..613ddfe99d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html @@ -0,0 +1,28 @@ + +IndexedDB: Attempting to serialize a SharedArrayBuffer should throw + + + + diff --git a/testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html.headers b/testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html.headers new file mode 100644 index 0000000000..5f8621ef83 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/serialize-sharedarraybuffer-throws.https.html.headers @@ -0,0 +1,2 @@ +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Opener-Policy: same-origin diff --git a/testing/web-platform/tests/IndexedDB/storage-buckets.https.any.js b/testing/web-platform/tests/IndexedDB/storage-buckets.https.any.js new file mode 100644 index 0000000000..24923ffcf8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/storage-buckets.https.any.js @@ -0,0 +1,89 @@ +// META: title=Buckets API: Tests for indexedDB API. +// META: global=window,worker +// META: script=resources/support-promises.js + +promise_test(async testCase => { + const inboxBucket = await navigator.storageBuckets.open('inbox_bucket'); + const outboxBucket = await navigator.storageBuckets.open('outbox_bucket'); + testCase.add_cleanup(async () => { + await navigator.storageBuckets.delete('inbox_bucket'); + await navigator.storageBuckets.delete('outbox_bucket'); + }); + + // Set up similar databases in two buckets. + const inboxDb = await new Promise((resolve, reject) => { + const request = inboxBucket.indexedDB.open('messages'); + request.onupgradeneeded = (event) => { + const inboxStore = + event.target.result.createObjectStore('primary', {keyPath: 'id'}); + event.target.transaction.commit(); + }; + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); + + const txn = inboxDb.transaction(['primary'], 'readwrite'); + const inboxStore = txn.objectStore('primary'); + inboxStore.put({ subject: 'Bonjour', id: '42'}); + txn.commit(); + await promiseForTransaction(testCase, txn); + + const outboxDb = await new Promise((resolve, reject) => { + const request = outboxBucket.indexedDB.open('messages'); + request.onupgradeneeded = (event) => { + const outboxStore = + event.target.result.createObjectStore('primary', {keyPath: 'id'}); + event.target.transaction.commit(); + }; + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); + + const txn2 = outboxDb.transaction(['primary'], 'readwrite'); + const outboxStore = txn2.objectStore('primary'); + outboxStore.put({ subject: 're: Bonjour', id: '47'}); + txn2.commit(); + await promiseForTransaction(testCase, txn2); + + // Make sure it's possible to read from the bucket database. + const inboxMessage = await new Promise((resolve, reject) => { + const txn3 = inboxDb.transaction(['primary'], 'readonly'); + const inboxLookup = txn3.objectStore('primary').get('42'); + inboxLookup.onsuccess = (e) => resolve(inboxLookup.result); + inboxLookup.onerror = (e) => reject(inboxLookup.error); + }); + assert_equals(inboxMessage.subject, 'Bonjour'); + + // Make sure it's possible to read from the other bucket database. + const outboxMessage = await new Promise((resolve, reject) => { + const txn4 = outboxDb.transaction(['primary'], 'readonly'); + const outboxLookup = txn4.objectStore('primary').get('47'); + outboxLookup.onsuccess = (e) => resolve(outboxLookup.result); + outboxLookup.onerror = (e) => reject(outboxLookup.error); + }); + assert_equals(outboxMessage.subject, 're: Bonjour'); + + // Make sure they are different databases (looking up the data keyed on `47` + // fails in the first database). + const nonexistentInboxMessage = await new Promise((resolve, reject) => { + const txn5 = inboxDb.transaction(['primary'], 'readonly'); + const nonexistentInboxLookup = txn5.objectStore('primary').get('47'); + nonexistentInboxLookup.onsuccess = (e) => + resolve(nonexistentInboxLookup.result); + nonexistentInboxLookup.onerror = (e) => + reject(nonexistentInboxLookup.error); + }); + assert_equals(nonexistentInboxMessage, undefined); +}, 'Basic test that buckets create independent databases.'); + +promise_test(async testCase => { + const inboxBucket = await navigator.storageBuckets.open('inbox'); + await navigator.storageBuckets.delete('inbox'); + + return promise_rejects_dom( + testCase, 'UnknownError', new Promise((resolve, reject) => { + const request = inboxBucket.indexedDB.open('messages'); + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + })); +}, 'Tests trying to use indexedDB in a deleted bucket.'); diff --git a/testing/web-platform/tests/IndexedDB/string-list-ordering.htm b/testing/web-platform/tests/IndexedDB/string-list-ordering.htm new file mode 100644 index 0000000000..ddbbc3036f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/string-list-ordering.htm @@ -0,0 +1,85 @@ + + + + + +Test string list ordering in IndexedDB + + + + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/structured-clone-transaction-state.any.js b/testing/web-platform/tests/IndexedDB/structured-clone-transaction-state.any.js new file mode 100644 index 0000000000..adf3be2f70 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/structured-clone-transaction-state.any.js @@ -0,0 +1,96 @@ +// META: script=resources/support-promises.js +// META: title=Indexed DB transaction state during Structured Serializing +// META: timeout=long +'use strict'; + +promise_test(async testCase => { + const db = await createDatabase(testCase, database => { + database.createObjectStore('store'); + }); + + const transaction = db.transaction(['store'], 'readwrite'); + const objectStore = transaction.objectStore('store'); + + let getterCalled = false; + const activeValue = {}; + Object.defineProperty(activeValue, 'propertyName', { + enumerable: true, + get: testCase.step_func(() => { + getterCalled = true; + assert_throws_dom('TransactionInactiveError', () => { + objectStore.get('key'); + }, 'transaction should not be active during structured clone'); + return 'value that should not be used'; + }), + }); + objectStore.add(activeValue, 'key'); + await promiseForTransaction(testCase, transaction); + db.close(); + + assert_true(getterCalled, + "activeValue's getter should be called during test"); +}, 'Transaction inactive during structured clone in IDBObjectStore.add()'); + +promise_test(async testCase => { + const db = await createDatabase(testCase, database => { + database.createObjectStore('store'); + }); + + const transaction = db.transaction(['store'], 'readwrite'); + const objectStore = transaction.objectStore('store'); + + let getterCalled = false; + const activeValue = {}; + Object.defineProperty(activeValue, 'propertyName', { + enumerable: true, + get: testCase.step_func(() => { + getterCalled = true; + assert_throws_dom('TransactionInactiveError', () => { + objectStore.get('key'); + }, 'transaction should not be active during structured clone'); + return 'value that should not be used'; + }), + }); + + objectStore.put(activeValue, 'key'); + await promiseForTransaction(testCase, transaction); + db.close(); + + assert_true(getterCalled, + "activeValue's getter should be called during test"); +}, 'Transaction inactive during structured clone in IDBObjectStore.put()'); + +promise_test(async testCase => { + const db = await createDatabase(testCase, database => { + const objectStore = database.createObjectStore('store'); + objectStore.put({}, 'key'); + }); + + const transaction = db.transaction(['store'], 'readwrite'); + const objectStore = transaction.objectStore('store'); + + let getterCalled = false; + const activeValue = {}; + Object.defineProperty(activeValue, 'propertyName', { + enumerable: true, + get: testCase.step_func(() => { + getterCalled = true; + assert_throws_dom('TransactionInactiveError', () => { + objectStore.get('key'); + }, 'transaction should not be active during structured clone'); + return 'value that should not be used'; + }), + }); + + const request = objectStore.openCursor(); + request.onsuccess = testCase.step_func(() => { + const cursor = request.result; + cursor.update(activeValue); + }); + + await promiseForTransaction(testCase, transaction); + db.close(); + + assert_true(getterCalled, + "activeValue's getter should be called during test"); +}, 'Transaction inactive during structured clone in IDBCursor.update()'); diff --git a/testing/web-platform/tests/IndexedDB/structured-clone.any.js b/testing/web-platform/tests/IndexedDB/structured-clone.any.js new file mode 100644 index 0000000000..15ab0359e2 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/structured-clone.any.js @@ -0,0 +1,324 @@ +// META: title=Indexed DB and Structured Serializing/Deserializing +// META: timeout=long +// META: script=resources/support-promises.js +// META: script=/common/subset-tests.js +// META: variant=?1-20 +// META: variant=?21-40 +// META: variant=?41-60 +// META: variant=?61-80 +// META: variant=?81-100 +// META: variant=?101-last + +// Tests Indexed DB coverage of HTML's Safe "passing of structured data" +// https://html.spec.whatwg.org/multipage/structured-data.html + +function describe(value) { + let type, str; + if (typeof value === 'object' && value) { + type = Object.getPrototypeOf(value).constructor.name; + // Handle Number(-0), etc. + str = Object.is(value.valueOf(), -0) ? '-0' : String(value); + } else { + type = typeof value; + // Handle primitive -0. + str = Object.is(value, -0) ? '-0' : String(value); + } + return `${type}: ${str}`; +} + +function cloneTest(value, verifyFunc) { + subsetTest(promise_test, async t => { + const db = await createDatabase(t, db => { + const store = db.createObjectStore('store'); + // This index is not used, but evaluating key path on each put() + // call will exercise (de)serialization. + store.createIndex('index', 'dummyKeyPath'); + }); + t.add_cleanup(() => { + if (db) { + db.close(); + indexedDB.deleteDatabase(db.name); + } + }); + const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + await promiseForRequest(t, store.put(value, 'key')); + const result = await promiseForRequest(t, store.get('key')); + await verifyFunc(value, result); + await promiseForTransaction(t, tx); + }, describe(value)); +} + +// Specialization of cloneTest() for objects, with common asserts. +function cloneObjectTest(value, verifyFunc) { + cloneTest(value, async (orig, clone) => { + assert_not_equals(orig, clone); + assert_equals(typeof clone, 'object'); + assert_equals(Object.getPrototypeOf(orig), Object.getPrototypeOf(clone)); + await verifyFunc(orig, clone); + }); +} + +function cloneFailureTest(value) { + subsetTest(promise_test, async t => { + const db = await createDatabase(t, db => { + db.createObjectStore('store'); + }); + t.add_cleanup(() => { + if (db) { + db.close(); + indexedDB.deleteDatabase(db.name); + } + }); + const tx = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + const store = tx.objectStore('store'); + assert_throws_dom('DataCloneError', () => store.put(value, 'key')); + }, 'Not serializable: ' + describe(value)); +} + +// +// ECMAScript types +// + +// Primitive values: Undefined, Null, Boolean, Number, BigInt, String +const booleans = [false, true]; +const numbers = [ + NaN, + -Infinity, + -Number.MAX_VALUE, + -0xffffffff, + -0x80000000, + -0x7fffffff, + -1, + -Number.MIN_VALUE, + -0, + 0, + 1, + Number.MIN_VALUE, + 0x7fffffff, + 0x80000000, + 0xffffffff, + Number.MAX_VALUE, + Infinity, +]; +const bigints = [ + -12345678901234567890n, + -1n, + 0n, + 1n, + 12345678901234567890n, +]; +const strings = [ + '', + 'this is a sample string', + 'null(\0)', +]; + +[undefined, null].concat(booleans, numbers, bigints, strings) + .forEach(value => cloneTest(value, (orig, clone) => { + assert_equals(orig, clone); + })); + +// "Primitive" Objects (Boolean, Number, BigInt, String) +[].concat(booleans, numbers, bigints, strings) + .forEach(value => cloneObjectTest(Object(value), (orig, clone) => { + assert_equals(orig.valueOf(), clone.valueOf()); + })); + +// Dates +[ + new Date(-1e13), + new Date(-1e12), + new Date(-1e9), + new Date(-1e6), + new Date(-1e3), + new Date(0), + new Date(1e3), + new Date(1e6), + new Date(1e9), + new Date(1e12), + new Date(1e13) +].forEach(value => cloneTest(value, (orig, clone) => { + assert_not_equals(orig, clone); + assert_equals(typeof clone, 'object'); + assert_equals(Object.getPrototypeOf(orig), Object.getPrototypeOf(clone)); + assert_equals(orig.valueOf(), clone.valueOf()); + })); + +// Regular Expressions +[ + new RegExp(), + /abc/, + /abc/g, + /abc/i, + /abc/gi, + /abc/m, + /abc/mg, + /abc/mi, + /abc/mgi, + /abc/gimsuy, +].forEach(value => cloneObjectTest(value, (orig, clone) => { + assert_equals(orig.toString(), clone.toString()); +})); + +// ArrayBuffer +cloneObjectTest(new Uint8Array([0, 1, 254, 255]).buffer, (orig, clone) => { + assert_array_equals(new Uint8Array(orig), new Uint8Array(clone)); +}); + +// TODO SharedArrayBuffer + +// Array Buffer Views +[ + new Uint8Array([]), + new Uint8Array([0, 1, 254, 255]), + new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]), + new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]), + new Int8Array([0, 1, 254, 255]), + new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]), + new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]), + new Uint8ClampedArray([0, 1, 254, 255]), + new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN]), + new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, + Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN]) +].forEach(value => cloneObjectTest(value, (orig, clone) => { + assert_array_equals(orig, clone); +})); + +// Map +cloneObjectTest(new Map([[1,2],[3,4]]), (orig, clone) => { + assert_array_equals([...orig.keys()], [...clone.keys()]); + assert_array_equals([...orig.values()], [...clone.values()]); +}); + +// Set +cloneObjectTest(new Set([1,2,3,4]), (orig, clone) => { + assert_array_equals([...orig.values()], [...clone.values()]); +}); + +// Error +[ + new Error(), + new Error('abc', 'def'), + new EvalError(), + new EvalError('ghi', 'jkl'), + new RangeError(), + new RangeError('ghi', 'jkl'), + new ReferenceError(), + new ReferenceError('ghi', 'jkl'), + new SyntaxError(), + new SyntaxError('ghi', 'jkl'), + new TypeError(), + new TypeError('ghi', 'jkl'), + new URIError(), + new URIError('ghi', 'jkl'), +].forEach(value => cloneObjectTest(value, (orig, clone) => { + assert_equals(orig.name, clone.name); + assert_equals(orig.message, clone.message); +})); + +// Arrays +[ + [], + [1,2,3], + Object.assign( + ['foo', 'bar'], + {10: true, 11: false, 20: 123, 21: 456, 30: null}), + Object.assign( + ['foo', 'bar'], + {a: true, b: false, foo: 123, bar: 456, '': null}), +].forEach(value => cloneObjectTest(value, (orig, clone) => { + assert_array_equals(orig, clone); + assert_array_equals(Object.keys(orig), Object.keys(clone)); + Object.keys(orig).forEach(key => { + assert_equals(orig[key], clone[key], `Property ${key}`); + }); +})); + +// Objects +cloneObjectTest({foo: true, bar: false}, (orig, clone) => { + assert_array_equals(Object.keys(orig), Object.keys(clone)); + Object.keys(orig).forEach(key => { + assert_equals(orig[key], clone[key], `Property ${key}`); + }); +}); + +// +// [Serializable] Platform objects +// + +// TODO: Test these additional interfaces: +// * DOMQuad +// * DOMException +// * RTCCertificate + +// Geometry types +[ + new DOMMatrix(), + new DOMMatrixReadOnly(), + new DOMPoint(), + new DOMPointReadOnly(), + new DOMRect, + new DOMRectReadOnly(), +].forEach(value => cloneObjectTest(value, (orig, clone) => { + Object.keys(Object.getPrototypeOf(orig)).forEach(key => { + assert_equals(orig[key], clone[key], `Property ${key}`); + }); +})); + +// ImageData +const image_data = new ImageData(8, 8); +for (let i = 0; i < 256; ++i) { + image_data.data[i] = i; +} +cloneObjectTest(image_data, (orig, clone) => { + assert_equals(orig.width, clone.width); + assert_equals(orig.height, clone.height); + assert_array_equals(orig.data, clone.data); +}); + +// Blob +cloneObjectTest( + new Blob(['This is a test.'], {type: 'a/b'}), + async (orig, clone) => { + assert_equals(orig.size, clone.size); + assert_equals(orig.type, clone.type); + assert_equals(await orig.text(), await clone.text()); + }); + +// File +cloneObjectTest( + new File(['This is a test.'], 'foo.txt', {type: 'c/d'}), + async (orig, clone) => { + assert_equals(orig.size, clone.size); + assert_equals(orig.type, clone.type); + assert_equals(orig.name, clone.name); + assert_equals(orig.lastModified, clone.lastModified); + assert_equals(await orig.text(), await clone.text()); + }); + + +// FileList - exposed in Workers, but not constructable. +if ('document' in self) { + // TODO: Test with populated list. + cloneObjectTest( + Object.assign(document.createElement('input'), + {type: 'file', multiple: true}).files, + async (orig, clone) => { + assert_equals(orig.length, clone.length); + }); +} + +// +// Non-serializable types +// +[ + // ECMAScript types + function() {}, + Symbol('desc'), + + // Non-[Serializable] platform objects + self, + new Event(''), + new MessageChannel() +].forEach(cloneFailureTest); diff --git a/testing/web-platform/tests/IndexedDB/transaction-abort-generator-revert.html b/testing/web-platform/tests/IndexedDB/transaction-abort-generator-revert.html new file mode 100644 index 0000000000..bbe0338c3a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-abort-generator-revert.html @@ -0,0 +1,110 @@ + + +IndexedDB: aborting transactions reverts an object store's key generator state + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-abort-index-metadata-revert.html b/testing/web-platform/tests/IndexedDB/transaction-abort-index-metadata-revert.html new file mode 100644 index 0000000000..54a873d875 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-abort-index-metadata-revert.html @@ -0,0 +1,278 @@ + + +IndexedDB: aborting transactions reverts index metadata + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-abort-multiple-metadata-revert.html b/testing/web-platform/tests/IndexedDB/transaction-abort-multiple-metadata-revert.html new file mode 100644 index 0000000000..18abd0588c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-abort-multiple-metadata-revert.html @@ -0,0 +1,293 @@ + + +IndexedDB: aborting transactions reverts multiple operations on the same metadata + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-abort-object-store-metadata-revert.html b/testing/web-platform/tests/IndexedDB/transaction-abort-object-store-metadata-revert.html new file mode 100644 index 0000000000..c31537bc5c --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-abort-object-store-metadata-revert.html @@ -0,0 +1,235 @@ + + +IndexedDB: aborting transactions reverts object store metadata + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-abort-request-error.html b/testing/web-platform/tests/IndexedDB/transaction-abort-request-error.html new file mode 100644 index 0000000000..285e1112c0 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-abort-request-error.html @@ -0,0 +1,68 @@ + + +IndexedDB: Test error events fired at requests from aborted transaction + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm b/testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm new file mode 100644 index 0000000000..d5bcfd45d8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm @@ -0,0 +1,82 @@ + + +Attempt to create new transactions inside a versionchange transaction + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/transaction-deactivation-timing.html b/testing/web-platform/tests/IndexedDB/transaction-deactivation-timing.html new file mode 100644 index 0000000000..ae2e6f6463 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-deactivation-timing.html @@ -0,0 +1,143 @@ + + +Transactions deactivation timing + + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-lifetime-blocked.htm b/testing/web-platform/tests/IndexedDB/transaction-lifetime-blocked.htm new file mode 100644 index 0000000000..760b6b9bdb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-lifetime-blocked.htm @@ -0,0 +1,111 @@ + +Blocked event + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/transaction-lifetime-empty.html b/testing/web-platform/tests/IndexedDB/transaction-lifetime-empty.html new file mode 100644 index 0000000000..86bd41ae62 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-lifetime-empty.html @@ -0,0 +1,89 @@ + +IndexedDB: Commit ordering of empty transactions + + + + diff --git a/testing/web-platform/tests/IndexedDB/transaction-lifetime.htm b/testing/web-platform/tests/IndexedDB/transaction-lifetime.htm new file mode 100644 index 0000000000..996f62937f --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-lifetime.htm @@ -0,0 +1,104 @@ + +Test events opening a second database when one connection is open already + + + + + +
+ + diff --git a/testing/web-platform/tests/IndexedDB/transaction-relaxed-durability.tentative.any.js b/testing/web-platform/tests/IndexedDB/transaction-relaxed-durability.tentative.any.js new file mode 100644 index 0000000000..9197389a24 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-relaxed-durability.tentative.any.js @@ -0,0 +1,53 @@ +// META: script=resources/support-promises.js +// META: timeout=long + +/** + * This file contains the webplatform smoke tests for the optional + * durability parameter of the IndexedDB transaction API. + * + * @author enne@chromium.org + */ + +// Smoke test optional parameter on IndexedDB.transaction. +let cases = [ + { options: undefined, expected: 'default' }, + { options: {}, expected: 'default' }, + { options: { durability: 'default'}, expected: 'default' }, + { options: { durability: 'relaxed'}, expected: 'relaxed' }, + { options: { durability: 'strict'}, expected: 'strict' }, +]; + +for (let i = 0; i < cases.length; ++i) { + promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + const txn = db.transaction(['books'], 'readwrite', cases[i].options); + const objectStore = txn.objectStore('books'); + objectStore.put({isbn: 'one', title: 'title1'}); + await promiseForTransaction(testCase, txn); + + assert_equals(txn.durability, cases[i].expected); + + const txn2 = db.transaction(['books'], 'readonly'); + const objectStore2 = txn2.objectStore('books'); + const getTitle1 = objectStore2.get('one'); + await promiseForTransaction(testCase, txn2); + assert_array_equals( + [getTitle1.result.title], + ['title1'], + 'The title should match that which was put.'); + db.close(); + }, 'Committed data can be read back out: case ' + i); +} + +promise_test(async testCase => { + const db = await createDatabase(testCase, db => { + createBooksStore(testCase, db); + }); + + assert_throws_js(TypeError, function() { + db.transaction(['books'], 'readwrite', { durability: 'invalid' }); + }); + db.close(); +}, 'Invalid durability option throws a TypeError'); diff --git a/testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm b/testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm new file mode 100644 index 0000000000..cef8699df4 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm @@ -0,0 +1,89 @@ + + +Transactions have a request queue + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-across-connections.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-across-connections.any.js new file mode 100644 index 0000000000..06d886fe83 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-across-connections.any.js @@ -0,0 +1,72 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + }, + + (t, db1) => { + // Open a second connection to the same database. + const open_request = indexedDB.open(db1.name); + open_request.onerror = t.unreached_func('open() should succeed'); + open_request.onupgradeneeded = + t.unreached_func('second connection should not upgrade'); + open_request.onsuccess = t.step_func(() => { + const db2 = open_request.result; + t.add_cleanup(() => { db2.close(); }); + + const transaction1 = db1.transaction('store', 'readwrite', {durability: 'relaxed'}); + transaction1.onabort = t.unreached_func('transaction1 should complete'); + + const transaction2 = db2.transaction('store', 'readwrite', {durability: 'relaxed'}); + transaction2.onabort = t.unreached_func('transaction2 should complete'); + + let transaction1PutSuccess = false; + let transaction1Complete = false; + let transaction2PutSuccess = false; + + // Keep transaction1 alive for a while and ensure transaction2 + // doesn't start. + + let count = 0; + (function doTransaction1Put() { + const request = transaction1.objectStore('store').put(1, count++); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(evt => { + transaction1PutSuccess = true; + if (count < 5) { + doTransaction1Put(); + } + }); + }()); + + transaction1.oncomplete = t.step_func(evt => { + transaction1Complete = true; + assert_false( + transaction2PutSuccess, + 'transaction1 should complete before transaction2 put succeeds'); + }); + + const request = transaction2.objectStore('store').put(2, 0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(evt => { + transaction2PutSuccess = true; + assert_true( + transaction1Complete, + 'transaction2 put should not succeed before transaction1 completes'); + }); + + transaction2.oncomplete = t.step_func_done(evt => { + assert_true( + transaction1PutSuccess, + 'transaction1 put should succeed before transaction2 runs'); + assert_true( + transaction1Complete, + 'transaction1 should complete before transaction2 runs'); + assert_true( + transaction2PutSuccess, + 'transaction2 put should succeed before transaction2 completes'); + }); + }); + }, + "Check that readwrite transactions with overlapping scopes do not run in parallel."); diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-across-databases.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-across-databases.any.js new file mode 100644 index 0000000000..09d8ef20d1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-across-databases.any.js @@ -0,0 +1,72 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + }, + + (t, db1) => { + // Open a second database. + const db2name = db1.name + '-2'; + const delete_request = indexedDB.deleteDatabase(db2name); + delete_request.onerror = t.unreached_func('deleteDatabase() should succeed'); + const open_request = indexedDB.open(db2name, 1); + open_request.onerror = t.unreached_func('open() should succeed'); + open_request.onupgradeneeded = t.step_func(() => { + const db2 = open_request.result; + const store = db2.createObjectStore('store'); + }); + open_request.onsuccess = t.step_func(() => { + const db2 = open_request.result; + t.add_cleanup(() => { + db2.close(); + indexedDB.deleteDatabase(db2.name); + }); + + let transaction1PutSuccess = false; + let transaction2PutSuccess = false; + + const onTransactionComplete = barrier_func(2, t.step_func_done(() => { + assert_true(transaction1PutSuccess, + 'transaction1 should have executed at least one request'); + assert_true(transaction2PutSuccess, + 'transaction1 should have executed at least one request'); + })); + + + const transaction1 = db1.transaction('store', 'readwrite', {durability: 'relaxed'}); + transaction1.onabort = t.unreached_func('transaction1 should complete'); + transaction1.oncomplete = t.step_func(onTransactionComplete); + + const transaction2 = db2.transaction('store', 'readwrite', {durability: 'relaxed'}); + transaction2.onabort = t.unreached_func('transaction2 should complete'); + transaction2.oncomplete = t.step_func(onTransactionComplete); + + // Keep both transactions alive until each has reported at least one + // successful operation. + + function doTransaction1Put() { + const request = transaction1.objectStore('store').put(0, 0); + request.onerror = t.unreached_func('put request should succeed'); + request.onsuccess = t.step_func(() => { + transaction1PutSuccess = true; + if (!transaction2PutSuccess) + doTransaction1Put(); + }); + } + + function doTransaction2Put() { + const request = transaction2.objectStore('store').put(0, 0); + request.onerror = t.unreached_func('put request should succeed'); + request.onsuccess = t.step_func(() => { + transaction2PutSuccess = true; + if (!transaction1PutSuccess) + doTransaction2Put(); + }); + } + + doTransaction1Put(); + doTransaction2Put(); + }); + }, + "Check that transactions in different databases can run in parallel."); diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-mixed-scopes.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-mixed-scopes.any.js new file mode 100644 index 0000000000..6f550c58a5 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-mixed-scopes.any.js @@ -0,0 +1,63 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + db.createObjectStore('a'); + db.createObjectStore('b'); + db.createObjectStore('c'); + }, + + (t, db) => { + let transaction1Started = false; + let transaction1Complete = false; + let transaction2Started = false; + let transaction2Complete = false; + let transaction3Started = false; + let transaction3Complete = false; + + const transaction1 = db.transaction(['a'], 'readonly'); + let request = transaction1.objectStore('a').get(0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(() => { + transaction1Started = true; + }); + transaction1.onabort = t.unreached_func('transaction1 should complete'); + transaction1.oncomplete = t.step_func(() => { + transaction1Complete = true; + assert_false(transaction2Started); + assert_false(transaction3Started); + }); + + + // transaction2 overlaps with transaction1, so must wait until transaction1 + // completes. + const transaction2 = db.transaction(['a', 'b'], 'readwrite'); + request = transaction2.objectStore('a').get(0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(() => { + assert_true(transaction1Complete); + transaction2Started = true; + }); + transaction2.onabort = t.unreached_func('transaction2 should complete'); + transaction2.oncomplete = t.step_func(() => { + transaction2Complete = true; + assert_false(transaction3Started); + }); + + // transaction3 overlaps with transaction2, so must wait until transaction2 + // completes even though it does not overlap with transaction1. + const transaction3 = db.transaction(['b', 'c'], 'readonly'); + request = transaction3.objectStore('b').get(0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(() => { + assert_true(transaction1Complete); + assert_true(transaction2Complete); + transaction3Started = true; + }); + transaction3.onabort = t.unreached_func('transaction3 should complete'); + transaction3.oncomplete = t.step_func_done(() => { + transaction3Complete = true; + }); + }, + "Check that scope restrictions on mixed transactions are enforced."); diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-ordering.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-ordering.any.js new file mode 100644 index 0000000000..42d056e9a1 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-ordering.any.js @@ -0,0 +1,40 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + }, + + (t, db) => { + // Create in order tx1, tx2. + const tx1 = db.transaction('store', 'readwrite', { durability: 'relaxed' }); + const tx2 = db.transaction('store', 'readwrite', { durability: 'relaxed' }); + + // Use in order tx2, tx1. + tx2.objectStore('store').get(0); + tx1.objectStore('store').get(0); + + const order = []; + const done = barrier_func(2, t.step_func_done(() => { + // IndexedDB Spec: + // https://w3c.github.io/IndexedDB/#transaction-scheduling + // + // If multiple "readwrite" transactions are attempting to + // access the same object store (i.e. if they have overlapping + // scope), the transaction that was created first must be the + // transaction which gets access to the object store first. + // + assert_array_equals(order, [1, 2]); + })); + + tx1.oncomplete = t.step_func(e => { + order.push(1); + done(); + }); + + tx2.oncomplete = t.step_func(e => { + order.push(2); + done(); + }); + }, + "Verify Indexed DB transactions are ordered per spec"); diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-ro-waits-for-rw.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-ro-waits-for-rw.any.js new file mode 100644 index 0000000000..ae0d126808 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-ro-waits-for-rw.any.js @@ -0,0 +1,26 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + store.put('value', 'key'); + }, + + (t, db) => { + const transaction1 = db.transaction('store', 'readwrite', {durability: 'relaxed'}); + transaction1.onabort = t.unreached_func('transaction1 should not abort'); + + const transaction2 = db.transaction('store', 'readonly', {durability: 'relaxed'}); + transaction2.onabort = t.unreached_func('transaction2 should not abort'); + + const request = transaction1.objectStore('store').put('new value', 'key'); + request.onerror = t.unreached_func('request should not fail'); + + const request2 = transaction2.objectStore('store').get('key'); + request2.onerror = t.unreached_func('request2 should not fail'); + request2.onsuccess = t.step_func_done(evt => { + assert_equals(request2.result, 'new value', + 'Request should see new value.'); + }); + }, + "readonly transaction should see the result of a previous readwrite transaction"); diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-rw-scopes.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-rw-scopes.any.js new file mode 100644 index 0000000000..7296fef3b0 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-rw-scopes.any.js @@ -0,0 +1,63 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + db.createObjectStore('a'); + db.createObjectStore('b'); + db.createObjectStore('c'); + }, + + (t, db) => { + let transaction1Started = false; + let transaction1Complete = false; + let transaction2Started = false; + let transaction2Complete = false; + let transaction3Started = false; + let transaction3Complete = false; + + const transaction1 = db.transaction(['a'], 'readwrite'); + let request = transaction1.objectStore('a').get(0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(() => { + transaction1Started = true; + }); + transaction1.onabort = t.unreached_func('transaction1 should complete'); + transaction1.oncomplete = t.step_func(() => { + transaction1Complete = true; + assert_false(transaction2Started); + assert_false(transaction3Started); + }); + + + // transaction2 overlaps with transaction1, so must wait until transaction1 + // completes. + const transaction2 = db.transaction(['a', 'b'], 'readwrite'); + request = transaction2.objectStore('a').get(0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(() => { + assert_true(transaction1Complete); + transaction2Started = true; + }); + transaction2.onabort = t.unreached_func('transaction2 should complete'); + transaction2.oncomplete = t.step_func(() => { + transaction2Complete = true; + assert_false(transaction3Started); + }); + + // transaction3 overlaps with transaction2, so must wait until transaction2 + // completes even though it does not overlap with transaction1. + const transaction3 = db.transaction(['b', 'c'], 'readwrite'); + request = transaction3.objectStore('b').get(0); + request.onerror = t.unreached_func('request should succeed'); + request.onsuccess = t.step_func(() => { + assert_true(transaction1Complete); + assert_true(transaction2Complete); + transaction3Started = true; + }); + transaction3.onabort = t.unreached_func('transaction3 should complete'); + transaction3.oncomplete = t.step_func_done(() => { + transaction3Complete = true; + }); + }, + "Check that scope restrictions on read-write transactions are enforced."); diff --git a/testing/web-platform/tests/IndexedDB/transaction-scheduling-within-database.any.js b/testing/web-platform/tests/IndexedDB/transaction-scheduling-within-database.any.js new file mode 100644 index 0000000000..a9a20bae3a --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-scheduling-within-database.any.js @@ -0,0 +1,55 @@ +// META: script=resources/support.js + +indexeddb_test( + (t, db) => { + const store = db.createObjectStore('store'); + store.put('value', 'key'); + }, + + (t, db) => { + let transaction1GetSuccess = false; + let transaction2GetSuccess = false; + + const onTransactionComplete = barrier_func(2, t.step_func_done(() => { + assert_true(transaction1GetSuccess, + 'transaction1 should have executed at least one request'); + assert_true(transaction2GetSuccess, + 'transaction1 should have executed at least one request'); + })); + + const transaction1 = db.transaction('store', 'readonly', {durability: 'relaxed'}); + transaction1.onabort = t.unreached_func('transaction1 should not abort'); + transaction1.oncomplete = t.step_func(onTransactionComplete); + + const transaction2 = db.transaction('store', 'readonly', {durability: 'relaxed'}); + transaction2.onabort = t.unreached_func('transaction2 should not abort'); + transaction2.oncomplete = t.step_func(onTransactionComplete); + + // Keep both transactions alive until each has reported at least one + // successful operation + + function doTransaction1Get() { + const request = transaction1.objectStore('store').get('key'); + request.onerror = t.unreached_func('request should not fail'); + request.onsuccess = t.step_func(() => { + transaction1GetSuccess = true; + if (!transaction2GetSuccess) + doTransaction1Get(); + }); + } + + function doTransaction2Get() { + // NOTE: No logging since execution order is not deterministic. + const request = transaction2.objectStore('store').get('key'); + request.onerror = t.unreached_func('request should not fail'); + request.onsuccess = t.step_func(() => { + transaction2GetSuccess = true; + if (!transaction1GetSuccess) + doTransaction2Get(); + }); + } + + doTransaction1Get(); + doTransaction2Get(); + }, + 'Check that read-only transactions within a database can run in parallel.'); diff --git a/testing/web-platform/tests/IndexedDB/transaction_bubble-and-capture.htm b/testing/web-platform/tests/IndexedDB/transaction_bubble-and-capture.htm new file mode 100644 index 0000000000..9b6694b980 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction_bubble-and-capture.htm @@ -0,0 +1,75 @@ + + +Capture and bubble + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/upgrade-transaction-deactivation-timing.html b/testing/web-platform/tests/IndexedDB/upgrade-transaction-deactivation-timing.html new file mode 100644 index 0000000000..8119c9ab26 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/upgrade-transaction-deactivation-timing.html @@ -0,0 +1,48 @@ + + +Upgrade transaction deactivation timing + + + + + diff --git a/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-backend-aborted.html b/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-backend-aborted.html new file mode 100644 index 0000000000..862e85144d --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-backend-aborted.html @@ -0,0 +1,84 @@ + + +IndexedDB: backend-aborted versionchange transaction lifecycle + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-committed.html b/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-committed.html new file mode 100644 index 0000000000..347d940aee --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-committed.html @@ -0,0 +1,80 @@ + + +IndexedDB: committed versionchange transaction lifecycle + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-user-aborted.html b/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-user-aborted.html new file mode 100644 index 0000000000..4094ce34f3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/upgrade-transaction-lifecycle-user-aborted.html @@ -0,0 +1,143 @@ + + +IndexedDB: user-abort()ed versionchange transaction lifecycle + + + + + + + + diff --git a/testing/web-platform/tests/IndexedDB/value.htm b/testing/web-platform/tests/IndexedDB/value.htm new file mode 100644 index 0000000000..32d7540ab3 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/value.htm @@ -0,0 +1,40 @@ + + +Values + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/value_recursive.htm b/testing/web-platform/tests/IndexedDB/value_recursive.htm new file mode 100644 index 0000000000..e02c908a35 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/value_recursive.htm @@ -0,0 +1,66 @@ + + +Recursive value + + + + + + + +
diff --git a/testing/web-platform/tests/IndexedDB/writer-starvation.htm b/testing/web-platform/tests/IndexedDB/writer-starvation.htm new file mode 100644 index 0000000000..df9c5dc757 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/writer-starvation.htm @@ -0,0 +1,105 @@ + + +Writer starvation + + + + + + + + +
-- cgit v1.2.3