javascript - Opening a new tab in multiprocess Firefox? -
i trying port existing firefox addon code new multiprocess architecture. in existing code able launch new tab on addon install event
using 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 changes bootstrap.js become multiprocess firefox
compatible (using other extension's code) addon loads , functions expected above code fails load new tab , no error gets displayed in console !!!
this should work:
var cu = components.utils; var { require } = cu.import(resource://gre/modules/services.jsm", {}); const tabs = require("sdk/tabs"); tabs.open(url);
also less break in future platform code.
Comments
Post a Comment