Browser.storage.local.set seems to don't work

Yeah, it is exactly this window. I just tested the whole procedure on another device with another OS now. It is the same problem there. My source code is on GitHub, so maybe someone can find the problem :confused:

Try to use fresh profile using the web-ext tool:


Just install it with:
npm install --global web-ext

And then go to the folder with your addon source code (where the manifest.json is) and run:

web-ext run

It will open fresh temp Firefox with fresh profile, so everything should work there :slight_smile:. And if it does, then there is something wrong with your normal profile.

Well, I just checked this out. I have the exactly same problem here: The console output says that the entry was set, but the storage inspector remains empty. The toggle button in the upper right is not there too.

Can you attach the current version of your add-on to your reply (as a zip file)?
The one on Github seems to be outdated; it doesn’t use the storage API at all, for example.

The current version can be downloaded from this branch

It’s a bug in Firefox.

  1. If the extension doesn’t have a background script, then storage items are never visible in Web Storage.
  2. If the extension has a background script:
    2a) If you set the storage item and then click on Web Storage -> Extension Storage, the item is shown.
    2b) If you click on Web Storage -> Extension Storage and then set the storage item, the item is not shown.

Clearing storage doesn’t work correctly, either.
Right-click on your extension’s storage, and click “Clear All”.
Then click on “Extension Storage” and on your extension’s storage again.
The key/value pair is there again.
Clicking “Reload Entries” (the circular arrow) doesn’t do anything.

I vaguely remember reading somewhere that problems in the debugging tools are to be expected, because Mozilla doesn’t have enough employees to fix them and has prioritized other areas. I don’t know if it was from an offical source, it might have been a comment on https://blog.mozilla.org/addons/

2 Likes

Never mind, this was actually confirmed in the original question.

Running the following in the Inspector’s Console for the background page dumps the localStorage object for that context, but I don’t know whether it will work in the no-background scenario:

var ls = browser.storage.local.get();
ls.then(o => {console.log(o)});

It’s working this way, thanks so much! :smiley: