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
eba7427a99a24fda83c6f11ff30b455b37b8225c
parent
ae72d8f1583d6cfe3d440733b745bc179e92921a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-05-18 14:34
do not break early on main_frame

Diffstat

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

1 files changed, 5 insertions, 6 deletions


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

@@ -168,11 +168,7 @@ browser.webNavigation.onBeforeNavigate.addListener(details => {
  168   168 });
  169   169 
  170   170 browser.webRequest.onBeforeRequest.addListener(details => {
  171    -1     if (details.type === 'main_frame') {
  172    -1         return;
  173    -1     }
  174    -1 
  175    -1     var context = getHostname(details.documentUrl);
   -1   171     var context = getHostname(details.documentUrl || details.url);
  176   172     if (details.frameAncestors.length) {
  177   173         var last = details.frameAncestors.length - 1;
  178   174         context = getHostname(details.frameAncestors[last].url);
@@ -184,7 +180,10 @@ browser.webRequest.onBeforeRequest.addListener(details => {
  184   180         pushRequest(details.tabId, hostname, type),
  185   181         getRules(context),
  186   182     ]).then(([_, rules]) => {
  187    -1         if (!shared.shouldAllow(rules, context, hostname, type)) {
   -1   183         if (
   -1   184             details.type !== 'main_frame'
   -1   185             && !shared.shouldAllow(rules, context, hostname, type)
   -1   186         ) {
  188   187             if (details.type === 'sub_frame') {
  189   188                 // this can in turn be blocked by a local CSP
  190   189                 return {redirectUrl: 'data:,' + encodeURIComponent(details.url)};