Update web-platform-tests to revision bf71b1f245ce34e447b7bde8ed46694574a63da7

This commit is contained in:
WPT Sync Bot 2019-01-19 20:34:46 -05:00
parent 7256d123ff
commit e17a773b4e
35 changed files with 1567 additions and 467 deletions

View file

@ -0,0 +1,53 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>KV Storage: causing errors by directly manipulating the IDB</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/IndexedDB/support-promises.js"></script>
<script type="module">
import { testWithArea } from "./helpers/kvs-tests.js";
const mustFail = {
"set()": area => area.set(1, "value 1"),
"get()": area => area.get(1),
"delete()": area => area.delete(1),
"keys()": area => {
const iter = area.keys();
return iter.next();
},
"values()": area => {
const iter = area.values();
return iter.next();
},
"entries()": area => {
const iter = area.entries();
return iter.next();
}
};
for (const [method, testFn] of Object.entries(mustFail)) {
testWithArea(async (area, t) => {
const { database, store, version } = area.backingStore;
const db = await migrateNamedDatabase(t, database, version + 1, () => {});
const result = testFn(area);
await promise_rejects(t, "VersionError", result);
}, `${method}: upgrading the database must cause a "VersionError" DOMException`);
testWithArea(async (area, t) => {
const { database, store } = area.backingStore;
// Set up a new database with that name, but with no object stores!
// NB: this depends on the fact that createNameDatabase sets the initial version to 1, which is
// the same as the database version used/expected by KV Storage.
const db = await createNamedDatabase(t, database, () => {});
const result = testFn(area);
await promise_rejects(t, "NotFoundError", result);
}, `${method}: creating a same-named database with no object store must cause a "NotFoundError" DOMException`);
}
</script>