I am trying to port my existing firefox addon code to the new multiprocess architecture. In my existing code I am able to launch a new tab on the addon install event
using the code below:
function install(data, aReason) {
if (aReason == ADDON_INSTALL) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var mainWindow = wm.getMostRecentWindow("navigator:browser");
mainWindow.gBrowser.addTab('http://www.mywebsite.org/install-success-page.html');
}
if (aReason == ADDON_UPGRADE) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var mainWindow = wm.getMostRecentWindow("navigator:browser");
mainWindow.gBrowser.addTab('http://www.mywebsite.org/update-success-page.html');
}
}
After making the changes to bootstrap.js to become multiprocess firefox
compatible (using help from other extension's code) the addon loads and functions as expected but the above code fails to load a new tab and no error gets displayed in console !!!
This should work:
Also this is less likely to break in the future than any platform code.