summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /testing/web-platform/tests/IndexedDB
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/IndexedDB')
-rw-r--r--testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.any.js89
-rw-r--r--testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm25
-rw-r--r--testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm23
-rw-r--r--testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm42
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete.any.js207
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm46
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm27
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm48
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm32
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm36
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm27
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.any.js42
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm44
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm50
-rw-r--r--testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html4
16 files changed, 342 insertions, 447 deletions
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.any.js b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.any.js
new file mode 100644
index 0000000000..5288891bd7
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.any.js
@@ -0,0 +1,89 @@
+// META: global=window,worker
+// META: title=IDBDatabase.deleteObjectStore()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+// @author Odin Hørthe Omdal <mailto:odinho@opera.com>
+
+'use_strict';
+
+async_test(t => {
+ let db;
+ let add_success = false;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const objStore = db.createObjectStore("store", { autoIncrement: true });
+ assert_equals(db.objectStoreNames[0], "store", "objectStoreNames");
+
+ const rq_add = objStore.add(1);
+ rq_add.onsuccess = function() { add_success = true; };
+ rq_add.onerror = fail(t, 'rq_add.error');
+
+ objStore.createIndex("idx", "a");
+ db.deleteObjectStore("store");
+ assert_equals(db.objectStoreNames.length, 0, "objectStoreNames.length after delete");
+ assert_false(db.objectStoreNames.contains("store"));
+
+ const exc = "InvalidStateError";
+ assert_throws_dom(exc, function() { objStore.add(2); });
+ assert_throws_dom(exc, function() { objStore.put(3); });
+ assert_throws_dom(exc, function() { objStore.get(1); });
+ assert_throws_dom(exc, function() { objStore.clear(); });
+ assert_throws_dom(exc, function() { objStore.count(); });
+ assert_throws_dom(exc, function() { objStore.delete(1); });
+ assert_throws_dom(exc, function() { objStore.openCursor(); });
+ assert_throws_dom(exc, function() { objStore.index("idx"); });
+ assert_throws_dom(exc, function() { objStore.deleteIndex("idx"); });
+ assert_throws_dom(exc, function() { objStore.createIndex("idx2", "a");
+ });
+ };
+
+ open_rq.onsuccess = function() {
+ assert_true(add_success, "First add was successful");
+ t.done();
+ }
+}, 'Deleted object store\'s name should be removed from database\'s list. Attempting to use a \
+deleted IDBObjectStore should throw an InvalidStateError');
+
+async_test(t => {
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+ assert_throws_dom('NotFoundError', function() { db.deleteObjectStore('whatever'); });
+ t.done();
+ };
+}, 'Attempting to remove an object store that does not exist should throw a NotFoundError');
+
+async_test(t => {
+ const keys = [];
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+
+ const objStore = db.createObjectStore("resurrected", { autoIncrement: true, keyPath: "k" });
+ objStore.add({ k: 5 }).onsuccess = function(e) { keys.push(e.target.result); };
+ objStore.add({}).onsuccess = function(e) { keys.push(e.target.result); };
+ objStore.createIndex("idx", "i");
+ assert_true(objStore.indexNames.contains("idx"));
+ assert_equals(objStore.keyPath, "k", "keyPath");
+
+ db.deleteObjectStore("resurrected");
+
+ const objStore2 = db.createObjectStore("resurrected", { autoIncrement: true });
+ objStore2.add("Unicorns'R'us").onsuccess = function(e) { keys.push(e.target.result); };
+ assert_false(objStore2.indexNames.contains("idx"), "index exist on new objstore");
+ assert_equals(objStore2.keyPath, null, "keyPath");
+
+ assert_throws_dom("NotFoundError", function() { objStore2.index("idx"); });
+ };
+
+ open_rq.onsuccess = function(e) {
+ assert_array_equals(keys, [5, 6, 1], "keys");
+ t.done();
+ };
+}, 'Attempting to access an index that was deleted as part of object store deletion and then \
+recreated using the same object store name should throw a NotFoundError');
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm
deleted file mode 100644
index e3f6a775c5..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore.htm
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<title>IDBDatabase.deleteObjectStore() - object store's name is removed from database's list </title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
-
-var t = async_test(),
- open_rq = createdb(t)
-
-open_rq.onupgradeneeded = function(e) {
- var db = e.target.result
-
- db.createObjectStore("deleted");
- db.deleteObjectStore("deleted");
- assert_false(db.objectStoreNames.contains("deleted"))
-
- t.done()
-}
-
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm
deleted file mode 100644
index 3ddbe8ec62..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore3.htm
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<title>IDBDatabase.deleteObjectStore() - attempt to remove an object store that does not exist </title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
-
-var t = async_test(),
- open_rq = createdb(t);
-
-open_rq.onupgradeneeded = function(e)
-{
- var db = e.target.result;
- assert_throws_dom('NotFoundError',
- function() { db.deleteObjectStore('whatever'); });
- t.done();
-}
-
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm b/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm
deleted file mode 100644
index 0a5e1b83cf..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbdatabase_deleteObjectStore4-not_reused.htm
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>IDBDatabase.deleteObjectStore() - the object store is not reused</title>
-<link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<script src=resources/support.js></script>
-
-<script>
-
-var t = async_test(),
- keys = [],
- open_rq = createdb(t)
-
-open_rq.onupgradeneeded = function(e) {
- var db = e.target.result
-
- var objStore = db.createObjectStore("resurrected", { autoIncrement: true, keyPath: "k" });
- objStore.add({k:5}).onsuccess = function(e) { keys.push(e.target.result); }
- objStore.add({}).onsuccess = function(e) { keys.push(e.target.result); }
- objStore.createIndex("idx", "i");
- assert_true(objStore.indexNames.contains("idx"));
- assert_equals(objStore.keyPath, "k", "keyPath");
-
- db.deleteObjectStore("resurrected");
-
- var objStore2 = db.createObjectStore("resurrected", { autoIncrement: true });
- objStore2.add("Unicorns'R'us").onsuccess = function(e) { keys.push(e.target.result); };
- assert_false(objStore2.indexNames.contains("idx"), "index exist on new objstore");
- assert_equals(objStore2.keyPath, null, "keyPath");
-
- assert_throws_dom("NotFoundError", function() { objStore2.index("idx"); });
-}
-
-open_rq.onsuccess = function(e) {
- assert_array_equals(keys, [5, 6, 1], "keys");
- t.done();
-}
-
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.any.js
new file mode 100644
index 0000000000..0b731f391d
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.any.js
@@ -0,0 +1,207 @@
+// META: global=window,worker
+// META: title=IDBObjectStore.delete()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+
+'use_strict';
+
+async_test(t => {
+ let db;
+ const record = { key: 1, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const objStore = db.createObjectStore("test", { keyPath: "key" });
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const delete_rq = db.transaction("test", "readwrite",
+ { durability: 'relaxed' })
+ .objectStore("test")
+ .delete(record.key);
+
+ delete_rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+
+ e.target.transaction.oncomplete = t.step_func(VerifyRecordRemoved);
+ });
+ };
+
+ function VerifyRecordRemoved() {
+ const rq = db.transaction("test", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("test")
+ .get(record.key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+ t.done();
+ });
+ }
+}, 'delete() removes record (inline keys)');
+
+async_test(t => {
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+
+ const delete_rq = db.createObjectStore("test")
+ .delete(1);
+
+ delete_rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+ t.done();
+ });
+ };
+}, 'delete() key doesn\'t match any records');
+
+async_test(t => {
+ let db;
+ const record = { test: { obj: { key: 1 } }, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const objStore = db.createObjectStore("test",
+ { keyPath: "test.obj.key" });
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const delete_rq = db.transaction("test", "readwrite",
+ { durability: 'relaxed' })
+ .objectStore("test")
+ .delete(record.test.obj.key);
+
+ delete_rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+
+ e.target.transaction.oncomplete = t.step_func(VerifyRecordRemoved);
+ });
+ };
+
+ function VerifyRecordRemoved() {
+ const rq = db.transaction("test", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("test")
+ .get(record.test.obj.key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+ t.done();
+ });
+ }
+}, 'Object store\'s key path is an object attribute');
+
+async_test(t => {
+ let db;
+ const key = 1;
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const objStore = db.createObjectStore("test");
+ objStore.add(record, key);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const delete_rq = db.transaction("test", "readwrite",
+ { durability: 'relaxed' })
+ .objectStore("test")
+ .delete(key);
+
+ delete_rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+
+ e.target.transaction.oncomplete = t.step_func(VerifyRecordRemoved);
+ });
+ };
+
+ function VerifyRecordRemoved() {
+ const rq = db.transaction("test", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("test")
+ .get(key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+ t.done();
+ });
+ }
+}, 'delete() removes record (out-of-line keys)');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const os = db.createObjectStore("store");
+
+ for(let i = 0; i < 10; i++)
+ os.add("data" + i, i);
+ };
+
+ open_rq.onsuccess = function (e) {
+ const os = db.transaction("store", "readwrite",
+ { durability: 'relaxed' })
+ .objectStore("store");
+
+ os.delete(IDBKeyRange.bound(3, 6));
+ os.count().onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, 6, "Count after deleting \
+ 3-6 from 10");
+ t.done();
+ });
+ };
+}, 'delete() removes all of the records in the range');
+
+async_test(function(t) {
+ let db;
+ const records = [{ pKey: "primaryKey_0" }, { pKey: "primaryKey_1" }];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(event) {
+ db = event.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "pKey" });
+ for (let i = 0; i < records.length; i++) {
+ objStore.add(records[i]);
+ }
+ };
+
+ open_rq.onsuccess = function(event) {
+ const txn = db.transaction("store", "readonly",
+ { durability: 'relaxed' });
+ const ostore = txn.objectStore("store");
+ t.step(function() {
+ assert_throws_dom("ReadOnlyError", function() {
+ ostore.delete("primaryKey_0");
+ });
+ });
+ t.done();
+ };
+}, 'If the transaction this IDBObjectStore belongs to has its mode set to \
+readonly, throw ReadOnlyError');
+
+async_test(t => {
+ let ostore;
+ const records = [{ pKey: "primaryKey_0" }, { pKey: "primaryKey_1" }];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(event) {
+ const db = event.target.result;
+ ostore = db.createObjectStore("store", { keyPath: "pKey" });
+ db.deleteObjectStore("store");
+ assert_throws_dom("InvalidStateError", function() {
+ ostore.delete("primaryKey_0");
+ });
+ t.done();
+ };
+}, '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_delete.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm
deleted file mode 100644
index 880309d01a..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete.htm
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.delete() - delete removes record (inline keys)</title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
- var db,
- t = async_test(),
- record = { key: 1, property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var objStore = db.createObjectStore("test", { keyPath: "key" });
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var delete_rq = db.transaction("test", "readwrite", {durability: 'relaxed'})
- .objectStore("test")
- .delete(record.key);
-
- delete_rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
-
- e.target.transaction.oncomplete = t.step_func(VerifyRecordRemoved);
- });
- };
-
- function VerifyRecordRemoved() {
- var rq = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test")
- .get(record.key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
- t.done();
- });
- }
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm
deleted file mode 100644
index eb71169905..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete2.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.delete() - key doesn't match any records </title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
- var db,
- t = async_test();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var delete_rq = db.createObjectStore("test")
- .delete(1);
-
- delete_rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm
deleted file mode 100644
index 1ea9dd9958..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete3.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.delete() - object store's key path is an object attribute </title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
- var db,
- t = async_test(),
- record = { test: { obj: { key: 1 } }, property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var objStore = db.createObjectStore("test", { keyPath: "test.obj.key" });
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var delete_rq = db.transaction("test", "readwrite", {durability: 'relaxed'})
- .objectStore("test")
- .delete(record.test.obj.key);
-
- delete_rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
-
- e.target.transaction.oncomplete = t.step_func(VerifyRecordRemoved);
- });
- };
-
- function VerifyRecordRemoved() {
- var rq = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test")
- .get(record.test.obj.key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
- t.done();
- });
- }
-
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm
deleted file mode 100644
index 9d074bff85..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete4.htm
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.delete() - delete removes record (out-of-line keys) </title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
- var db,
- t = async_test(),
- key = 1,
- record = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var objStore = db.createObjectStore("test");
- objStore.add(record, key);
- };
-
- open_rq.onsuccess = function(e) {
- var delete_rq = db.transaction("test", "readwrite", {durability: 'relaxed'})
- .objectStore("test")
- .delete(key);
-
- delete_rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
-
- e.target.transaction.oncomplete = t.step_func(VerifyRecordRemoved);
- });
- };
-
- function VerifyRecordRemoved() {
- var rq = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test")
- .get(key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, undefined);
- t.done();
- });
- }
-
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm
deleted file mode 100644
index f7696e6efa..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete5.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<title>IDBObjectStore.delete() - removes all of the records in the range</title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<script src=resources/support.js></script>
-<script>
- var db
- var open_rq = createdb(async_test())
-
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result
- var os = db.createObjectStore("store")
-
- for(var i = 0; i < 10; i++)
- os.add("data" + i, i)
- }
-
- open_rq.onsuccess = function (e) {
- var os = db.transaction("store", "readwrite", {durability: 'relaxed'})
- .objectStore("store")
-
- os.delete( IDBKeyRange.bound(3, 6) )
- os.count().onsuccess = this.step_func(function(e)
- {
- assert_equals(e.target.result, 6, "Count after deleting 3-6 from 10");
- this.done();
- })
- }
-</script>
-
-<div id=log></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm
deleted file mode 100644
index 70d8af32fe..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete6.htm
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.delete() - If the transaction this IDBObjectStore belongs to has its mode set to readonly, throw ReadOnlyError</title>
-<link rel="author" title="Intel" href="http://www.intel.com">
-<link rel="help" href="https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBObjectStore-delete-IDBRequest-any-key">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-<div id="log"></div>
-<script>
- var db,
- t = async_test(),
- records = [{ pKey: "primaryKey_0"},
- { pKey: "primaryKey_1"}];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function (event) {
- db = event.target.result;
- var objStore = db.createObjectStore("store", {keyPath:"pKey"});
- for (var i = 0; i < records.length; i++) {
- objStore.add(records[i]);
- }
- }
-
- open_rq.onsuccess = function (event) {
- var txn = db.transaction("store", "readonly", {durability: 'relaxed'});
- var ostore = txn.objectStore("store");
- t.step(function(){
- assert_throws_dom("ReadOnlyError", function(){
- ostore.delete("primaryKey_0");
- });
- });
- t.done();
- }
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm
deleted file mode 100644
index a65885cc2b..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_delete7.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.delete() - If the object store has been deleted, the implementation must throw a DOMException of type InvalidStateError</title>
-<link rel="author" title="Intel" href="http://www.intel.com">
-<link rel="help" href="https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBObjectStore-delete-IDBRequest-any-key">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-<div id="log"></div>
-<script>
- var db,
- ostore,
- t = async_test(),
- records = [{ pKey: "primaryKey_0"},
- { pKey: "primaryKey_1"}];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function (event) {
- db = event.target.result;
- ostore = db.createObjectStore("store", {keyPath:"pKey"});
- db.deleteObjectStore("store");
- assert_throws_dom("InvalidStateError", function(){
- ostore.delete("primaryKey_0");
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.any.js
new file mode 100644
index 0000000000..ed0246e0e7
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.any.js
@@ -0,0 +1,42 @@
+// META: global=window,worker
+// META: title=IDBObjectStore.deleteIndex()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+
+'use_strict';
+
+async_test(t => {
+ let db;
+ const key = 1;
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("test");
+ objStore.createIndex("index", "indexedProperty");
+ };
+
+ open_rq.onsuccess = function(e) {
+ db.close();
+ const new_version = createdb(t, db.name, 2);
+ new_version.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = e.target.transaction.objectStore("test");
+ objStore.deleteIndex("index");
+ };
+
+ new_version.onsuccess = function(e) {
+ let index;
+ const objStore = db.transaction("test", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("test");
+
+ assert_throws_dom('NotFoundError', function()
+ { index = objStore.index("index"); });
+ assert_equals(index, undefined);
+ db.close();
+ t.done();
+ };
+ };
+}, 'IDBObjectStore.deleteIndex() removes the index');
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm
deleted file mode 100644
index f12af6fc53..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleteIndex.htm
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.deleteIndex() - removes the index </title>
-<link rel="author" title="Microsoft" href="http://www.microsoft.com">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-
-<script>
- var db,
- t = async_test(),
- key = 1,
- record = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- db.createObjectStore("test")
- .createIndex("index", "indexedProperty")
- };
-
- open_rq.onsuccess = function(e) {
- db.close();
- var new_version = createdb(t, db.name, 2);
- new_version.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = e.target.transaction.objectStore("test")
- objStore.deleteIndex("index");
- }
- new_version.onsuccess = function(e) {
- var index,
- objStore = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test");
-
- assert_throws_dom('NotFoundError',
- function() { index = objStore.index("index") });
- assert_equals(index, undefined);
- db.close();
- t.done();
- }
- }
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm
deleted file mode 100644
index 5ccc8fdb1b..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_deleted.htm
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>Attempting to use deleted IDBObjectStore</title>
-<link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#object-store">
-<link rel=assert title="InvalidStateError Occurs if a request is made on a source object that has been deleted or removed.">
-<link rel=author href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<script src=resources/support.js></script>
-
-<script>
- var db,
- add_success = false,
- t = async_test()
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var objStore = db.createObjectStore("store", { autoIncrement: true });
- assert_equals(db.objectStoreNames[0], "store", "objectStoreNames");
-
- var rq_add = objStore.add(1);
- rq_add.onsuccess = function() { add_success = true; };
- rq_add.onerror = fail(t, 'rq_add.error');
-
- objStore.createIndex("idx", "a");
- db.deleteObjectStore("store");
- assert_equals(db.objectStoreNames.length, 0, "objectStoreNames.length after delete");
-
- const exc = "InvalidStateError"
- assert_throws_dom(exc, function() { objStore.add(2); });
- assert_throws_dom(exc, function() { objStore.put(3); });
- assert_throws_dom(exc, function() { objStore.get(1); });
- assert_throws_dom(exc, function() { objStore.clear(); });
- assert_throws_dom(exc, function() { objStore.count(); });
- assert_throws_dom(exc, function() { objStore.delete(1); });
- assert_throws_dom(exc, function() { objStore.openCursor(); });
- assert_throws_dom(exc, function() { objStore.index("idx"); });
- assert_throws_dom(exc, function() { objStore.deleteIndex("idx"); });
- assert_throws_dom(exc, function() { objStore.createIndex("idx2", "a"); });
- }
-
- open_rq.onsuccess = function() {
- assert_true(add_success, "First add was successful");
- t.done();
- }
-</script>
-
-<div id=log></div>
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
index 8194052391..6b2677fae7 100644
--- a/testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html
+++ b/testing/web-platform/tests/IndexedDB/ready-state-destroyed-execution-context.html
@@ -21,6 +21,10 @@ promise_test(async t => {
const openRequest = iframe.contentWindow.indexedDB.open(dbname);
assert_equals(openRequest.readyState, 'pending');
iframe.remove();
+ await new Promise(resolve => {
+ openRequest.onerror = resolve;
+ openRequest.onsuccess = resolve;
+ });
assert_equals(openRequest.readyState, 'done');
}, 'readyState accessor is valid after execution context is destroyed');