I have a restartless firefox extension in which I have an array which is used for some decision making. The elements of this array can change overtime.

Currently I have my bootstrap.js file which calls various functions present in another .js files. And within one of these functions is this array.

I am trying to figure out how can I restructure my code in such a way that I can update this array (not entire extension) after installation.

What I have thought of is; to pull this array out into a separate .js file and plan to swap this when I make the array 'update' after installation.

However, I still don't understand how to do it. The way I understand is, I bundle my add-on as an .xpi it gets installed and then is it possible to do a partial upgrade?

I don't want to push another .xpi for this. And I assume that will also make the user aware that the extension has updated. Since, the array updates can be frequent this can look really weird for the user updates happening every week or so.

Can I do this over an API that will fetch the updated array and swap it in the code ( Do .push to existing array ) ? Basically, I want this to be invisible to the user and lightweight as well.

How can I do it in a better/correct way? If I am asking for something not presently possible let me know.

1

There are 1 best solutions below

1
On

Anything that you include in xpi, will be updated when there is a new install of that xpi.

As you mentioned that the updates would be frequent, you could possibly fetch the array from a remote end-point. This could be a json file or rest call whatever you think is more suitable. To improve performace, you can fetch array from remote end-point, store it in user profile directory and only fetch it again based on some expiry period (e.g. every week or fortnight).

Be aware in that case, if your extension needs to be distributed through AMO, the review process may require some additional steps e.g. including a privacy policy, barring use of eval on array contents.