From 052d9fdce1b3778899bdeb63aa90b95256bb508f Mon Sep 17 00:00:00 2001 From: Chan Chak Shing Date: Thu, 15 Apr 2021 10:08:55 +0200 Subject: [PATCH] Add missing default values in background.js (#20044) * Add missing default for the applied_rulesets * Update background.js * Update background.js * Update background.js --- chromium/background-scripts/background.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chromium/background-scripts/background.js b/chromium/background-scripts/background.js index 378d70f68b17..2e1107737bf1 100644 --- a/chromium/background-scripts/background.js +++ b/chromium/background-scripts/background.js @@ -96,7 +96,8 @@ function initializeStoredGlobals() { }); } -let upgradeToSecureAvailable; +/** @type {boolean} */ +let upgradeToSecureAvailable = false; function getUpgradeToSecureAvailable() { if (typeof browser !== 'undefined') { @@ -276,7 +277,7 @@ BrowserSession.prototype = { // sort by ruleset names alphabetically, case-insensitive if (this.getTab(tabId, "applied_rulesets", null)) { - let rulesets = this.getTab(tabId, "applied_rulesets"); + let rulesets = this.getTab(tabId, "applied_rulesets", null); let insertIndex = 0; const ruleset_name = ruleset.name.toLowerCase(); @@ -407,7 +408,7 @@ function onBeforeRequest(details) { return redirectOnCancel(shouldCancel, details.url); } - if (browserSession.getRequest(details.requestId, "redirect_count") >= 8) { + if (browserSession.getRequest(details.requestId, "redirect_count", 0) >= 8) { util.log(util.NOTE, "Redirect counter hit for " + uri.href); urlBlacklist.add(uri.href); rules.settings.domainBlacklist.add(uri.hostname);