API webRequest onHeadersReceived listener issue
-
ivanwfr last edited by
This is about a Browser Extension development.
The technical issue being Opera not dispatching the top web-page Response header to a registered listener.
And this happens when both Chrome and Edge are always sending the event missed by Opera as the very first for every single URL full reload.
This first HTTP Response sent by a server is where a Content-Security-Policy may be specified. And I am migrating from manifest v2 to v3 an extension that needs to access this header.
chrome .webRequest .onHeadersReceived .addListener( ohr_listener , {urls: ["<all_urls>"]} , extraInfoSpec );
Instead of describing the details and all I've tried to find a explanation, I published a dedicated test-purpose-extension on GitHub about the issue:
ā https://github.com/ivanwfr/OHRExtension
I explain everything in the Readme and the extension can be installed from a simple clickable zip.
And it's self-explanatory to use for someone who knows something about DevTools and Load unpacked.I have spent weeks working on the subject.
I am not looking for recommendations or guidance about how I have to make sure I didn't miss something obvious, I got many of those from GPT-3.5 and Bard.
As I am working with Manifest V3 and its service-worker and Promises async APIs, I tried everything on my side before claiming I've found a bug in Opera!
Here is the manifest I am working with:
{ "manifest_version" : 3 , "name" : "OHR checker v3", "short_name" : "ORH", "description" : "Manifest v3 ā onHeadersReceived checker", "author" : "Ivan Wellesz", "version" : "1.23.08.24", "permissions" : [ "activeTab", "declarativeNetRequest", "declarativeNetRequestFeedback", "declarativeNetRequestWithHostAccess", "scripting", "tabs", "webRequest" ], "host_permissions" : [ "<all_urls>" ], "declarative_net_request": { "rule_resources" : [ { "id" : "rules1_SET", "path" : "rules1_SET.json", "enabled" : true }, { "id" : "rules2_REMOVE", "path" : "rules2_REMOVE.json", "enabled" : false } ] }, "icons" : { "32": "icon.png" }, "background" : { "service_worker" : "background.js" }, "action" : { "default_title" : "OHR checker", "default_popup" : "popup.html", "default_icon" : "icon.png" } }
Thanks for reading,
Here I am ivanw@orange.fr -
-