DevTools: indexeddb entries not showing in the developer tools when debugging background scripts

RESOLVED FIXED

Status

P2
normal
RESOLVED FIXED
2 years ago
2 months ago

People

(Reporter: arnon.eilat, Assigned: miker)

Tracking

51 Branch

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

14.09 KB, application/x-zip-compressed
Details
(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 OPR/38.0.2220.41

Steps to reproduce:

I'm building WebExtension using indexeddb.

All of the use of indexeddb is in the background script.

Its working as expected but i can't debug it.

When i go to:
about:debugging
Then click debug (on my extension)
Then look at storage pane, in the indexeddb section i can't see my db entries there.

However the indexeddb API works as expexted.



Steps to reproduce:
Go to: about:debugging
Click debug on one of the extensions.
Run the following code: 

var open = indexedDB.open("MyDatabase", 1);

open.onupgradeneeded = function() {
    var db = open.result;
    var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
    var index = store.createIndex("NameIndex", ["name.last", "name.first"]);
};

open.onsuccess = function() {
    var db = open.result;
    var tx = db.transaction("MyObjectStore", "readwrite");
    var store = tx.objectStore("MyObjectStore");
    var index = store.index("NameIndex");

    store.put({id: 12345, name: {first: "John", last: "Doe"}, age: 42});
    store.put({id: 67890, name: {first: "Bob", last: "Smith"}, age: 35});
    
    var getJohn = store.get(12345);
    var getBob = index.get(["Smith", "Bob"]);

    getJohn.onsuccess = function() { console.log(getJohn.result.name.first); };
    getBob.onsuccess = function() { console.log(getBob.result.name.first); };
    tx.oncomplete = function() {db.close(); };
}




You should see the content of indexeddb in the storage pane.
Can you provide your extension as a testcase?
QA Whiteboard: [bugday-20160808]
Component: Untriaged → Developer Tools: Storage Inspector
Flags: needinfo?(arnon.eilat)
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0
Build ID: 20160808030441

I have tested your issue on latest Firefox Nightly release (v51.0a1) on Win 7 and Win 8.1, and the issue is not reproducible with a new profile. Although, I've observe that if the Web Console output is cleared after the first code run and we try to run again the code, the DB entries will not be displayed. We need to close and open again the debug console, in order to see the DB entries after running the code. For the tests I have used uBlock Origin add-on.

While using an old profile the issue was reproducible from the first try.

Can you please retest this using a new clean Firefox profile to eliminate custom settings as a possible cause (https://goo.gl/PNe90E)?
(Reporter)

Comment 3

2 years ago
Created attachment 8779231 [details]
extension to reproduce IDB bug
thanks.
confirmed that Indexed DB shows "No data present for selected host".
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(arnon.eilat)
(Reporter)

Comment 5

2 years ago
I build small example to reproduce the bug.

I've test it with Firefox nightly 51.0a1 on windows 7 (Service Pack 1 Build 7601).

I've test it with the following command:
web-ext run --firefox-binary "C:\Program Files\Nightly\firefox.exe"
So its reproduce on new clean Firefox profile.


Steps to reproduce:
1. Download attachment 8779231 [details] and extract it.
2. cd to the place where the extension found.
3. Run web-ext run
4. In Firefox: go to about:debugging
5. Click debug on the "IDB Test"
6. On the developer tools:
    A. Click the gear icon
    B. under Default firefox developer tools, mark storage as checked
    C. Click the storage panel
    D. Try to find entries in indexed DB.

Expected result:
   See 2 entries in the indexed DB.

Actual results:
   Nothing appear in the indexed DB.
Interesting, the indexedDB table is not a live view but from what I can see it should show these entries.
Priority: -- → P2
This is fixed by bug 1276339
Assignee: nobody → mratcliffe
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
No longer blocks: 1312444

Updated

2 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.