diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm')
-rw-r--r-- | testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm | 89 |
1 files changed, 89 insertions, 0 deletions
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 000000000..a0ec288cb --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_createIndex14-exception_order.htm @@ -0,0 +1,89 @@ +<!DOCTYPE html> +<title>IndexedDB: Exception Order of IDBObjectStore.createIndex()</title> +<link rel="author" title="Mozilla" href="https://www.mozilla.org"> +<link rel="help" href="http://w3c.github.io/IndexedDB/#dom-idbobjectstore-createindex"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="support.js"></script> +<script> + +indexeddb_test( + function(t, db, txn) { + var store = db.createObjectStore("s"); + }, + function(t, db) { + var txn = db.transaction("s"); + var store = txn.objectStore("s"); + txn.oncomplete = function() { + assert_throws("InvalidStateError", function() { + store.createIndex("index", "foo"); + }, "Mode check should precede state check of the transaction"); + t.done(); + }; + }, + "InvalidStateError(Incorrect mode) vs. TransactionInactiveError" +); + +var gDeletedObjectStore; +indexeddb_test( + function(t, db, txn) { + gDeletedObjectStore = db.createObjectStore("s"); + db.deleteObjectStore("s"); + txn.oncomplete = function() { + assert_throws("InvalidStateError", function() { + gDeletedObjectStore.createIndex("index", "foo"); + }, "Deletion check should precede transaction-state check"); + t.done(); + }; + }, + null, + "InvalidStateError(Deleted ObjectStore) vs. TransactionInactiveError" +); + +indexeddb_test( + function(t, db, txn) { + var store = db.createObjectStore("s"); + store.createIndex("index", "foo"); + txn.oncomplete = function() { + assert_throws("TransactionInactiveError", function() { + store.createIndex("index", "foo"); + }, "Transaction-state check should precede index name check"); + t.done(); + }; + }, + null, + "TransactionInactiveError vs. ConstraintError" +); + +indexeddb_test( + function(t, db) { + var store = db.createObjectStore("s"); + store.createIndex("index", "foo"); + assert_throws("ConstraintError", function() { + store.createIndex("index", "invalid key path"); + }, "Index name check should precede syntax check of the key path"); + assert_throws("ConstraintError", function() { + store.createIndex("index", + ["invalid key path 1", "invalid key path 2"]); + }, "Index name check should precede syntax check of the key path"); + t.done(); + }, + null, + "ConstraintError vs. SyntaxError" +); + +indexeddb_test( + function(t, db) { + var store = db.createObjectStore("s"); + assert_throws("SyntaxError", function() { + store.createIndex("index", + ["invalid key path 1", "invalid key path 2"], + { multiEntry: true }); + }, "Syntax check should precede multiEntry check of the key path"); + t.done(); + }, + null, + "SyntaxError vs. InvalidAccessError" +); + +</script> |