[Webkit-unassigned] [Bug 177350] New: CryptoKey in IndexedDB breaks db query
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 22 02:30:59 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=177350
Bug ID: 177350
Summary: CryptoKey in IndexedDB breaks db query
Product: WebKit
Version: WebKit Nightly Build
Hardware: Macintosh
OS: macOS 10.12
Status: NEW
Severity: Blocker
Priority: P2
Component: WebCore JavaScript
Assignee: webkit-unassigned at lists.webkit.org
Reporter: stefan at sechel.de
Storing CryptoKeys in IndexedDB does not work well. If we store a CryptoKey in IndexedDB we loose the ability to query by index:
> QUnit.test('Native', async assert => {
> const req = indexedDB.open(dbName, 1);
> req.onupgradeneeded = function() {
> const db = this.result;
> const testStore = db.createObjectStore('test', { autoIncrement: false, keyPath: 'id' });
> testStore.createIndex('id', 'id', { unique: true });
> testStore.createIndex('IDB_class', 'IDB_class', { unique: false });
> };
> await new Promise(r => req.onsuccess = r);
> const db = req.result;
> const testData = {id: 1, IDB_class: 'test_class', key}; // key is a CryptoKey
> tx = db.transaction(['test'], 'readwrite');
> store = tx.objectStore('test');
> store.add(testData);
> await new Promise(r => tx.oncomplete = r);
> tx = db.transaction(['test'], 'readonly');
> store = tx.objectStore('test');
> const req1 = store.get(1);
> await new Promise(r => req1.onsuccess = r);
> assert.propEqual(req1.result, testData, 'objects should be equivalent');
> tx = db.transaction(['test'], 'readonly');
> store = tx.objectStore('test');
> const index = store.index('IDB_class');
> const req2 = index.get('test_class');
> await new Promise(r => req2.onsuccess = r);
> assert.propEqual(req2.result, testData, 'objects should be equivalent');
> indexedDB.deleteDatabase(dbName);
> });
You can test this using this Fiddle:
https://fiddle.jshell.net/sechel/qn7oesaf/
Expected behaviour: req1.result and req2.result should be property equivalent to testData.
Observed behaviour: Only req1.result is equivalent to testData, req2.result is undefined.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170922/5cc16f86/attachment-0001.html>
More information about the webkit-unassigned
mailing list