Firefox: fix extension restarting

This commit is contained in:
Deathamns 2015-02-02 11:52:40 +01:00
parent 2465d28a17
commit 43c8d86769
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@
// var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=ublock]').contentWindow; // var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=ublock]').contentWindow;
let bgProcess; let bgProcess;
let version;
const hostName = 'ublock'; const hostName = 'ublock';
const restartListener = { const restartListener = {
get messageManager() { get messageManager() {
@ -46,6 +47,10 @@ const restartListener = {
/******************************************************************************/ /******************************************************************************/
function startup(data, reason) { function startup(data, reason) {
if ( data !== undefined ) {
version = data.version;
}
let appShell = Components.classes['@mozilla.org/appshell/appShellService;1'] let appShell = Components.classes['@mozilla.org/appshell/appShellService;1']
.getService(Components.interfaces.nsIAppShellService); .getService(Components.interfaces.nsIAppShellService);
@ -60,7 +65,7 @@ function startup(data, reason) {
); );
bgProcess.setAttribute( bgProcess.setAttribute(
'src', 'src',
'chrome://' + hostName + '/content/background.html#' + data.version 'chrome://' + hostName + '/content/background.html#' + version
); );
restartListener.messageManager.addMessageListener( restartListener.messageManager.addMessageListener(