From ff7c9e96ae556e1d737083ad832eb18ad3e012bb Mon Sep 17 00:00:00 2001 From: Deathamns Date: Sun, 28 Dec 2014 21:26:06 +0100 Subject: [PATCH] Code styling --- platform/firefox/bootstrap.js | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index 8003171..578cfc2 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -26,48 +26,48 @@ /******************************************************************************/ -let bgProcess; +let bgProcess = function(e) { + if ( e ) { + this.removeEventListener('DOMContentLoaded', bgProcess); + } + + let hDoc = Components.classes['@mozilla.org/appshell/appShellService;1'] + .getService(Components.interfaces.nsIAppShellService) + .hiddenDOMWindow.document; + + bgProcess = hDoc.documentElement.appendChild( + hDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe') + ); + bgProcess.setAttribute('src', 'chrome://ublock/content/background.html'); +}; /******************************************************************************/ function startup(data, reason) { - bgProcess = function(e) { - if (e) { - this.removeEventListener('DOMContentLoaded', bgProcess); - } - - let hDoc = Components.classes['@mozilla.org/appshell/appShellService;1'] - .getService(Components.interfaces.nsIAppShellService) - .hiddenDOMWindow.document; - - bgProcess = hDoc.documentElement.appendChild( - hDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe') - ); - bgProcess.setAttribute('src', 'chrome://ublock/content/background.html'); - }; - - if (reason === APP_STARTUP) { - let ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1'] - .getService(Components.interfaces.nsIWindowWatcher); - - ww.registerNotification({ - observe: function(win) { - ww.unregisterNotification(this); - win.addEventListener('DOMContentLoaded', bgProcess); - } - }); - } - else { + if ( reason !== APP_STARTUP ) { bgProcess(); + return; } + + let ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1'] + .getService(Components.interfaces.nsIWindowWatcher); + + ww.registerNotification({ + observe: function(win) { + ww.unregisterNotification(this); + win.addEventListener('DOMContentLoaded', bgProcess); + } + }); } /******************************************************************************/ function shutdown(data, reason) { - if (reason !== APP_SHUTDOWN) { - bgProcess.parentNode.removeChild(bgProcess); + if ( reason === APP_SHUTDOWN ) { + return; } + + bgProcess.parentNode.removeChild(bgProcess); } /******************************************************************************/