Chrome.storage.local

Hello,

I have recently switched from localStorage to chrome.storage.local. I was developing and testing extension on Chromium based browser and when I have finished with testing and everything worked I have uploaded it to multiple web stores, but as soon as I got to FireFox store I tested it before publishing and when I open browser extension it just output me an error in console saying that lang[readData(…)] is undefined.

I’m really not good with async stuffs, but it’s really strange that the same code works on chromium based browsers but doesn’t on FireFox.

Here is how I manage with data:

As you can see I have functions like: readData, writeData and deleteData.

The problem is in readData, does anyone know how should I fix this error on FireFox browser?

The same code is used for website, android application, desktop application… That’s why I have chrome.storage.local in try / catch statement and if it doesn’t exists it would use localStorage.

And here is the .zip file of the extension, that doesn’t work on FireFox browser: https://github.com/Rabbit-Company/Passky-Browser-Extension/releases/tag/v4.1.0

Thanks for any help in advance!

You have at least three assignments from

lang[readData('lang')]["passwords"]

It could be that the error refers to lang[readData('lang')] not having any value at the time you make this assignment.