I'm writing an add-on with the Firefox Add-on SDK and I have to perform some operations when the add-on is installed. Is there any way to customize the add-on installer? If not, I could perform these operations the first time that the add-on is loaded. How could I do that?
No, the installer will merely install the extension, nothing fancy. It will call the install()
method in the bootstrap.js
of the extension but the Add-on SDK doesn't expose that functionality to the add-ons.
So if you need to initialize something - just check whether it is already initialized. E.g. if you need to create a file on first run: check whether the file already exists when your extension starts up. If it doesn't then create it.
If you cannot easily detect whether your extension is initialized then you can use a preference. Something like this:
var {prefs} = require("simple-prefs");
if (!prefs.firstRunDone)
{
prefs.firstRunDone = true;
// Your first-run code goes here
}