i need to change this in my webextension: i have a huge database stored in 6 background.js files actually stored inside the xpi (bad idea), it is possible to call my differents background.js files stored on a server & call the files from an url ?
what i need is just to call external backgrounds.js files, actually my extension works perfectly but backgrounds.js files stored inside the xpi is a bad idea.
what i want is the user can never see the backgrounds.js files & content,
How huge is your DB? You may consider download resources and use local storage.
But these resources should not be remote scripts (at least if you want to publish your extension on AMO).
No you canât hide the code⌠You can only minimize and obfuscate the code.
my DB is 7mb at the moment, divided in 6 background.js 1mb each, i update my database almost every week.
ok, how can i do a download ressources for the 6 background.js files?
my add-on is allready working with firefox quantum and hosted in mozzilla add-ons
i want to do those changes because i got a very bad review ( my first) so i know, keeping the background.js files with the blocked urls inside the xpi is a bad idea, thats why im looking for a better solution. what i want is just to keep the users happy (advancced users who look into the code :D), and feel secure with my add-on.
Getting a Remote JS file is not allowed in add-ons on Mozilla add-ons.
You can create a plain DB file and get it remotely but that would take a fair amount of time which will stop the extension working. In fact. it is not better than having the files internally.
I am familiar with your add-on. The best way is to create a text file just for the patterns, then read them on start up and create an array from them. Then use a single webRequest.onBeforeRequest.addListener for all of them.
There are many ways to optimise the code.
An example would be to create patterns and pass them directly to webRequest.onBeforeRequest.addListener
Example:
// a separate file for the patterns
pat1
pat2
pat3
// Get the file, read it into text⌠create an array let pattern = fileText.split(/[\r\n]'/);
Now you have an array of patterns that you can pass to webRequest.onBeforeRequest.addListener
actually if i put all the urls inside a txt file, if i remove everything exepted the urls, its amost 5mb, and i still keep updating my database background.js files not sure if pattern can work in my case, because of the urls, who are really complex in some cassesâŚ
Addon still needs to read the .dat file and turns it into an object which needs a separate code (not presently in your addon).
Then the match system for the webRequest.onBeforeRequest.addListener has to change to find the right result.
It is a simple bit of code which requires a bit of testing to get the best performance. I am travelling and not at my base location so I have limited resources. I can look into in maybe in couple of weeks when I get back to my base.
BTW, disabling F12 is very annoying to many users and for example I use it all the time and if an addon disables general browser functions, I would uninstall it immediately. It doesnât affect your add-on at all and it shouldnât be there. I dont know why you have it.
It also adds to the resource usage since it is injected into every page.