From adf5b9165c0712d1bcb834e03582d22837facce9 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Thu, 1 Oct 2020 20:49:31 +0200 Subject: Hardcode the hostname in boostrap.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The variable was likely used by uMatrix because the code was shared with uBlock, but this is not the case for ηMatrix, so let's just use the string as-is. Signed-off-by: Jesús --- bootstrap.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'bootstrap.js') diff --git a/bootstrap.js b/bootstrap.js index 0bceb56..0127d89 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -32,7 +32,6 @@ let windowlessBrowser = null; let windowlessBrowserPL = null; let bgProcess = null; let version; -const hostName = 'ematrix'; const restartListener = { get messageManager() { @@ -71,15 +70,14 @@ function createBgProcess(parentDocument) { 'iframe')); bgProcess.setAttribute('src', - 'chrome://' + hostName - + '/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(hostName + '-restart', restartListener); + .addMessageListener('ematrix-restart', restartListener); } function getWindowlessBrowserFrame(appShell) { @@ -113,9 +111,7 @@ function getWindowlessBrowserFrame(appShell) { Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT); windowlessBrowser.document.location = - "data:application/vnd.mozilla.xul+xml;charset=utf-8,"; + "data:application/vnd.mozilla.xul+xml;charset=utf-8,"; } function waitForHiddenWindow() { @@ -224,8 +220,7 @@ function shutdown(data, reason) { // Remove the restartObserver only when the extension is being disabled restartListener .messageManager - .removeMessageListener(hostName + '-restart', - restartListener); + .removeMessageListener('ematrix-restart', restartListener); } function install(data, reason) { @@ -251,6 +246,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.' + hostName + '.') + .Services.prefs.getBranch('extensions.ematrix') .deleteBranch(''); } -- cgit v1.2.3