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
edb02518f5acde4e6b7b42747b1e3bf9f3cc37af
parent
7bf09cf153f1c81a6f95989064d380b810d28ea1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-05-23 21:48
fixup eba7427: do not count main_frame as other

Diffstat

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

1 files changed, 11 insertions, 8 deletions


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

@@ -176,17 +176,20 @@ browser.webRequest.onBeforeSendHeaders.addListener(details => {
  176   176     var hostname = getHostname(details.url);
  177   177     var type = shared.TYPE_MAP[details.type] || 'other';
  178   178 
  179    -1     let isCookie = h => h.name.toLowerCase() === 'cookie';
  180    -1     var cookiePromise = Promise.resolve();
   -1   179     var promises = [
   -1   180         getRules(context),
   -1   181     ];
   -1   182 
   -1   183     if (details.type !== 'main_frame') {
   -1   184         promises.push(pushRequest(details.tabId, hostname, type));
   -1   185     }
   -1   186 
   -1   187     var isCookie = h => h.name.toLowerCase() === 'cookie';
  181   188     if (details.requestHeaders.some(isCookie)) {
  182    -1         cookiePromise = pushRequest(details.tabId, hostname, 'cookie');
   -1   189         promises.push(pushRequest(details.tabId, hostname, 'cookie'));
  183   190     }
  184   191 
  185    -1     return Promise.all([
  186    -1         pushRequest(details.tabId, hostname, type),
  187    -1         cookiePromise,
  188    -1         getRules(context),
  189    -1     ]).then(([_, _2, rules]) => {
   -1   192     return Promise.all(promises).then(([rules, ...rest]) => {
  190   193         if (
  191   194             details.type !== 'main_frame'
  192   195             && !shared.shouldAllow(rules, context, hostname, type)