summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/IndexedDB')
-rw-r--r--testing/web-platform/tests/IndexedDB/back-forward-cache-open-connection.window.js4
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_count.any.js108
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_count.htm37
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_count2.htm37
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_count3.htm28
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_count4.htm37
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get.any.js190
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get.htm36
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get2.htm39
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get3.htm27
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get4.htm39
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get5.htm26
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get6.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get7.htm32
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_get8.htm27
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getAll.any.js (renamed from testing/web-platform/tests/IndexedDB/idbindex_getAll.html)78
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.any.js (renamed from testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html)55
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey.any.js191
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey.htm38
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm39
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm28
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm38
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm26
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm32
-rw-r--r--testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm27
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add.any.js408
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm35
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm32
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm31
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm25
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm36
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm39
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm40
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm34
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm27
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put.any.js427
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm35
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm29
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm32
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm31
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm25
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm36
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm48
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm40
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm34
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm47
-rw-r--r--testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm27
60 files changed, 1390 insertions, 1843 deletions
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
index cee7287a0b..db51daa121 100644
--- 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
@@ -29,7 +29,7 @@ promise_test(async t => {
await rc2.historyBack();
// The previous page receiving versionchange event should be evicted with the
// correct reason.
- // `kIgnoreEventAndEvict` will be reported as "internal-error".
+ // `kIgnoreEventAndEvict` will be reported as "masked".
// See `NotRestoredReasonToReportString()`.
- await assertNotRestoredFromBFCache(rc1, ['internal-error']);
+ await assertNotRestoredFromBFCache(rc1, ['masked']);
});
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count.any.js b/testing/web-platform/tests/IndexedDB/idbindex_count.any.js
new file mode 100644
index 0000000000..25d743e422
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbindex_count.any.js
@@ -0,0 +1,108 @@
+// META: global=window,worker
+// META: title=IDBIndex.count()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+// @author Odin Hørthe Omdal <mailto:odinho@opera.com>
+// @author Intel <http://www.intel.com>
+
+'use_strict';
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { autoIncrement: true });
+ store.createIndex("index", "indexedProperty");
+ for (let i = 0; i < 10; i++) {
+ store.add({ indexedProperty: "data" + i });
+ }
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .index("index")
+ .count();
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, 10);
+ t.done();
+ });
+ };
+}, 'count() returns the number of records in the index');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { autoIncrement: true });
+ store.createIndex("index", "indexedProperty");
+
+ for (let i = 0; i < 10; i++) {
+ store.add({ indexedProperty: "data" + i });
+ }
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .index("index")
+ .count(IDBKeyRange.bound('data0', 'data4'));
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, 5);
+ t.done();
+ });
+ };
+}, 'count() returns the number of records that have keys within the range');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const store = db.createObjectStore("store", { autoIncrement: true });
+ store.createIndex("myindex", "idx");
+
+ for (let i = 0; i < 10; i++)
+ store.add({ idx: "data_" + (i%2) });
+
+ store.index("myindex").count("data_0").onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, 5, "count(data_0)");
+ t.done();
+ });
+ };
+}, 'count() returns the number of records that have keys with the key');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { autoIncrement: true });
+ store.createIndex("index", "indexedProperty");
+
+ for (let i = 0; i < 10; i++) {
+ store.add({ indexedProperty: "data" + i });
+ }
+ };
+
+ open_rq.onsuccess = function(e) {
+ const index = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .index("index");
+
+ assert_throws_dom("DataError", function () {
+ index.count(NaN);
+ });
+
+ t.done();
+ };
+}, 'count() throws DataError when using invalid key');
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count.htm b/testing/web-platform/tests/IndexedDB/idbindex_count.htm
deleted file mode 100644
index 5b45b5223b..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_count.htm
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>IDBIndex.count() - returns the number of records in 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();
-
- var open_rq = createdb(t);
-
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { autoIncrement: true });
- store.createIndex("index", "indexedProperty");
-
- for(var i = 0; i < 10; i++) {
- store.add({ indexedProperty: "data" + i });
- }
- }
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .index("index")
- .count();
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, 10);
- t.done();
- });
- }
-</script>
-
-<div id=log></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count2.htm b/testing/web-platform/tests/IndexedDB/idbindex_count2.htm
deleted file mode 100644
index 2a68770df9..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_count2.htm
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>IDBIndex.count() - returns the number of records that have keys within 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, t = async_test();
-
- var open_rq = createdb(t);
-
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { autoIncrement: true });
- store.createIndex("index", "indexedProperty");
-
- for(var i = 0; i < 10; i++) {
- store.add({ indexedProperty: "data" + i });
- }
- }
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .index("index")
- .count(IDBKeyRange.bound('data0', 'data4'));
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, 5);
- t.done();
- });
- }
-</script>
-
-<div id=log></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count3.htm b/testing/web-platform/tests/IndexedDB/idbindex_count3.htm
deleted file mode 100644
index a94e898554..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_count3.htm
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>IDBIndex.count() - returns the number of records that have keys with the key</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 db
-
- createdb(async_test()).onupgradeneeded = function(e) {
- db = e.target.result
-
- var store = db.createObjectStore("store", { autoIncrement: true })
- store.createIndex("myindex", "idx")
-
- for (var i = 0; i < 10; i++)
- store.add({ idx: "data_" + (i%2) });
-
- store.index("myindex").count("data_0").onsuccess = this.step_func(function(e) {
- assert_equals(e.target.result, 5, "count(data_0)")
- this.done()
- })
- }
-
-</script>
-<div id=log></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_count4.htm b/testing/web-platform/tests/IndexedDB/idbindex_count4.htm
deleted file mode 100644
index ce19968bf1..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_count4.htm
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.count() - throw DataError when using invalid key</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-IDBIndex-count-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();
-
- var open_rq = createdb(t);
-
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { autoIncrement: true });
- store.createIndex("index", "indexedProperty");
-
- for(var i = 0; i < 10; i++) {
- store.add({ indexedProperty: "data" + i });
- }
- }
-
- open_rq.onsuccess = function(e) {
- var index = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .index("index");
-
- assert_throws_dom("DataError", function() {
- index.count(NaN);
- });
-
- t.done();
- }
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get.any.js b/testing/web-platform/tests/IndexedDB/idbindex_get.any.js
new file mode 100644
index 0000000000..0da228f738
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbindex_get.any.js
@@ -0,0 +1,190 @@
+// META: global=window,worker
+// META: title=IDBIndex.get()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+// @author Intel <http://www.intel.com>
+
+'use_strict';
+
+async_test(t => {
+ let db;
+ let index;
+ const record = { key: 1, indexedProperty: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+ index = objStore.createIndex("index", "indexedProperty");
+
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .index("index")
+ .get(record.indexedProperty);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.key, record.key);
+ t.done();
+ });
+ };
+}, 'get() returns the record');
+
+async_test(t => {
+ let db;
+ const records = [
+ { key: 1, indexedProperty: "data" },
+ { key: 2, indexedProperty: "data" },
+ { key: 3, indexedProperty: "data" }
+ ];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("test", { keyPath: "key" });
+ objStore.createIndex("index", "indexedProperty");
+
+ for (let i = 0; i < records.length; i++)
+ objStore.add(records[i]);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("test", "readonly", { durability: 'relaxed' })
+ .objectStore("test")
+ .index("index")
+ .get("data");
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.key, records[0].key);
+ t.done();
+ });
+ };
+}, 'get() returns the record where the index contains duplicate values');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const rq = db.createObjectStore("test", { keyPath: "key" })
+ .createIndex("index", "indexedProperty")
+ .get(1);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+ t.done();
+ });
+ };
+}, 'get() attempts to retrieve a record that does not exist');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ store.createIndex("index", "indexedProperty");
+
+ for (let i = 0; i < 10; i++) {
+ store.add({ key: i, indexedProperty: "data" + i });
+ }
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .index("index")
+ .get(IDBKeyRange.bound('data4', 'data7'));
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.key, 4);
+ assert_equals(e.target.result.indexedProperty, 'data4');
+
+ step_timeout(function () { t.done(); }, 4);
+ });
+ };
+}, 'get() returns the record with the first key in the range');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const index = db.createObjectStore("test", { keyPath: "key" })
+ .createIndex("index", "indexedProperty");
+
+ assert_throws_dom("DataError", function () {
+ index.get(NaN);
+ });
+ t.done();
+ };
+}, 'get() throws DataError when using invalid key');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ const index = store.createIndex("index", "indexedProperty");
+
+ store.add({ key: 1, indexedProperty: "data" });
+ store.deleteIndex("index");
+
+ assert_throws_dom("InvalidStateError", function () {
+ index.get("data");
+ });
+ t.done();
+ };
+}, 'get() throws InvalidStateError when the index is deleted');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ const index = store.createIndex("index", "indexedProperty");
+ store.add({ key: 1, indexedProperty: "data" });
+ };
+
+ open_rq.onsuccess = function(e) {
+ db = e.target.result;
+ const tx = db.transaction('store', 'readonly', { durability: 'relaxed' });
+ const index = tx.objectStore('store').index('index');
+ tx.abort();
+
+ assert_throws_dom("TransactionInactiveError", function () {
+ index.get("data");
+ });
+ t.done();
+ };
+}, 'get() throws TransactionInactiveError on aborted transaction');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ const index = store.createIndex("index", "indexedProperty");
+ store.add({ key: 1, indexedProperty: "data" });
+
+ e.target.transaction.abort();
+
+ assert_throws_dom("InvalidStateError", function () {
+ index.get("data");
+ });
+ t.done();
+ };
+}, 'get() throws InvalidStateError on index deleted by aborted upgrade');
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get.htm b/testing/web-platform/tests/IndexedDB/idbindex_get.htm
deleted file mode 100644
index 861d7e54d1..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get.htm
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - returns the record </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, index,
- t = async_test(),
- record = { key: 1, indexedProperty: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { keyPath: "key" });
- index = objStore.createIndex("index", "indexedProperty");
-
- objStore.add(record);
- }
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .index("index")
- .get(record.indexedProperty);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.key, record.key);
- t.done();
- });
- }
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get2.htm b/testing/web-platform/tests/IndexedDB/idbindex_get2.htm
deleted file mode 100644
index 66d2fee5cb..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get2.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - returns the record where the index contains duplicate values </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(),
- records = [ { key:1, indexedProperty:"data" },
- { key:2, indexedProperty:"data" },
- { key:3, indexedProperty:"data" } ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("test", { keyPath: "key" });
- objStore.createIndex("index", "indexedProperty");
-
- for (var i = 0; i < records.length; i++)
- objStore.add(records[i]);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test")
- .index("index")
- .get("data");
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.key, records[0].key);
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get3.htm b/testing/web-platform/tests/IndexedDB/idbindex_get3.htm
deleted file mode 100644
index 62a0a4f3ba..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get3.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - attempt to retrieve a record that doesn't 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 db,
- t = async_test();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var rq = db.createObjectStore("test", { keyPath: "key" })
- .createIndex("index", "indexedProperty")
- .get(1);
-
- 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/idbindex_get4.htm b/testing/web-platform/tests/IndexedDB/idbindex_get4.htm
deleted file mode 100644
index 369c288071..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get4.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>IDBIndex.get() - returns the record with the first key 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, t = async_test();
-
- var open_rq = createdb(t);
-
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- store.createIndex("index", "indexedProperty");
-
- for(var i = 0; i < 10; i++) {
- store.add({ key: i, indexedProperty: "data" + i });
- }
- }
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .index("index")
- .get(IDBKeyRange.bound('data4', 'data7'));
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.key, 4);
- assert_equals(e.target.result.indexedProperty, 'data4');
-
- step_timeout(function() { t.done(); }, 4)
- });
- }
-</script>
-
-<div id=log></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get5.htm b/testing/web-platform/tests/IndexedDB/idbindex_get5.htm
deleted file mode 100644
index 9b0bfe4b35..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get5.htm
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - throw DataError when using invalid key </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-IDBIndex-get-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var index = db.createObjectStore("test", { keyPath: "key" })
- .createIndex("index", "indexedProperty");
- assert_throws_dom("DataError",function(){
- index.get(NaN);
- });
- t.done();
- };
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get6.htm b/testing/web-platform/tests/IndexedDB/idbindex_get6.htm
deleted file mode 100644
index ca51b8492f..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get6.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - throw InvalidStateError when the index is deleted</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-IDBIndex-get-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- var index = store.createIndex("index", "indexedProperty");
-
- store.add({ key: 1, indexedProperty: "data" });
- store.deleteIndex("index");
-
- assert_throws_dom("InvalidStateError", function(){
- index.get("data");
- });
- t.done();
- }
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get7.htm b/testing/web-platform/tests/IndexedDB/idbindex_get7.htm
deleted file mode 100644
index 5e9511a0b1..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get7.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - throw TransactionInactiveError on aborted transaction</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-IDBIndex-get-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- var index = store.createIndex("index", "indexedProperty");
- store.add({ key: 1, indexedProperty: "data" });
- }
- open_rq.onsuccess = function(e) {
- db = e.target.result;
- var tx = db.transaction('store', 'readonly', {durability: 'relaxed'});
- var index = tx.objectStore('store').index('index');
- tx.abort();
-
- assert_throws_dom("TransactionInactiveError", function(){
- index.get("data");
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_get8.htm b/testing/web-platform/tests/IndexedDB/idbindex_get8.htm
deleted file mode 100644
index a2565419b9..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_get8.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.get() - throw InvalidStateError on index deleted by aborted upgrade</title>
-<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idb">
-<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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- var index = store.createIndex("index", "indexedProperty");
- store.add({ key: 1, indexedProperty: "data" });
-
- e.target.transaction.abort();
-
- assert_throws_dom("InvalidStateError", function(){
- index.get("data");
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getAll.html b/testing/web-platform/tests/IndexedDB/idbindex_getAll.any.js
index bd2a021386..36b4c0239a 100644
--- a/testing/web-platform/tests/IndexedDB/idbindex_getAll.html
+++ b/testing/web-platform/tests/IndexedDB/idbindex_getAll.any.js
@@ -1,18 +1,18 @@
-<!DOCTYPE html>
-<title>IndexedDB: Test IDBIndex.getAll.</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-<script>
-var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
-var ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
+// META: global=window,worker
+// META: title=IndexedDB: Test IDBIndex.getAll
+// META: script=resources/support.js
+
+'use_strict';
+
+const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
+const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
function getall_test(func, name) {
indexeddb_test(
function(t, connection, tx) {
- var store = connection.createObjectStore('generated',
+ let store = connection.createObjectStore('generated',
{autoIncrement: true, keyPath: 'id'});
- var index = store.createIndex('test_idx', 'upper');
+ let index = store.createIndex('test_idx', 'upper');
alphabet.forEach(function(letter) {
store.put({ch: letter, upper: letter.toUpperCase()});
});
@@ -56,18 +56,18 @@ function getall_test(func, name) {
}
function createGetAllRequest(t, storeName, connection, range, maxCount) {
- var transaction = connection.transaction(storeName, 'readonly');
- var store = transaction.objectStore(storeName);
- var index = store.index('test_idx');
- var req = index.getAll(range, maxCount);
+ const transaction = connection.transaction(storeName, 'readonly');
+ const store = transaction.objectStore(storeName);
+ const index = store.index('test_idx');
+ const req = index.getAll(range, maxCount);
req.onerror = t.unreached_func('getAll request should succeed');
return req;
}
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection, 'C');
+ const req = createGetAllRequest(t, 'out-of-line', connection, 'C');
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), ['c']);
assert_array_equals(data.map(function(e) { return e.upper; }), ['C']);
@@ -76,7 +76,7 @@ getall_test(function(t, connection) {
}, 'Single item get');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'empty', connection);
+ const req = createGetAllRequest(t, 'empty', connection);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, [],
'getAll() on empty object store should return an empty array');
@@ -85,9 +85,9 @@ getall_test(function(t, connection) {
}, 'Empty object store');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection);
+ const req = createGetAllRequest(t, 'out-of-line', connection);
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), alphabet);
assert_array_equals(data.map(function(e) { return e.upper; }), ALPHABET);
@@ -96,10 +96,10 @@ getall_test(function(t, connection) {
}, 'Get all keys');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection, undefined,
+ const req = createGetAllRequest(t, 'out-of-line', connection, undefined,
10);
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), 'abcdefghij'.split(''));
assert_array_equals(data.map(function(e) { return e.upper; }), 'ABCDEFGHIJ'.split(''));
@@ -108,10 +108,10 @@ getall_test(function(t, connection) {
}, 'maxCount=10');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection,
+ const req = createGetAllRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'M'));
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_array_equals(data.map(function(e) { return e.ch; }), 'ghijklm'.split(''));
assert_array_equals(data.map(function(e) { return e.upper; }), 'GHIJKLM'.split(''));
t.done();
@@ -119,10 +119,10 @@ getall_test(function(t, connection) {
}, 'Get bound range');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection,
+ const req = createGetAllRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'M'), 3);
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), 'ghi'.split(''));
assert_array_equals(data.map(function(e) { return e.upper; }), 'GHI'.split(''));
@@ -131,10 +131,10 @@ getall_test(function(t, connection) {
}, 'Get bound range with maxCount');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection,
+ const req = createGetAllRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'K', false, true));
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), 'ghij'.split(''));
assert_array_equals(data.map(function(e) { return e.upper; }), 'GHIJ'.split(''));
@@ -143,10 +143,10 @@ getall_test(function(t, connection) {
}, 'Get upper excluded');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection,
+ const req = createGetAllRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'K', true, false));
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), 'hijk'.split(''));
assert_array_equals(data.map(function(e) { return e.upper; }), 'HIJK'.split(''));
@@ -155,10 +155,10 @@ getall_test(function(t, connection) {
}, 'Get lower excluded');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'generated',
+ const req = createGetAllRequest(t, 'generated',
connection, IDBKeyRange.bound(4, 15), 3);
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_true(Array.isArray(data));
assert_equals(data.length, 0);
t.done();
@@ -166,7 +166,7 @@ getall_test(function(t, connection) {
}, 'Get bound range (generated) with maxCount');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line',
+ const req = createGetAllRequest(t, 'out-of-line',
connection, "Doesn't exist");
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, [],
@@ -177,10 +177,10 @@ getall_test(function(t, connection) {
}, 'Non existent key');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line', connection,
+ const req = createGetAllRequest(t, 'out-of-line', connection,
undefined, 0);
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), alphabet);
assert_array_equals(data.map(function(e) { return e.upper; }), ALPHABET);
@@ -189,10 +189,10 @@ getall_test(function(t, connection) {
}, 'maxCount=0');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line-not-unique', connection,
+ const req = createGetAllRequest(t, 'out-of-line-not-unique', connection,
'first');
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), 'abcdefghijklm'.split(''));
assert_true(data.every(function(e) { return e.half === 'first'; }));
@@ -201,10 +201,10 @@ getall_test(function(t, connection) {
}, 'Retrieve multiEntry key');
getall_test(function(t, connection) {
- var req = createGetAllRequest(t, 'out-of-line-multi', connection,
+ const req = createGetAllRequest(t, 'out-of-line-multi', connection,
'vowel');
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_class_string(data, 'Array', 'result should be an array');
assert_array_equals(data.map(function(e) { return e.ch; }), ['a', 'e', 'i', 'o', 'u']);
assert_array_equals(data[0].attribs, ['vowel', 'first']);
@@ -212,5 +212,3 @@ getall_test(function(t, connection) {
t.done();
});
}, 'Retrieve one key multiple values');
-
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html b/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.any.js
index 5640bfdee7..92f3cc1269 100644
--- a/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.html
+++ b/testing/web-platform/tests/IndexedDB/idbindex_getAllKeys.any.js
@@ -1,18 +1,17 @@
-<!DOCTYPE html>
-<title>IndexedDB: Test IDBIndex.getAllKeys.</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/support.js"></script>
-<script>
+// META: global=window,worker
+// META: title=IndexedDB: Test IDBIndex.getAllKeys.
+// META: script=resources/support.js
-var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
+'use_strict';
+
+const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
function getall_test(func, name) {
indexeddb_test(
function(t, connection, tx) {
- var store = connection.createObjectStore('generated',
+ let store = connection.createObjectStore('generated',
{autoIncrement: true, keyPath: 'id'});
- var index = store.createIndex('test_idx', 'upper');
+ let index = store.createIndex('test_idx', 'upper');
alphabet.forEach(function(letter) {
store.put({ch: letter, upper: letter.toUpperCase()});
});
@@ -47,25 +46,25 @@ function getall_test(func, name) {
}
function createGetAllKeysRequest(t, storeName, connection, range, maxCount) {
- var transaction = connection.transaction(storeName, 'readonly');
- var store = transaction.objectStore(storeName);
- var index = store.index('test_idx');
- var req = index.getAllKeys(range, maxCount);
+ const transaction = connection.transaction(storeName, 'readonly');
+ const store = transaction.objectStore(storeName);
+ const index = store.index('test_idx');
+ const req = index.getAllKeys(range, maxCount);
req.onerror = t.unreached_func('getAllKeys request should succeed');
return req;
}
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection, 'C');
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection, 'C');
req.onsuccess = t.step_func(function(evt) {
- var data = evt.target.result;
+ const data = evt.target.result;
assert_array_equals(evt.target.result, ['c']);
t.done();
});
}, 'Single item get');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'empty', connection);
+ const req = createGetAllKeysRequest(t, 'empty', connection);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, [],
'getAllKeys() on empty object store should return empty array');
@@ -74,7 +73,7 @@ getall_test(function(t, connection) {
}, 'Empty object store');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection);
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, alphabet,
'getAllKeys() should return a..z');
@@ -83,7 +82,7 @@ getall_test(function(t, connection) {
}, 'Get all keys');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'generated', connection);
+ const req = createGetAllKeysRequest(t, 'generated', connection);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result,
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
@@ -94,7 +93,7 @@ getall_test(function(t, connection) {
}, 'Get all generated keys');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined,
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined,
10);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result,
@@ -105,7 +104,7 @@ getall_test(function(t, connection) {
}, 'maxCount=10');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection,
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'M'));
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result,
@@ -116,7 +115,7 @@ getall_test(function(t, connection) {
}, 'Get bound range');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection,
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'M'), 3);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result,
@@ -127,7 +126,7 @@ getall_test(function(t, connection) {
}, 'Get bound range with maxCount');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection,
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'K', false, true));
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result,
@@ -138,7 +137,7 @@ getall_test(function(t, connection) {
}, 'Get upper excluded');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection,
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection,
IDBKeyRange.bound('G', 'K', true, false));
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result,
@@ -149,7 +148,7 @@ getall_test(function(t, connection) {
}, 'Get lower excluded');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'generated',
+ const req = createGetAllKeysRequest(t, 'generated',
connection, IDBKeyRange.bound(4, 15), 3);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, [],
@@ -159,7 +158,7 @@ getall_test(function(t, connection) {
}, 'Get bound range (generated) with maxCount');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line',
+ const req = createGetAllKeysRequest(t, 'out-of-line',
connection, "Doesn't exist");
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, [],
@@ -170,7 +169,7 @@ getall_test(function(t, connection) {
}, 'Non existent key');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line', connection,
+ const req = createGetAllKeysRequest(t, 'out-of-line', connection,
undefined, 0);
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, alphabet,
@@ -180,7 +179,7 @@ getall_test(function(t, connection) {
}, 'maxCount=0');
getall_test(function(t, connection) {
- var req = createGetAllKeysRequest(t, 'out-of-line-multi', connection,
+ const req = createGetAllKeysRequest(t, 'out-of-line-multi', connection,
'vowel');
req.onsuccess = t.step_func(function(evt) {
assert_array_equals(evt.target.result, ['A','E','I','O','U'])
@@ -188,5 +187,3 @@ getall_test(function(t, connection) {
});
req.onerror = t.unreached_func('getAllKeys request should succeed');
}, 'Retrieve multiEntry keys');
-
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey.any.js b/testing/web-platform/tests/IndexedDB/idbindex_getKey.any.js
new file mode 100644
index 0000000000..677a70e7cb
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbindex_getKey.any.js
@@ -0,0 +1,191 @@
+// META: global=window,worker
+// META: title=IDBIndex.getKey()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+// @author Intel <http://www.intel.com>
+
+'use_strict';
+
+async_test(t => {
+ let db;
+ const record = { key: 1, indexedProperty: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("test", { keyPath: "key" });
+ objStore.createIndex("index", "indexedProperty");
+
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ let rq = db.transaction("test", "readonly", { durability: 'relaxed' })
+ .objectStore("test");
+
+ rq = rq.index("index");
+
+ rq = rq.getKey("data");
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, record.key);
+ t.done();
+ });
+ };
+}, 'getKey() returns the record\'s primary key');
+
+async_test(t => {
+ let db;
+ const records = [
+ { key: 1, indexedProperty: "data" },
+ { key: 2, indexedProperty: "data" },
+ { key: 3, indexedProperty: "data" }
+ ];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ var objStore = db.createObjectStore("test", { keyPath: "key" });
+ objStore.createIndex("index", "indexedProperty");
+
+ for (let i = 0; i < records.length; i++)
+ objStore.add(records[i]);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("test", "readonly", { durability: 'relaxed' })
+ .objectStore("test")
+ .index("index")
+ .getKey("data");
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, records[0].key);
+ t.done();
+ });
+ };
+}, 'getKey() returns the record\'s primary key where the index contains duplicate values');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const rq = db.createObjectStore("test", { keyPath: "key" })
+ .createIndex("index", "indexedProperty")
+ .getKey(1);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, undefined);
+ t.done();
+ });
+ };
+}, 'getKey() attempt to retrieve the primary key of a record that doesn\'t exist');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ store.createIndex("index", "indexedProperty");
+
+ for (let i = 0; i < 10; i++) {
+ store.add({ key: i, indexedProperty: "data" + i });
+ }
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .index("index")
+ .getKey(IDBKeyRange.bound('data4', 'data7'));
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result, 4);
+
+ step_timeout(function () { t.done(); }, 4)
+ });
+ };
+}, 'getKey() returns the key of the first record within the range');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+
+ const index = db.createObjectStore("test", { keyPath: "key" })
+ .createIndex("index", "indexedProperty");
+
+ assert_throws_dom("DataError", function () {
+ index.getKey(NaN);
+ });
+ t.done();
+ };
+}, 'getKey() throws DataError when using invalid key');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ const index = store.createIndex("index", "indexedProperty");
+
+ store.add({ key: 1, indexedProperty: "data" });
+ store.deleteIndex("index");
+
+ assert_throws_dom("InvalidStateError", function () {
+ index.getKey("data");
+ });
+ t.done();
+ };
+}, 'getKey() throws InvalidStateError when the index is deleted');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ const index = store.createIndex("index", "indexedProperty");
+ store.add({ key: 1, indexedProperty: "data" });
+ };
+
+ open_rq.onsuccess = function(e) {
+ db = e.target.result;
+ const tx = db.transaction('store', 'readonly', { durability: 'relaxed' });
+ const index = tx.objectStore('store').index('index');
+ tx.abort();
+
+ assert_throws_dom("TransactionInactiveError", function () {
+ index.getKey("data");
+ });
+ t.done();
+ };
+}, 'getKey() throws TransactionInactiveError on aborted transaction');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const store = db.createObjectStore("store", { keyPath: "key" });
+ const index = store.createIndex("index", "indexedProperty");
+ store.add({ key: 1, indexedProperty: "data" });
+
+ e.target.transaction.abort();
+
+ assert_throws_dom("InvalidStateError", function () {
+ index.getKey("data");
+ });
+ t.done();
+ };
+}, 'getKey() throws InvalidStateError on index deleted by aborted upgrade');
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey.htm
deleted file mode 100644
index 101e8f06b7..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey.htm
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - returns the record's primary key </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, indexedProperty:"data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("test", { keyPath: "key" });
- objStore.createIndex("index", "indexedProperty");
-
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test");
-
- rq = rq.index("index");
-
- rq = rq.getKey("data");
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, record.key);
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm
deleted file mode 100644
index 488368d7f4..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey2.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - returns the record's primary key where the index contains duplicate values </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(),
- records = [ { key:1, indexedProperty:"data" },
- { key:2, indexedProperty:"data" },
- { key:3, indexedProperty:"data" } ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("test", { keyPath: "key" });
- objStore.createIndex("index", "indexedProperty");
-
- for (var i = 0; i < records.length; i++)
- objStore.add(records[i]);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("test", "readonly", {durability: 'relaxed'})
- .objectStore("test")
- .index("index")
- .getKey("data");
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, records[0].key);
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm
deleted file mode 100644
index 40ed76d174..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey3.htm
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - attempt to retrieve the primary key of a record that doesn't 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 db,
- t = async_test();
-
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var rq = db.createObjectStore("test", { keyPath: "key" })
- .createIndex("index", "indexedProperty")
- .getKey(1);
-
- 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/idbindex_getKey4.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm
deleted file mode 100644
index 8c81a272ae..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey4.htm
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<title>IDBIndex.getKey() - returns the key of the first record within 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, t = async_test();
-
- var open_rq = createdb(t);
-
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- store.createIndex("index", "indexedProperty");
-
- for(var i = 0; i < 10; i++) {
- store.add({ key: i, indexedProperty: "data" + i });
- }
- }
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .index("index")
- .getKey(IDBKeyRange.bound('data4', 'data7'));
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result, 4);
-
- step_timeout(function() { t.done(); }, 4)
- });
- }
-</script>
-
-<div id=log></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm
deleted file mode 100644
index 3155131397..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey5.htm
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - throw DataError when using invalid key </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-IDBIndex-getKey-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var index = db.createObjectStore("test", { keyPath: "key" })
- .createIndex("index", "indexedProperty");
- assert_throws_dom("DataError",function(){
- index.getKey(NaN);
- });
- t.done();
- };
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm
deleted file mode 100644
index b71967d4fb..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey6.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - throw InvalidStateError when the index is deleted</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-IDBIndex-getKey-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- var index = store.createIndex("index", "indexedProperty");
-
- store.add({ key: 1, indexedProperty: "data" });
- store.deleteIndex("index");
-
- assert_throws_dom("InvalidStateError", function(){
- index.getKey("data");
- });
- t.done();
- }
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm
deleted file mode 100644
index 6a64df3116..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey7.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - throw TransactionInactiveError on aborted transaction</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-IDBIndex-getKey-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- var index = store.createIndex("index", "indexedProperty");
- store.add({ key: 1, indexedProperty: "data" });
- }
- open_rq.onsuccess = function(e) {
- db = e.target.result;
- var tx = db.transaction('store', 'readonly', {durability: 'relaxed'});
- var index = tx.objectStore('store').index('index');
- tx.abort();
-
- assert_throws_dom("TransactionInactiveError", function(){
- index.getKey("data");
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm b/testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm
deleted file mode 100644
index cf0affb210..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbindex_getKey8.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBIndex.getKey() - throw InvalidStateError on index deleted by aborted upgrade</title>
-<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-getkey">
-<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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var store = db.createObjectStore("store", { keyPath: "key" });
- var index = store.createIndex("index", "indexedProperty");
- store.add({ key: 1, indexedProperty: "data" });
-
- e.target.transaction.abort();
-
- assert_throws_dom("InvalidStateError", function(){
- index.getKey("data");
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_add.any.js
new file mode 100644
index 0000000000..dfc15294e8
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_add.any.js
@@ -0,0 +1,408 @@
+// META: global=window,worker
+// META: title=IDBObjectStore.add()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+// @author Intel <http://www.intel.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("store", { keyPath: "key" });
+
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .get(record.key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.property, record.property);
+ assert_equals(e.target.result.key, record.key);
+ t.done();
+ });
+ };
+}, 'add() with an inline key');
+
+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("store");
+
+ objStore.add(record, key);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .get(key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.property, record.property);
+
+ t.done();
+ });
+ };
+}, 'add() with an out-of-line key');
+
+async_test(t => {
+ const record = { key: 1, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+ objStore.add(record);
+
+ const rq = objStore.add(record);
+ rq.onsuccess = fail(t, "success on adding duplicate record");
+
+ rq.onerror = t.step_func(function(e) {
+ assert_equals(e.target.error.name, "ConstraintError");
+ assert_equals(rq.error.name, "ConstraintError");
+ assert_equals(e.type, "error");
+
+ e.preventDefault();
+ e.stopPropagation();
+ });
+ };
+
+ // Defer done, giving rq.onsuccess a chance to run
+ open_rq.onsuccess = function(e) {
+ t.done();
+ };
+}, 'add() record with same key already exists');
+
+async_test(t => {
+ const record = { key: 1, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+ const objStore = db.createObjectStore("store", { autoIncrement: true });
+ objStore.createIndex("i1", "property", { unique: true });
+ objStore.add(record);
+
+ const rq = objStore.add(record);
+ rq.onsuccess = fail(t, "success on adding duplicate indexed record");
+
+ rq.onerror = t.step_func(function(e) {
+ assert_equals(rq.error.name, "ConstraintError");
+ assert_equals(e.target.error.name, "ConstraintError");
+ assert_equals(e.type, "error");
+
+ e.preventDefault();
+ e.stopPropagation();
+ });
+ };
+
+ // Defer done, giving a spurious rq.onsuccess a chance to run
+ open_rq.onsuccess = function(e) {
+ t.done();
+ };
+}, 'add() where an index has unique:true specified');
+
+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("store",
+ { keyPath: "test.obj.key" });
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .get(record.test.obj.key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.property, record.property);
+
+ t.done();
+ });
+ };
+}, 'add() object store\'s key path is an object attribute');
+
+async_test(t => {
+ let db;
+ const record = { property: "data" };
+ const expected_keys = [1, 2, 3, 4];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key",
+ autoIncrement: true });
+
+ objStore.add(record);
+ objStore.add(record);
+ objStore.add(record);
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const actual_keys = [];
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .openCursor();
+
+ rq.onsuccess = t.step_func(function(e) {
+ const cursor = e.target.result;
+
+ if (cursor) {
+ actual_keys.push(cursor.value.key);
+ cursor.continue();
+ } else {
+ assert_array_equals(actual_keys, expected_keys);
+ t.done();
+ }
+ });
+ };
+}, 'add() autoIncrement and inline keys');
+
+async_test(t => {
+ let db;
+ const record = { property: "data" };
+ const expected_keys = [1, 2, 3, 4];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { autoIncrement: true });
+
+ objStore.add(record);
+ objStore.add(record);
+ objStore.add(record);
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const actual_keys = [];
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .openCursor();
+
+ rq.onsuccess = t.step_func(function(e) {
+ const cursor = e.target.result;
+
+ if (cursor) {
+ actual_keys.push(cursor.key);
+ cursor.continue();
+ } else {
+ assert_array_equals(actual_keys, expected_keys);
+ t.done();
+ }
+ });
+ };
+}, 'add() autoIncrement and out-of-line keys');
+
+async_test(t => {
+ let db;
+ const record = { property: "data" };
+ const expected_keys = [1, 2, 3, 4];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "test.obj.key",
+ autoIncrement: true });
+
+ objStore.add(record);
+ objStore.add(record);
+ objStore.add(record);
+ objStore.add(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const actual_keys = [];
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .openCursor();
+
+ rq.onsuccess = t.step_func(function(e) {
+ const cursor = e.target.result;
+
+ if (cursor) {
+ actual_keys.push(cursor.value.test.obj.key);
+ cursor.continue();
+ } else {
+ assert_array_equals(actual_keys, expected_keys);
+ t.done();
+ }
+ });
+ };
+}, 'Object store has autoIncrement:true and the key path is an object \
+attribute');
+
+async_test(t => {
+ const record = { key: 1, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let rq;
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.add(record, 1);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+ }, 'Attempt to \'add()\' a record that does not meet the constraints of an \
+ object store\'s inline key requirements');
+
+async_test(t => {
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+ let rq;
+ const objStore = db.createObjectStore("store");
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.add(record);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to call \'add()\' without a key parameter when the object store \
+uses out-of-line keys');
+
+async_test(t => {
+ const record = { key: { value: 1 }, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.add(record);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to \'add()\' a record where the record\'s key does not meet the \
+constraints of a valid key');
+
+async_test(t => {
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.add(record);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to \'add()\' a record where the record\'s in-line key is not \
+ defined');
+
+async_test(t => {
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store");
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.add(record, { value: 1 });
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to \'add()\' a record where the out of line key provided does not \
+meet the constraints of a valid key');
+
+async_test(t => {
+ const record = { key: 1, indexedProperty: { property: "data" } };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ objStore.createIndex("index", "indexedProperty");
+
+ rq = objStore.add(record);
+
+ assert_true(rq instanceof IDBRequest);
+ rq.onsuccess = function() {
+ t.done();
+ }
+ };
+}, 'add() a record where a value being indexed does not meet the constraints \
+of a valid key');
+
+async_test(t => {
+ let db;
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function (event) {
+ db = event.target.result;
+ db.createObjectStore("store", {keyPath: "pKey"});
+ }
+
+ 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.add({pKey: "primaryKey_0"});
+ });
+ });
+ t.done();
+ }
+}, 'If the transaction this IDBObjectStore belongs to has its mode set to \
+readonly, throw ReadOnlyError');
+
+async_test(t => {
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function (event) {
+ let db = event.target.result;
+ const ostore = db.createObjectStore("store", {keyPath: "pKey"});
+ db.deleteObjectStore("store");
+ assert_throws_dom("InvalidStateError", function() {
+ ostore.add({pKey: "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_add.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm
deleted file mode 100644
index 33ea094388..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add.htm
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - add with an inline key </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("store", { keyPath: "key" });
-
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(record.key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.property, record.property);
- assert_equals(e.target.result.key, record.key);
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm
deleted file mode 100644
index d84004250d..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add10.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - Attempt to call 'add' without an key parameter when the object store uses 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(),
- record = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store");
-
- assert_throws_dom("DataError",
- function() { rq = objStore.add(record); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm
deleted file mode 100644
index b1d9f71fd0..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add11.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - Attempt to add a record where the record's key does not meet the constraints of a valid key </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: { value: 1 }, property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.add(record); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm
deleted file mode 100644
index fc5a7bcebb..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add12.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - Attempt to add a record where the record's in-line key is not defined </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 = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.add(record); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm
deleted file mode 100644
index ec82989b01..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add13.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - Attempt to add a record where the out of line key provided does not meet the constraints of a valid key </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 = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store");
-
- assert_throws_dom("DataError",
- function() { rq = objStore.add(record, { value: 1 }); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm
deleted file mode 100644
index 10bf8a18ce..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add14.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - Add a record where a value being indexed does not meet the constraints of a valid key </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, indexedProperty: { property: "data" } };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- objStore.createIndex("index", "indexedProperty");
-
- rq = objStore.add(record);
-
- assert_true(rq instanceof IDBRequest);
- rq.onsuccess = function() {
- t.done();
- }
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm
deleted file mode 100644
index a6f897911b..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add15.htm
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - 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-add-IDBRequest-any-value-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function (event) {
- db = event.target.result;
- db.createObjectStore("store", {keyPath:"pKey"});
- }
-
- 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.add({ pKey: "primaryKey_0"});
- });
- });
- t.done();
- }
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm
deleted file mode 100644
index 453082340f..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add16.htm
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - 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-add-IDBRequest-any-value-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();
-
- 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.add({ pKey: "primaryKey_0"});
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm
deleted file mode 100644
index 6f6e3eab27..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add2.htm
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - add with an out-of-line key </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("store");
-
- objStore.add(record, key);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.property, record.property);
-
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm
deleted file mode 100644
index 9209e7505d..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add3.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - record with same key already exists </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("store", { keyPath: "key" });
- objStore.add(record);
-
- var rq = objStore.add(record);
- rq.onsuccess = fail(t, "success on adding duplicate record")
-
- rq.onerror = t.step_func(function(e) {
- assert_equals(e.target.error.name, "ConstraintError");
- assert_equals(rq.error.name, "ConstraintError");
- assert_equals(e.type, "error");
-
- e.preventDefault();
- e.stopPropagation();
- });
- };
-
- // Defer done, giving rq.onsuccess a chance to run
- open_rq.onsuccess = function(e) {
- t.done();
- }
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm
deleted file mode 100644
index 35d88fe3a2..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add4.htm
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - add where an index has unique:true specified </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("store", { autoIncrement: true });
- objStore.createIndex("i1", "property", { unique: true });
- objStore.add(record);
-
- var rq = objStore.add(record);
- rq.onsuccess = fail(t, "success on adding duplicate indexed record")
-
- rq.onerror = t.step_func(function(e) {
- assert_equals(rq.error.name, "ConstraintError");
- assert_equals(e.target.error.name, "ConstraintError");
- assert_equals(e.type, "error");
-
- e.preventDefault();
- e.stopPropagation();
- });
- };
-
- // Defer done, giving a spurious rq.onsuccess a chance to run
- open_rq.onsuccess = function(e) {
- t.done();
- }
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm
deleted file mode 100644
index 0cb124ff4b..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add5.htm
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - 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("store", { keyPath: "test.obj.key" });
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(record.test.obj.key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.property, record.property);
-
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm
deleted file mode 100644
index b6ff5a5a50..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add6.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - autoIncrement and 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 = { property: "data" },
- expected_keys = [ 1, 2, 3, 4 ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { keyPath: "key", autoIncrement: true });
-
- objStore.add(record);
- objStore.add(record);
- objStore.add(record);
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var actual_keys = [],
- rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .openCursor();
-
- rq.onsuccess = t.step_func(function(e) {
- var cursor = e.target.result;
-
- if (cursor) {
- actual_keys.push(cursor.value.key);
- cursor.continue();
- }
- else {
- assert_array_equals(actual_keys, expected_keys);
- t.done();
- }
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm
deleted file mode 100644
index cd63917c3f..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add7.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - autoIncrement and 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(),
- record = { property: "data" },
- expected_keys = [ 1, 2, 3, 4 ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { autoIncrement: true });
-
- objStore.add(record);
- objStore.add(record);
- objStore.add(record);
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var actual_keys = [],
- rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .openCursor();
-
- rq.onsuccess = t.step_func(function(e) {
- var cursor = e.target.result;
-
- if (cursor) {
- actual_keys.push(cursor.key);
- cursor.continue();
- }
- else {
- assert_array_equals(actual_keys, expected_keys);
- t.done();
- }
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm
deleted file mode 100644
index c827adf6ef..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add8.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - object store has autoIncrement:true and the 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 = { property: "data" },
- expected_keys = [ 1, 2, 3, 4 ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { keyPath: "test.obj.key", autoIncrement: true });
-
- objStore.add(record);
- objStore.add(record);
- objStore.add(record);
- objStore.add(record);
- };
-
- open_rq.onsuccess = function(e) {
- var actual_keys = [],
- rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .openCursor();
-
- rq.onsuccess = t.step_func(function(e) {
- var cursor = e.target.result;
-
- if (cursor) {
- actual_keys.push(cursor.value.test.obj.key);
- cursor.continue();
- }
- else {
- assert_array_equals(actual_keys, expected_keys);
- t.done();
- }
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm
deleted file mode 100644
index 27061afd9c..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_add9.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.add() - Attempt to add a record that does not meet the constraints of an object store's inline key requirements </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(),
- record = { key: 1, property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- var rq,
- db = e.target.result,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.add(record, 1); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put.any.js b/testing/web-platform/tests/IndexedDB/idbobjectstore_put.any.js
new file mode 100644
index 0000000000..89303291e9
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/idbobjectstore_put.any.js
@@ -0,0 +1,427 @@
+// META: global=window,worker
+// META: title=IDBObjectStore.put()
+// META: script=resources/support.js
+// @author Microsoft <https://www.microsoft.com>
+// @author Intel <http://www.intel.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("store", { keyPath: "key" });
+
+ objStore.put(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("store")
+ .get(record.key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.property, record.property);
+ assert_equals(e.target.result.key, record.key);
+ t.done();
+ });
+ };
+}, 'put() with an inline key');
+
+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("store");
+
+ objStore.put(record, key);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly", {durability: 'relaxed'})
+ .objectStore("store")
+ .get(key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.property, record.property);
+
+ t.done();
+ });
+ };
+},'put() with an out-of-line key');
+
+async_test(t => {
+ let db;
+ let success_event;
+ const record = { key: 1, property: "data" };
+ const record_put = { key: 1, property: "changed", more: ["stuff", 2] };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+ objStore.put(record);
+
+ const rq = objStore.put(record_put);
+ rq.onerror = fail(t, "error on put");
+
+ rq.onsuccess = t.step_func(function(e) {
+ success_event = true;
+ });
+ };
+
+ open_rq.onsuccess = function(e) {
+ assert_true(success_event);
+
+ const rq = db.transaction("store", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("store")
+ .get(1);
+
+ rq.onsuccess = t.step_func(function(e) {
+ const rec = e.target.result;
+
+ assert_equals(rec.key, record_put.key);
+ assert_equals(rec.property, record_put.property);
+ assert_array_equals(rec.more, record_put.more);
+
+ t.done();
+ });
+ };
+}, 'put() record with key already exists');
+
+async_test(t => {
+ const record = { key: 1, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+ const objStore = db.createObjectStore("store", {
+ autoIncrement: true });
+ objStore.createIndex("i1", "property", { unique: true });
+ objStore.put(record);
+
+ const rq = objStore.put(record);
+ rq.onsuccess = fail(t, "success on putting duplicate indexed record");
+
+ rq.onerror = t.step_func(function(e) {
+ assert_equals(rq.error.name, "ConstraintError");
+ assert_equals(e.target.error.name, "ConstraintError");
+
+ assert_equals(e.type, "error");
+
+ e.preventDefault();
+ e.stopPropagation();
+ });
+ };
+
+ // Defer done, giving a spurious rq.onsuccess a chance to run
+ open_rq.onsuccess = function(e) {
+ t.done();
+ };
+}, 'put() where an index has unique:true specified');
+
+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("store",
+ { keyPath: "test.obj.key" });
+ objStore.put(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const rq = db.transaction("store", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("store")
+ .get(record.test.obj.key);
+
+ rq.onsuccess = t.step_func(function(e) {
+ assert_equals(e.target.result.property, record.property);
+
+ t.done();
+ });
+ };
+}, 'Object store\'s key path is an object attribute');
+
+async_test(t => {
+ let db;
+ const record = { property: "data" };
+ const expected_keys = [1, 2, 3, 4];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key",
+ autoIncrement: true });
+
+ objStore.put(record);
+ objStore.put(record);
+ objStore.put(record);
+ objStore.put(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ let actual_keys = [];
+ const rq = db.transaction("store", "readonly", { durability: 'relaxed' })
+ .objectStore("store")
+ .openCursor();
+
+ rq.onsuccess = t.step_func(function(e) {
+ const cursor = e.target.result;
+
+ if (cursor) {
+ actual_keys.push(cursor.value.key);
+ cursor.continue();
+ } else {
+ assert_array_equals(actual_keys, expected_keys);
+ t.done();
+ }
+ });
+ };
+ }, 'autoIncrement and inline keys');
+
+async_test(t => {
+ let db;
+ const record = { property: "data" };
+ const expected_keys = [1, 2, 3, 4];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key",
+ autoIncrement: true });
+
+ objStore.put(record);
+ objStore.put(record);
+ objStore.put(record);
+ objStore.put(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const actual_keys = [];
+ const rq = db.transaction("store", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("store")
+ .openCursor();
+
+ rq.onsuccess = t.step_func(function(e) {
+ const cursor = e.target.result;
+
+ if(cursor) {
+ actual_keys.push(cursor.value.key);
+ cursor.continue();
+ } else {
+ assert_array_equals(actual_keys, expected_keys);
+ t.done();
+ }
+ });
+ };
+}, 'autoIncrement and out-of-line keys');
+
+async_test(t => {
+ let db;
+ const record = { property: "data" };
+ const expected_keys = [1, 2, 3, 4];
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = e.target.result;
+ const objStore = db.createObjectStore("store",
+ { keyPath: "test.obj.key", autoIncrement: true });
+
+ objStore.put(record);
+ objStore.put(record);
+ objStore.put(record);
+ objStore.put(record);
+ };
+
+ open_rq.onsuccess = function(e) {
+ const actual_keys = [];
+ const rq = db.transaction("store", "readonly",
+ { durability: 'relaxed' })
+ .objectStore("store")
+ .openCursor();
+
+ rq.onsuccess = t.step_func(function(e) {
+ const cursor = e.target.result;
+
+ if (cursor) {
+ actual_keys.push(cursor.value.test.obj.key);
+ cursor.continue();
+ } else {
+ assert_array_equals(actual_keys, expected_keys);
+ t.done();
+ }
+ });
+ };
+}, 'Object store has autoIncrement:true and the key path is an object \
+attribute');
+
+async_test(t => {
+ const record = { key: 1, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let rq;
+ const db = e.target.result;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.put(record, 1);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to put() a record that does not meet the constraints of an object \
+store\'s inline key requirements');
+
+async_test(t => {
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ let db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.put(record);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to call put() without an key parameter when the object store uses \
+out-of-line keys');
+
+async_test(t => {
+ const record = { key: { value: 1 }, property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.put(record);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to put() a record where the record\'s key does not meet the \
+constraints of a valid key');
+
+async_test(t => {
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.put(record);
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to put() a record where the record\'s in-line key is not defined');
+
+async_test(t => {
+ const record = { property: "data" };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store");
+
+ assert_throws_dom("DataError", function() {
+ rq = objStore.put(record, { value: 1 });
+ });
+
+ assert_equals(rq, undefined);
+ t.done();
+ };
+}, 'Attempt to put() a record where the out of line key provided does not \
+meet the constraints of a valid key');
+
+async_test(t => {
+ const record = { key: 1, indexedProperty: { property: "data" } };
+
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ const db = e.target.result;
+
+ let rq;
+ const objStore = db.createObjectStore("store", { keyPath: "key" });
+
+ objStore.createIndex("index", "indexedProperty");
+
+ rq = objStore.put(record);
+
+ assert_true(rq instanceof IDBRequest);
+ rq.onsuccess = function() {
+ t.done();
+ };
+ };
+}, 'put() a record where a value being indexed does not meet the constraints \
+of a valid key');
+
+async_test(t => {
+ let db;
+ const open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(event) {
+ db = event.target.result;
+ db.createObjectStore("store", { keyPath: "pKey" });
+ };
+
+ 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.put({ pKey: "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 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.put({ pKey: "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_put.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm
deleted file mode 100644
index e277ce54a2..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put.htm
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - put with an inline key </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("store", { keyPath: "key" });
-
- objStore.put(record);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(record.key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.property, record.property);
- assert_equals(e.target.result.key, record.key);
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm
deleted file mode 100644
index 6882e8e4b5..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put10.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - Attempt to call 'put' without an key parameter when the object store uses 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(),
- record = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.put(record); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm
deleted file mode 100644
index a5ed2db357..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put11.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - Attempt to put a record where the record's key does not meet the constraints of a valid key </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: { value: 1 }, property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.put(record); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm
deleted file mode 100644
index 0693980277..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put12.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - Attempt to put a record where the record's in-line key is not defined </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 = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.put(record); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm
deleted file mode 100644
index 8ae6561fc5..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put13.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - Attempt to put a record where the out of line key provided does not meet the constraints of a valid key </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 = { property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store");
-
- assert_throws_dom("DataError",
- function() { rq = objStore.put(record, { value: 1 }); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm
deleted file mode 100644
index bc5647f4c1..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put14.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - Put a record where a value being indexed does not meet the constraints of a valid key </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, indexedProperty: { property: "data" } };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
-
- var rq,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- objStore.createIndex("index", "indexedProperty");
-
- rq = objStore.put(record);
-
- assert_true(rq instanceof IDBRequest);
- rq.onsuccess = function() {
- t.done();
- }
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm
deleted file mode 100644
index e7affaddd4..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put15.htm
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - 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-put-IDBRequest-any-value-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();
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function (event) {
- db = event.target.result;
- db.createObjectStore("store", {keyPath:"pKey"});
- }
-
- 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.put({pKey: "primaryKey_0"});
- });
- });
- t.done();
- }
-</script>
-
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm
deleted file mode 100644
index e298ba8849..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put16.htm
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - 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-put-IDBRequest-any-value-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();
-
- 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.put({pKey: "primaryKey_0"});
- });
- t.done();
- }
-</script>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm
deleted file mode 100644
index 733e2cb154..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put2.htm
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - put with an out-of-line key </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("store");
-
- objStore.put(record, key);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.property, record.property);
-
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm
deleted file mode 100644
index b7792bdaf1..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put3.htm
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - record with same key already exists </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, success_event,
- t = async_test(),
- record = { key: 1, property: "data" },
- record_put = { key: 1, property: "changed", more: ["stuff", 2] };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { keyPath: "key" });
- objStore.put(record);
-
- var rq = objStore.put(record_put);
- rq.onerror = fail(t, "error on put");
-
- rq.onsuccess = t.step_func(function(e) {
- success_event = true;
- });
- };
-
- open_rq.onsuccess = function(e) {
- assert_true(success_event);
-
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(1);
-
- rq.onsuccess = t.step_func(function(e) {
- var rec = e.target.result;
-
- assert_equals(rec.key, record_put.key);
- assert_equals(rec.property, record_put.property);
- assert_array_equals(rec.more, record_put.more);
-
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm
deleted file mode 100644
index 4a59836eb6..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put4.htm
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - put where an index has unique:true specified </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,
- record = { key: 1, property: "data" };
-
- var open_rq = createdb(async_test());
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { autoIncrement: true });
- objStore.createIndex("i1", "property", { unique: true });
- objStore.put(record);
-
- var rq = objStore.put(record);
- rq.onsuccess = fail(this, "success on putting duplicate indexed record")
-
- rq.onerror = this.step_func(function(e) {
- assert_equals(rq.error.name, "ConstraintError");
- assert_equals(e.target.error.name, "ConstraintError");
-
- assert_equals(e.type, "error");
-
- e.preventDefault();
- e.stopPropagation();
- });
- };
-
- // Defer done, giving a spurious rq.onsuccess a chance to run
- open_rq.onsuccess = function(e) {
- this.done();
- }
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm
deleted file mode 100644
index 6e945e27d2..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put5.htm
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - 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("store", { keyPath: "test.obj.key" });
- objStore.put(record);
- };
-
- open_rq.onsuccess = function(e) {
- var rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .get(record.test.obj.key);
-
- rq.onsuccess = t.step_func(function(e) {
- assert_equals(e.target.result.property, record.property);
-
- t.done();
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm
deleted file mode 100644
index f0b6f0b98d..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put6.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - autoIncrement and 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 = { property: "data" },
- expected_keys = [ 1, 2, 3, 4 ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { keyPath: "key", autoIncrement: true });
-
- objStore.put(record);
- objStore.put(record);
- objStore.put(record);
- objStore.put(record);
- };
-
- open_rq.onsuccess = function(e) {
- var actual_keys = [],
- rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .openCursor();
-
- rq.onsuccess = t.step_func(function(e) {
- var cursor = e.target.result;
-
- if (cursor) {
- actual_keys.push(cursor.value.key);
- cursor.continue();
- }
- else {
- assert_array_equals(actual_keys, expected_keys);
- t.done();
- }
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm
deleted file mode 100644
index e41959f211..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put7.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - autoIncrement and 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(),
- record = { property: "data" },
- expected_keys = [ 1, 2, 3, 4 ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { autoIncrement: true });
-
- objStore.put(record);
- objStore.put(record);
- objStore.put(record);
- objStore.put(record);
- };
-
- open_rq.onsuccess = function(e) {
- var actual_keys = [],
- rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .openCursor();
-
- rq.onsuccess = t.step_func(function(e) {
- var cursor = e.target.result;
-
- if (cursor) {
- actual_keys.push(cursor.key);
- cursor.continue();
- }
- else {
- assert_array_equals(actual_keys, expected_keys);
- t.done();
- }
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm
deleted file mode 100644
index 2bec639d32..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put8.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - object store has autoIncrement:true and the 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 = { property: "data" },
- expected_keys = [ 1, 2, 3, 4 ];
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- db = e.target.result;
- var objStore = db.createObjectStore("store", { keyPath: "test.obj.key", autoIncrement: true });
-
- objStore.put(record);
- objStore.put(record);
- objStore.put(record);
- objStore.put(record);
- };
-
- open_rq.onsuccess = function(e) {
- var actual_keys = [],
- rq = db.transaction("store", "readonly", {durability: 'relaxed'})
- .objectStore("store")
- .openCursor();
-
- rq.onsuccess = t.step_func(function(e) {
- var cursor = e.target.result;
-
- if (cursor) {
- actual_keys.push(cursor.value.test.obj.key);
- cursor.continue();
- }
- else {
- assert_array_equals(actual_keys, expected_keys);
- t.done();
- }
- });
- };
-</script>
-
-<div id="log"></div>
diff --git a/testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm b/testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm
deleted file mode 100644
index dff9415d69..0000000000
--- a/testing/web-platform/tests/IndexedDB/idbobjectstore_put9.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>IDBObjectStore.put() - Attempt to put a record that does not meet the constraints of an object store's inline key requirements </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(),
- record = { key: 1, property: "data" };
-
- var open_rq = createdb(t);
- open_rq.onupgradeneeded = function(e) {
- var rq,
- db = e.target.result,
- objStore = db.createObjectStore("store", { keyPath: "key" });
-
- assert_throws_dom("DataError",
- function() { rq = objStore.put(record, 1); });
-
- assert_equals(rq, undefined);
- t.done();
- };
-</script>
-
-<div id="log"></div>