Skip to content

Commit

Permalink
Indexed DB: remove assert_throws(null, ...) usage (web-platform-tests…
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored and inexorabletash committed Apr 6, 2017
1 parent 5ad0f83 commit 1bcfa6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<script src=support.js></script>

<script>
function invalid_optionalParameters(desc, params) {
function invalid_optionalParameters(desc, params, exception = "InvalidAccessError") {
var t = async_test(document.title + " - " + desc);

createdb(t).onupgradeneeded = function(e) {
assert_throws(null, function() {
assert_throws(exception, function() {
e.target.result.createObjectStore("store", params);
});

Expand All @@ -20,9 +20,9 @@
}

invalid_optionalParameters("autoInc and empty keyPath", {autoIncrement: true, keyPath: ""});
invalid_optionalParameters("autoInc and keyPath array", {autoIncrement: true, keyPath: []});
invalid_optionalParameters("autoInc and keyPath array", {autoIncrement: true, keyPath: []}, "SyntaxError");
invalid_optionalParameters("autoInc and keyPath array 2", {autoIncrement: true, keyPath: ["hey"]});
invalid_optionalParameters("autoInc and keyPath object", {autoIncrement: true, keyPath: {a:"hey", b:2}});
invalid_optionalParameters("autoInc and keyPath object", {autoIncrement: true, keyPath: {a:"hey", b:2}}, "SyntaxError");

</script>

Expand Down
21 changes: 11 additions & 10 deletions IndexedDB/idbobjectstore_deleted.htm
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
db.deleteObjectStore("store");
assert_equals(db.objectStoreNames.length, 0, "objectStoreNames.length after delete");

assert_throws(null, function() { objStore.add(2); });
assert_throws(null, function() { objStore.put(3); });
assert_throws(null, function() { objStore.get(1); });
assert_throws(null, function() { objStore.clear(); });
assert_throws(null, function() { objStore.count(); });
assert_throws(null, function() { objStore.delete(1); });
assert_throws(null, function() { objStore.openCursor(); });
assert_throws(null, function() { objStore.index("idx"); });
assert_throws(null, function() { objStore.deleteIndex("idx"); });
assert_throws(null, function() { objStore.createIndex("idx2", "a"); });
const exc = "InvalidStateError"
assert_throws(exc, function() { objStore.add(2); });
assert_throws(exc, function() { objStore.put(3); });
assert_throws(exc, function() { objStore.get(1); });
assert_throws(exc, function() { objStore.clear(); });
assert_throws(exc, function() { objStore.count(); });
assert_throws(exc, function() { objStore.delete(1); });
assert_throws(exc, function() { objStore.openCursor(); });
assert_throws(exc, function() { objStore.index("idx"); });
assert_throws(exc, function() { objStore.deleteIndex("idx"); });
assert_throws(exc, function() { objStore.createIndex("idx2", "a"); });
}

open_rq.onsuccess = function() {
Expand Down

0 comments on commit 1bcfa6e

Please sign in to comment.