New issue
Advanced search Search tips

Issue 879299 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Bug



Sign in to add a comment

`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:
 
devtools-application-indexeddb-cannot-remove-record.gif
7.4 MB View Download
Components: Blink>Storage>IndexedDB
Labels: Needs-Triage-M68
Cc: viswa.karala@chromium.org
Labels: Triaged-ET Needs-Feedback
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!
879299.mp4
2.0 MB View Download
Confirm - on your screencast the same defect as in my attached gif.
Project Member

Comment 6 by sheriffbot@chromium.org, Aug 31

Labels: -Needs-Feedback
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
Components: -Platform>DevTools
Cc: phanindra.mandapaka@chromium.org
Labels: Target-71 M-71 FoundIn-71 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
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!
Owner: dmu...@chromium.org
Status: Assigned (was: Untriaged)
Assigning to Daniel because he knows IndexedDB and can prioritize as needed.
Components: Platform>DevTools
Labels: -Pri-2 Hotlist-GoodFirstBug Pri-3
Owner: ----
Status: Available (was: Assigned)
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.
Cc: dmu...@chromium.org
Thanks for the report and the easy repro!
Owner: xunran.d...@samsung.com
Status: Assigned (was: Available)
I'd like to have a try.
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.
  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.
Cc: eostroukhov@chromium.org
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?
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?
Cc: -eostroukhov@chromium.org pfeldman@chromium.org
Hrmmm, maybe pfeldman@ can point us towards someone who can advise?
Owner: ----
Status: Available (was: Assigned)
I'm not sure whether there is a requirement to support 'compound index' in inspector. Pls someone else check this bug.
Owner: hhli@chromium.org
Status: Assigned (was: Available)
Cc: pwnall@chromium.org

Comment 23 by hhli@chromium.org, 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