• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    API webRequest onHeadersReceived listener issue

    Opera for computers
    1
    1
    533
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ivanwfr
      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

      Reply Quote 0
        1 Reply Last reply
      • Moved from Opera for Windows by  leocg leocg 
      • Locked by  leocg leocg 
      • First post
        Last post

      Computer browsers

      • Opera for Windows
      • Opera for Mac
      • Opera for Linux
      • Opera beta version
      • Opera USB

      Mobile browsers

      • Opera for Android
      • Opera Mini
      • Opera Touch
      • Opera for basic phones

      • Add-ons
      • Opera account
      • Wallpapers
      • Opera Ads

      • Help & support
      • Opera blogs
      • Opera forums
      • Dev.Opera

      • Security
      • Privacy
      • Cookies Policy
      • EULA
      • Terms of Service

      • About Opera
      • Press info
      • Jobs
      • Investors
      • Become a partner
      • Contact us

      Follow Opera

      • Opera - Facebook
      • Opera - Twitter
      • Opera - YouTube
      • Opera - LinkedIn
      • Opera - Instagram

      © Opera Software 1995-