diff options
Diffstat (limited to 'bootstrap.js')
-rw-r--r-- | bootstrap.js | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/bootstrap.js b/bootstrap.js index 0127d89..c49d77b 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -2,7 +2,7 @@ ηMatrix - a browser extension to black/white list requests. Copyright (C) 2014-2019 The uMatrix/uBlock Origin authors - Copyright (C) 2019-2020 Alessio Vanni + Copyright (C) 2019-2022 Alessio Vanni This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see {http://www.gnu.org/licenses/}. - Home: https://libregit.spks.xyz/heckyel/ematrix + Home: https://gitlab.com/vannilla/ematrix uMatrix Home: https://github.com/gorhill/uMatrix */ @@ -36,7 +36,7 @@ let version; const restartListener = { get messageManager() { return Cc['@mozilla.org/parentprocessmessagemanager;1'] - .getService(Ci.nsIMessageListenerManager); + .getService(Ci.nsIMessageListenerManager); }, receiveMessage: function() { @@ -64,20 +64,21 @@ function startup(data, reason) { function createBgProcess(parentDocument) { bgProcess = parentDocument - .documentElement - .appendChild(parentDocument - .createElementNS('http://www.w3.org/1999/xhtml', - 'iframe')); + .documentElement + .appendChild(parentDocument + .createElementNS('http://www.w3.org/1999/xhtml', + 'iframe')); bgProcess.setAttribute('src', - 'chrome://ematrix/content/background.html#' - + version); + 'chrome://ematrix/content/background.html#' + + version); + // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageListenerManager#addMessageListener%28%29 // "If the same listener registers twice for the same message, the // "second registration is ignored." restartListener - .messageManager - .addMessageListener('ematrix-restart', restartListener); + .messageManager + .addMessageListener('ematrix-restart', restartListener); } function getWindowlessBrowserFrame(appShell) { @@ -96,8 +97,8 @@ function getWindowlessBrowserFrame(appShell) { onStateChange: function(wbp, request, stateFlags, status) { if (!request) { - return; - } + return; + } if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) { webProgress.removeProgressListener(windowlessBrowserPL); @@ -108,10 +109,10 @@ function getWindowlessBrowserFrame(appShell) { }; webProgress.addProgressListener(windowlessBrowserPL, - Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT); + Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT); windowlessBrowser.document.location = - "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window%20id='ematrix-win'/>"; + "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window%20id='ematrix-win'/>"; } function waitForHiddenWindow() { @@ -123,7 +124,7 @@ function waitForHiddenWindow() { try { hiddenDoc = appShell.hiddenDOMWindow && - appShell.hiddenDOMWindow.document; + appShell.hiddenDOMWindow.document; } catch (ex) { } @@ -205,7 +206,7 @@ function shutdown(data, reason) { if (windowlessBrowser !== null) { // close() does not exist for older versions of Firefox. - // ηMatrix: how old? But keeping it doesn't really hurt that much. + // ηMatrix: how old? But keeping it doesn't really hurt that much. if (typeof windowlessBrowser.close === 'function') { windowlessBrowser.close(); } @@ -219,22 +220,22 @@ function shutdown(data, reason) { // Remove the restartObserver only when the extension is being disabled restartListener - .messageManager - .removeMessageListener('ematrix-restart', restartListener); + .messageManager + .removeMessageListener('ematrix-restart', restartListener); } function install(data, reason) { // https://bugzil.la/719376 Cc['@mozilla.org/intl/stringbundle;1'] - .getService(Ci.nsIStringBundleService) - .flushBundles(); + .getService(Ci.nsIStringBundleService) + .flushBundles(); if (reason === ADDON_UPGRADE) { - let Services = - Cu.import('resource://gre/modules/Services.jsm', null).Services + let Services = + Cu.import('resource://gre/modules/Services.jsm', null).Services - Services.obs.notifyObservers(null, 'chrome-flush-caches', null); - Services.obs.notifyObservers(null, 'message-manager-flush-caches', null); + Services.obs.notifyObservers(null, 'chrome-flush-caches', null); + Services.obs.notifyObservers(null, 'message-manager-flush-caches', null); } } @@ -246,6 +247,6 @@ function uninstall(data, aReason) { // To cleanup vAPI.localStorage in vapi-common.js, aka // "extensions.ematrix.*" in `about:config`. Cu.import('resource://gre/modules/Services.jsm', null) - .Services.prefs.getBranch('extensions.ematrix') - .deleteBranch(''); + .Services.prefs.getBranch('extensions.ematrix.') + .deleteBranch(''); } |