- commit
- 9273f875d035252e1f73f5479bc7197c36d47d48
- parent
- 6498f552e200aac52c1d83e1e75e2b91ca8edbd3
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-05-18 14:37
record cookies
Diffstat
| M | src/bg.js | 9 | ++++++++- |
| M | src/shared.js | 2 | +- |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/bg.js b/src/bg.js
@@ -176,10 +176,17 @@ browser.webRequest.onBeforeSendHeaders.addListener(details => {
176 176 var hostname = getHostname(details.url);
177 177 var type = shared.TYPE_MAP[details.type] || 'other';
178 178
-1 179 let isCookie = h => h.name.toLowerCase() === 'cookie';
-1 180 var cookiePromise = Promise.resolve();
-1 181 if (details.requestHeaders.some(isCookie)) {
-1 182 cookiePromise = pushRequest(details.tabId, hostname, 'cookie');
-1 183 }
-1 184
179 185 return Promise.all([
180 186 pushRequest(details.tabId, hostname, type),
-1 187 cookiePromise,
181 188 getRules(context),
182 -1 ]).then(([_, rules]) => {
-1 189 ]).then(([_, _2, rules]) => {
183 190 if (
184 191 details.type !== 'main_frame'
185 192 && !shared.shouldAllow(rules, context, hostname, type)
diff --git a/src/shared.js b/src/shared.js
@@ -1,6 +1,6 @@ 1 1 var shared = {}; 2 23 -1 shared.TYPES = ['font', 'css', 'media', 'script', 'xhr', 'frame', 'other'];-1 3 shared.TYPES = ['cookie', 'font', 'css', 'media', 'script', 'xhr', 'frame', 'other']; 4 4 shared.TYPE_MAP = { 5 5 'stylesheet': 'css', 6 6 'font': 'font',