New here; not long released My First Add-On to AMO.
Had been tearing my hair out trying to figure out why browser.local.storage was manifestly working fine but the debugger wasn’t showing anything in the Storage tab, and eventually found this useful and explanatory bugzilla entry:
Turns out the debugger shows data from the localStorage web API, not the browser.local.storage webextension API. An important distinction, though when the browser knows you have clicked on ‘Debug My Webextension’ there is an argument that such behaviour could perhaps be modified for the better and is at least certainly confusing.
FWIW, I found a workaround, involving typing the following line into the debugger console (NB - not the regular console, where this doesn’t work as it doesn’t know what ‘browser’ is):
Two questions: a) is there a better way (new here see above), and b) what is the likelihood of getting a fix for this into the Storage tab of the debugger itself?
I use a similar technique currently (just that I use promises instead…)
I wonder if the move to indexedDB as the storage backend for storage.local will make it accessible in the storage debugger, albeit hidden. I haven’t been able to locate it so far on nightly.
I’d hope that with the indexedDB backend, Firefox would also use a more efficient serialization format, like BSON/WebPack/… .
Which would mean that even if you did get to read the database, that would be rather useless.
But how about the console supporting await browser.storage.local.get(null)
Wouldn’t that be something …
Ah. It would be really nice to get that in Firefox as well.
My code uses await all over the place. The console not supporting that severely restricts it’s usefulness when evaluating code snippets there.
And I didn’t know that one could finally use the functions on the console without explicitly binding the this context before. I thought that only worked in node.js.