I am currently developing a web extension that I pass in Manifest V3, because Google Chrome requires it. My extension collects the headers of web pages, more precisely the weight in bytes (Content-Length) of these pages, and until now I was using webRequest to get these headers, but now (since Manifest V3 and "service workers") web extensions become inactive after some time and webRequest does not wake up the extension this which makes the extension completely useless, because it no longer collects anything. The purpose of the addon is to allow the user to know his data consumption while browsing the internet
declarativeNetRequest does not seem to be able to solve my problem because it is impossible to collect information to pass it to a javascript file.
Do you have an idea for me to be able to read the headers with a V3 manifest? Thanks
//the old code in Manifest V2
var filter = { urls: ['<all_urls>']};
var opt_extraInfoSpec = ['responseHeaders'];
navigateur.webRequest.onHeadersReceived.addListener(
callback_of_webRequest, filter, opt_extraInfoSpec
);
var callback_of_webRequest = function(details){
let entete = details.responseHeaders;
let content_length = entete.find(e => e.name === 'content-length');
if (content_length == undefined){ return; };
localStorage_overallconsumption(content_length.value); //function that saves the weight of the page
}