Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /IndexedDB/idb-binary-key-detached.any.html - WPT Dashboard Interop Dashboard
- /IndexedDB/idb-binary-key-detached.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /IndexedDB/idb-binary-key-detached.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /IndexedDB/idb-binary-key-detached.any.worker.html - WPT Dashboard Interop Dashboard
// META: title= IndexedDB: Detached buffers supplied as binary keys
// META: global=window,worker
// META: script=resources/support.js
// Specs:
"use strict";
indexeddb_test(
(t, db) => { db.createObjectStore('store'); },
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const store = tx.objectStore('store');
const array = createDetachedArrayBuffer();
const buffer = array.buffer;
assert_throws_dom("DataError", () => { store.put('', buffer); });
assert_throws_dom("DataError", () => { store.put('', [buffer]); });
t.done();
},
'Detached ArrayBuffers must throw DataError when used as a key'
);
indexeddb_test(
(t, db) => { db.createObjectStore('store'); },
(t, db) => {
const tx = db.transaction('store', 'readwrite');
const store = tx.objectStore('store');
const array = createDetachedArrayBuffer();
assert_throws_dom("DataError", () => { store.put('', array); });
assert_throws_dom("DataError", () => { store.put('', [array]); });
t.done();
},
'Detached TypedArrays must throw DataError when used as a key'
);