xiMatrix

filter net requests according to source, destination and type  https://addons.mozilla.org/firefox/addon/ximatrix/
git clone https://git.ce9e.org/xiMatrix.git

commit
184b823166eaf33706b08f5411819e64c543265b
parent
a7ad8c82e44bf93fde9b12979cef6605944dd562
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-25 07:24
allow to overwrite savedRules with an empty ruleset

Diffstat

M src/bg.js 8 ++++++--

1 files changed, 6 insertions, 2 deletions


diff --git a/src/bg.js b/src/bg.js

@@ -52,7 +52,7 @@ var setRule = function(context, hostname, type, rule) {
   52    52                 if (Object.keys(rules[context][hostname]).length === 0) {
   53    53                     delete rules[context][hostname];
   54    54                 }
   55    -1                 if (Object.keys(rules[context]).length === 0) {
   -1    55                 if (Object.keys(rules[context]).length === 0 && !savedRules[context]) {
   56    56                     delete rules[context];
   57    57                 }
   58    58             }
@@ -141,7 +141,11 @@ browser.runtime.onMessage.addListener((msg, sender) => {
  141   141             delete rules[msg.data];
  142   142             return rules;
  143   143         }).then(() => storageChange('savedRules', savedRules => {
  144    -1             savedRules[msg.data] = r;
   -1   144             if (Object.keys(r).length === 0) {
   -1   145                 delete savedRules[msg.data];
   -1   146             } else {
   -1   147                 savedRules[msg.data] = r;
   -1   148             }
  145   149             return savedRules;
  146   150         }));
  147   151     } else if (msg.type === 'securitypolicyviolation') {