summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/idbobjectstore_get7.any.js
blob: 863ba0ac69d593ec328d0656721afea6a7567a99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// META: title=IDBObjectStore.get() - throw DataError when using invalid key
// META: script=resources/support.js
// @author YuichiNukiyama <https://github.com/YuichiNukiyama>

"use strict";

let db;
const t = async_test();

const open_rq = createdb(t);
open_rq.onupgradeneeded = event => {
  db = event.target.result;
  db.createObjectStore("store", { keyPath: "key" });
}

open_rq.onsuccess = () => {
  const store = db.transaction("store", "readonly", {durability: 'relaxed'})
    .objectStore("store");
  assert_throws_dom("DataError", () => {
    store.get(null)
  }, "throw DataError when using invalid key.");
  t.done();
}