Skip to content

Commit 792e6b8

Browse files
IDB WPTs: Extend IndexedDB WPTs to run on workers.
This change extends idbindex enforcerange WPT set and idbindex-objectStore-SameObject to run on shared, dedicated, and service worker environments along with window environment. Bug: 41455766 Change-Id: I7075c8e5d3d05ee1b4c06ca900eea47fc6222d94 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6221424 Reviewed-by: Steve Becker <[email protected]> Reviewed-by: Rahul Singh <[email protected]> Commit-Queue: Rahul Singh <[email protected]> Cr-Commit-Position: refs/heads/main@{#1415195}
1 parent c967e1b commit 792e6b8

6 files changed

+69
-82
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// META: title=IndexedDB: IDBIndex getAll() uses [EnforceRange]
2+
// META: global=window,worker
3+
// META: script=resources/support.js
4+
// Spec: "https://w3c.github.io/IndexedDB/#index-interface"
5+
6+
indexeddb_test(
7+
(t, db) => {
8+
const store = db.createObjectStore('store');
9+
const index = store.createIndex('index', 'keyPath');
10+
},
11+
(t, db) => {
12+
const tx = db.transaction('store', 'readonly');
13+
const store = tx.objectStore('store');
14+
const index = store.index('index');
15+
[NaN, Infinity, -Infinity, -1, -Number.MAX_SAFE_INTEGER].forEach(
16+
count => {
17+
assert_throws_js(TypeError, () => {
18+
index.getAll(null, count);
19+
}, `getAll with count ${count} count should throw TypeError`);
20+
});
21+
t.done();
22+
},
23+
'IDBIndex.getAll() should enforce valid range constraints.');

IndexedDB/idbindex-getAll-enforcerange.html

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// META: title=IndexedDB: IDBIndex getAllKeys() uses [EnforceRange]
2+
// META: global=window,worker
3+
// META: script=resources/support.js
4+
// Spec: "https://w3c.github.io/IndexedDB/#index-interface"
5+
6+
indexeddb_test(
7+
(t, db) => {
8+
const store = db.createObjectStore('store');
9+
const index = store.createIndex('index', 'keyPath');
10+
},
11+
(t, db) => {
12+
const tx = db.transaction('store', 'readonly');
13+
const store = tx.objectStore('store');
14+
const index = store.index('index');
15+
[NaN, Infinity, -Infinity, -1, -Number.MAX_SAFE_INTEGER].forEach(
16+
count => {
17+
assert_throws_js(TypeError, () => {
18+
index.getAllKeys(null, count);
19+
}, `getAllKeys with count ${count} count should throw TypeError`);
20+
});
21+
t.done();
22+
},
23+
'IDBIndex.getAllKeys() should enforce valid range constraints.');

IndexedDB/idbindex-getAllKeys-enforcerange.html

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// META: title=IndexedDB: objectStore SameObject
2+
// META: global=window,worker
3+
// META: script=resources/support.js
4+
// Spec: "https://w3c.github.io/IndexedDB/#dom-idbindex-objectstore"
5+
6+
indexeddb_test(
7+
(t, db) => {
8+
const store = db.createObjectStore('store');
9+
const index = store.createIndex('index', 'keyPath');
10+
assert_equals(
11+
index.objectStore, index.objectStore,
12+
'Attribute should yield the same object each time');
13+
},
14+
(t, db) => {
15+
const tx = db.transaction('store', 'readonly');
16+
const store = tx.objectStore('store');
17+
const index = store.index('index');
18+
assert_equals(
19+
index.objectStore, index.objectStore,
20+
'Attribute should yield the same object each time');
21+
t.done();
22+
},
23+
'IDBIndex.objectStore should return same object each time.');

IndexedDB/idbindex-objectStore-SameObject.html

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)