1

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

Opening a page after Firefox extension install

Community
  • 1
  • 1
iGlitch
  • 41
  • 7
  • It looks like that should work man, hopefully a firefox sdk dev will respond here helping you out. – Noitidart Jul 15 '15 at 17:06
  • Yeah I know right, I honestly don't know what I'm doing wrong but it's gotta be something! – iGlitch Jul 15 '15 at 17:11
  • I messaged the sdk experts on irc hopefully someone will drop by: https://client00.chat.mibbit.com/?url=irc%3A%2F%2Firc.mozilla.org%2F%23jetpack – Noitidart Jul 15 '15 at 17:12
  • Just check it whether function working properly or not.By kept at least window.alert("test") to check it's calling or not during installation. – Sai Jul 17 '15 at 11:55
  • @iGlitch, The proper way to indicate that there is a solution to a question is to add an answer detailing the solution, and then accept it. If you find a solution, [answering your own question is encouraged](http://stackoverflow.com/help/self-answer). – Makyen Jul 19 '15 at 00:39

1 Answers1

1

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

iGlitch
  • 41
  • 7