fune/testing/web-platform/tests/IndexedDB/idbcursor-continue-exception-order.htm
Nathan Memmott 203bddb834 Bug 1797598 [wpt PR 36674] - Update IndexedDB web tests to durability relaxed, a=testonly
Automatic update from web-platform-tests
Update IndexedDB web tests to durability relaxed

Updates IndexedDB web tests to use the durability relaxed option
for transactions. This will speed up trybots.

Bug: 1258341
Change-Id: I0bfdc1e8adb1490d41b196f6711bdb4131dbe4bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3984246
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1063963}

--

wpt-commits: 8ce3ff8d1c66775db8c21692270ff0e05c366630
wpt-pr: 36674
2022-11-11 12:32:26 +00:00

81 lines
2.6 KiB
HTML

<!DOCTYPE html>
<title>IndexedDB: IDBCursor continue() Exception Ordering</title>
<meta charset=utf-8>
<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbcursor-continue">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/support.js"></script>
<script>
indexeddb_test(
(t, db) => {
const s = db.createObjectStore('s');
s.put('value', 'key');
},
(t, db) => {
const s = db.transaction('s', 'readonly', {durability: 'relaxed'}).objectStore('s');
const r = s.openKeyCursor();
r.onsuccess = t.step_func(() => {
r.onsuccess = null;
const cursor = r.result;
setTimeout(t.step_func(() => {
assert_throws_dom('TransactionInactiveError', () => {
cursor.continue({not: "a valid key"});
}, '"Transaction inactive" check (TransactionInactiveError) ' +
'should precede "invalid key" check (DataError)');
t.done();
}), 0);
});
},
'IDBCursor.continue exception order: TransactionInactiveError vs. DataError'
);
indexeddb_test(
(t, db) => {
const s = db.createObjectStore('s');
s.put('value', 'key');
},
(t, db) => {
const s = db.transaction('s', 'readonly', {durability: 'relaxed'}).objectStore('s');
const r = s.openKeyCursor();
r.onsuccess = t.step_func(() => {
r.onsuccess = null;
const cursor = r.result;
cursor.continue();
r.onsuccess = t.step_func(() => {
setTimeout(t.step_func(() => {
assert_throws_dom('TransactionInactiveError', () => {
cursor.continue();
}, '"Transaction inactive" check (TransactionInactiveError) ' +
'should precede "got value flag" check (InvalidStateError)');
t.done();
}), 0);
});
});
},
'IDBCursor.continue exception order: TransactionInactiveError vs. InvalidStateError'
);
indexeddb_test(
(t, db) => {
const s = db.createObjectStore('s');
s.put('value', 'key');
},
(t, db) => {
const s = db.transaction('s', 'readonly', {durability: 'relaxed'}).objectStore('s');
const r = s.openKeyCursor();
r.onsuccess = t.step_func(() => {
r.onsuccess = null;
const cursor = r.result;
cursor.continue();
assert_throws_dom('InvalidStateError', () => {
cursor.continue({not: "a valid key"});
}, '"got value flag" check (InvalidStateError) should precede ' +
'"invalid key" check (DataError)');
t.done();
});
},
'IDBCursor.continue exception order: InvalidStateError vs. DataError'
);
</script>