Hi again,
here is the problem again but with a bit more details. Some excerpt of a minimal background.js. This is registered via “browser.webRequest.onBeforeRequest.addListener” :
function listener(details) {
console.log("–> Req url:"+ details.url + " "+ details.type+ " “+ details.requestId);
let filter = browser.webRequest.filterResponseData(details.requestId);
…
filter.ondata = event => {
currentData = decoder.decode(event.data, {stream: true});
body += currentData;
filter.write(encoder.encode(currentData));
}
…
filter.onerror = event => {
console.log(--> Error: ${filter.error} for ${details.requestId}
);
}
…
filter.onstop = async _ => {
…
console.log(”<-- Checksum: " + details.url+ " " + bodyHash);
}
return {};
}
Assume we have a minimal web site:
index.html --> ref to loadsw.js
loadsw.js --> preforms register sw
/sw-test/sw.js --> service worker
Now I get the following trace:
–> Req url:http://127.0.0.1:8080/ main_frame 104 background.js:13:11
<-- Checksum: http://127.0.0.1:8080/ eKq… background.js:37:13
–> Req url:http://127.0.0.1:8080/loadsw.js script 105 background.js:13:11
<-- Checksum: http://127.0.0.1:8080/loadsw.js M6Or… background.js:37:13
Next we register a service worker … loadsw.js:1:9
–> Req url:http://127.0.0.1:8080/sw-test/sw.js script 106 background.js:13:11
–> Error: Invalid request ID for 106 background.js:28:10
^^^^^^^^^^^^^^^
Thus the service worker (sw.js) is noticed as a url that is requested in the web extension but the response to this request cannot be inspected and I get an “Invalid request ID” error.
Any ideas why?
Ciao,
Rüdiger