`Application` tab: cannot remove record from IndexedDB when using compound index
Reported by
vitaly.z...@gmail.com,
Aug 30
|
||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Steps to reproduce the problem:
1) Execute this code for creating and filling IndexedDB:
indexedDB.open('test').onupgradeneeded = event => {
const db = event.target.result;
const objectStore = db.createObjectStore('test');
objectStore.createIndex('id', ['a', 'b'], {'unique': true});
objectStore.transaction.oncomplete = _ => {
indexedDB.open('test').onsuccess = event => event.target.result
.transaction('test', 'readwrite')
.objectStore('test')
.add(1, ['a', 'b']);
}
}
2) Try to remove the record from devtools->Application tab.
What is the expected behavior?
Record removed.
What went wrong?
Record not removed.
Did this work before? N/A
Chrome version: 68.0.3440.106 Channel: stable
OS Version: OS X 10.13.6
Flash Version:
,
Aug 30
,
Aug 31
,
Aug 31
Tested the issue on chrome reported version# 68.0.3440.106 using Mac 10.13.6 with steps mentioned below:
1) Launched chrome reported version and Opened Devtools>Console
2) Executed indexedDB.open('test').onupgradeneeded = event => {
const db = event.target.result;
const objectStore = db.createObjectStore('test');
objectStore.createIndex('id', ['a', 'b'], {'unique': true});
objectStore.transaction.oncomplete = _ => {
indexedDB.open('test').onsuccess = event => event.target.result
.transaction('test', 'readwrite')
.objectStore('test')
.add(1, ['a', 'b']);
}
}
3) Navigated to Applications tab and selected IndexedDB folder, tried deleting the instance generated, but unable to delete it
@Reporter: Please find the attached screencast for your reference and let us know if you are also pointing the same which we have captured in the screencast and provide your feedback on it which helps us in further triaging it.
Thanks!
,
Aug 31
Confirm - on your screencast the same defect as in my attached gif.
,
Aug 31
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Sep 3
,
Sep 5
Able to reproduce the issue on reported chrome version 68.0.3440.106 also on latest chrome 71.0.3542.0 using Mac 10.13.6, Ubuntu 17.10 and Windows 10. Same behavior is seen on M-65(65.0.3325.181) hence considering it as non-regression and marking it as Untriaged. NOTE: UI updated from M-65(65.0.3325.181) before M-65 delete option not available. Thanks!
,
Sep 20
Assigning to Daniel because he knows IndexedDB and can prioritize as needed.
,
Sep 20
Since this is a non-regression and a fairly specific use-case, bumping priority down to P3. This would be a good first bug. Marking under devtools as well as the fix will probably involve DevTools code.
,
Sep 20
,
Sep 20
Thanks for the report and the easy repro!
,
Sep 21
I'd like to have a try.
,
Sep 21
One suggestion for a starting point- if you build chrome with your gn args including "debug_devtools = true", then you can 'Inspect' the DevTools window with another devtools window. This should show whatever error is happening on delete.
,
Sep 21
,
Sep 28
async _deleteButtonClicked(node) {
if (!node) {
node = this._dataGrid.selectedNode;
if (!node)
return;
}
const key = /** @type {!SDK.RemoteObject} */ (this._isIndex ? node.data.primaryKey : node.data.key);
const keyValue = /** @type {!Array<?>|!Date|number|string} */ (key.value);
await this._model.deleteEntries(this._databaseId, this._objectStore.name, window.IDBKeyRange.only(keyValue));
this._refreshObjectStoreCallback();
}
The key.value is undefined in this case.
I'm not sure how to construct/get the Array from RemoteObjectImpl.
,
Sep 28
From poking around at https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/sdk/RemoteObject.js it looks like you'll need to reconstruct the array locally, using SDK.RemoteArray.objectAsArray(key) and then e.g. map() to convert child values to keys. Not sure what layer this should live in. Maybe eostroukhov@ can advise?
,
Oct 30
As the child values can also be compound objects, it seems that it's not easy to support all kinds of array/objects. Is there an easy way to reconstruct an object from RemoteObject?
,
Oct 30
Hrmmm, maybe pfeldman@ can point us towards someone who can advise?
,
Nov 8
I'm not sure whether there is a requirement to support 'compound index' in inspector. Pls someone else check this bug.
,
Dec 4
,
Jan 7
,
Jan 17
(5 days ago)
An additional test case:
```
indexedDB.open('test').onupgradeneeded = event => {
const db = event.target.result;
const objectStore = db.createObjectStore('test');
objectStore.createIndex('id', ['a', 'b'], {'unique': true});
objectStore.transaction.oncomplete = _ => {
indexedDB.open('test').onsuccess = event => event.target.result
.transaction('test', 'readwrite')
.objectStore('test')
.add(1, ['a', ['a', 1]]); // nested non-homogeneous array as key
}
}
```
|
||||||||||||||||
►
Sign in to add a comment |
||||||||||||||||
Comment 1 by vitaly.z...@gmail.com
, Aug 307.4 MB
7.4 MB View Download