I am using the Firefox SDK to create an add-on. I would like a specific webpage to be open once that add-on is successfully installed. I created a module to attempt to do so:
var tabs = require("sdk/tabs");
exports.main = function (options, callbacks) {
if (options.loadReason === 'install') {
tabs.open("https://www.google.com");
}
};
exports.onUnload = function (reason) {
if (reason === 'uninstall') {
tabs.open("https://www.google.com");
}
};
I then require this script in my main.js
file (handlers.js
is the name of the above script):
require("handlers.js");
However, this script does not execute -- whether during installation or uninstallation. I have tried the following links for help, but I don't seem to be able to solve my issue:
https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Listening_for_load_and_unload
The solution for this was repackaging the add-on with the package.json and it worked except for the onUnload function which has a bug and uninstall is never called as a reason and as such I had to use "disable" as the reason to check for and it worked!.
For more on the bug refer to: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Listening_for_load_and_unload