From e6af4b07c12156f67497917990a21070072e8bf6 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sat, 29 Feb 2020 19:03:39 +0100 Subject: Minor adjustments for Firefox Preview (Fenix) compatibility. --- src/bg/RequestGuard.js | 4 ++-- src/bg/main.js | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/bg') diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index 10ccfdb..31d79f5 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -114,7 +114,7 @@ var RequestGuard = (() => { : (numAllowed ? "sub" : "no"); let showBadge = ns.local.showCountBadge && numBlocked > 0; let browserAction = browser.browserAction; - if (!browserAction.setIcon) { // mobile + if (!browserAction.setIcon) { // Fennec browserAction.setTitle({tabId, title: `NoScript (${numBlocked})`}); return; } @@ -123,7 +123,7 @@ var RequestGuard = (() => { browserAction.setBadgeText({tabId, text: showBadge ? numBlocked.toString() : ""}); browserAction.setBadgeBackgroundColor({tabId, color: [128, 0, 0, 160]}); browserAction.setTitle({tabId, - title: `${VERSION_LABEL} \n${enforced ? + title: UA.mobile ? "NoScript" : `${VERSION_LABEL} \n${enforced ? _("BlockedItems", [numBlocked, numAllowed + numBlocked]) + ` \n${report}` : _("NotEnforced")}` }); diff --git a/src/bg/main.js b/src/bg/main.js index b1874f4..b09dcb1 100644 --- a/src/bg/main.js +++ b/src/bg/main.js @@ -109,12 +109,12 @@ // wiring main UI let ba = browser.browserAction; if ("setIcon" in ba) { - //desktop + //desktop or Fenix ba.setPopup({ popup: popupURL }); } else { - // mobile + // Fennec ba.onClicked.addListener(async tab => { try { await browser.tabs.remove(await browser.tabs.query({ @@ -250,9 +250,10 @@ deferWebTraffic(this.initializing = init(), async () => { Commands.install(); - - this.devMode = (await browser.management.getSelf()).installType === "development"; - if (!this.local.debug) { + try { + this.devMode = (await browser.management.getSelf()).installType === "development"; + } catch(e) {} + if (!(this.local.debug || this.devMode)) { debug = () => {}; // suppress verbosity } }); -- cgit v1.2.3