Skip to content

Commit

Permalink
Fix dnr rulset updating before options are saved
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAProton committed Sep 19, 2023
1 parent d4b9f68 commit b677c30
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const isFirefox = /Firefox/i.test(navigator.userAgent);
// Check if the browser is Firefox
if (isFirefox) {
browser.runtime.onInstalled.addListener((details) => {
if (details.reason === "install") {
if (details.reason === 'install') {
browser.storage.local.get('consentStatus').then(function (data) {
const consentStatus = data.consentStatus;
if (consentStatus !== 'granted') {
browser.tabs.create({
url: "html/consent.html"
url: 'html/consent.html',
});
} else {
// If consent has been already granted, execute background script
Expand Down Expand Up @@ -71,7 +71,8 @@ function executeBackgroundScript() {
url.pathname = '/html' + url.pathname;
if (url.searchParams.get('crowd') === 'true') {
url.pathname =
url.pathname.split('/').slice(0, -1).join('/') + '/crowd-bypassed.html';
url.pathname.split('/').slice(0, -1).join('/') +
'/crowd-bypassed.html';
} else {
url.pathname =
url.pathname.split('/').slice(0, -1).join('/') +
Expand Down Expand Up @@ -173,6 +174,9 @@ function executeBackgroundScript() {

brws.storage.onChanged.addListener(() => {
getOptions().then((options) => {
if (typeof options === 'undefined') {
return;
}
if (options.optionBlockIpLoggers === false) {
brws.declarativeNetRequest.updateEnabledRulesets({
disableRulesetIds: ['ipLoggerRuleset'],
Expand Down

0 comments on commit b677c30

Please sign in to comment.