Skip to content

Commit b677c30

Browse files
committed
Fix dnr rulset updating before options are saved
1 parent d4b9f68 commit b677c30

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/js/background.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const isFirefox = /Firefox/i.test(navigator.userAgent);
55
// Check if the browser is Firefox
66
if (isFirefox) {
77
browser.runtime.onInstalled.addListener((details) => {
8-
if (details.reason === "install") {
8+
if (details.reason === 'install') {
99
browser.storage.local.get('consentStatus').then(function (data) {
1010
const consentStatus = data.consentStatus;
1111
if (consentStatus !== 'granted') {
1212
browser.tabs.create({
13-
url: "html/consent.html"
13+
url: 'html/consent.html',
1414
});
1515
} else {
1616
// If consent has been already granted, execute background script
@@ -71,7 +71,8 @@ function executeBackgroundScript() {
7171
url.pathname = '/html' + url.pathname;
7272
if (url.searchParams.get('crowd') === 'true') {
7373
url.pathname =
74-
url.pathname.split('/').slice(0, -1).join('/') + '/crowd-bypassed.html';
74+
url.pathname.split('/').slice(0, -1).join('/') +
75+
'/crowd-bypassed.html';
7576
} else {
7677
url.pathname =
7778
url.pathname.split('/').slice(0, -1).join('/') +
@@ -173,6 +174,9 @@ function executeBackgroundScript() {
173174

174175
brws.storage.onChanged.addListener(() => {
175176
getOptions().then((options) => {
177+
if (typeof options === 'undefined') {
178+
return;
179+
}
176180
if (options.optionBlockIpLoggers === false) {
177181
brws.declarativeNetRequest.updateEnabledRulesets({
178182
disableRulesetIds: ['ipLoggerRuleset'],

0 commit comments

Comments
 (0)