1
votes

I am working on porting a Chrome extension to a Firefox extension.

The Chrome extension lists an array of background scripts in the manifest.json file. So all of those javascript files run when the browser is opened if Im correct?

For the Firefox extension I understand that the main.js is the background script. How would I go about have an array of background scripts?

1
"Avoid answering questions in comments", @RobW ;) - Xan
Thanks so just require("filename") in main.js will do the same. Also what about the content pages which are also loaded in the manifest.json file. Something like? var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: "http://*/*", contentScriptFile:[] ); - user1670407
@yoyo Content pages? Did you mean content scripts? - Rob W
Yeah thats what I meant. In Chrome you set them in the manifest but in firefox? Also I tried requring all the files in main.js (firefox) that were in the chromes manifest background page array. I am getting an error: uddlefish.manifest.BadModuleIdentifier: too many .. in require(../data/js/chrome/main.js) from ModuleInfo - user1670407

1 Answers

0
votes

For the Firefox extension I understand that the main.js is the background script. How would I go about have an array of background scripts?

You can require them all and have them use var { window } = require("sdk/addon/window") (which is a background window), or import them all page-workers.