electron-browser-shell icon indicating copy to clipboard operation
electron-browser-shell copied to clipboard

activeTab permission not granting temporary host permission

Open RitvarsZ opened this issue 4 months ago • 1 comments

Was testing Asana and ran into a problem with chrome.scripting.executeScript.

The extension's manifest registers activeTab and scripting permissions which should allow the background script to executeScript into the active tab. However, the extension also registers host_permissions:

  "permissions": [
    "cookies",
    "activeTab",
    "scripting",
    "storage",
    "contextMenus",
    "tabs",
    "clipboardWrite"
  ],
  "host_permissions": [
    "https://*.asana.com/*",
    "https://mail.google.com/*"
  ],

When I click the browser action, a scripting.executeScript call is made which only works for asana and mail.google pages. All other pages get an error:

[1829990:0728/110812.404317:ERROR:extensions_browser_client.cc(72)] Extension Error:
  OTR:     false
  Level:   2
  Source:  chrome-extension://khnpeclbnipcdacdkhejifenadikeghk/background_bundle.js
  Message: Uncaught (in promise) Error: Cannot access contents of url "https://www.google.com/". Extension manifest must request permission to access this host.
  ID:      khnpeclbnipcdacdkhejifenadikeghk
  Type:    RuntimeError
  Context: chrome-extension://khnpeclbnipcdacdkhejifenadikeghk/background_bundle.js
  Stack Trace:
    {
      Line:     0
      Column:   1
      URL:      chrome-extension://khnpeclbnipcdacdkhejifenadikeghk/background_bundle.js
      Function: (anonymous function)
    }

This should not happen since activeTab should essentially give temporary host permission to the site.

This does seem like a Electron issue but I figured I'd bring it up here first as you have way more knowledge regarding extension support in Electron :)

RitvarsZ avatar Jul 28 '25 08:07 RitvarsZ

duplicate of https://github.com/samuelmaddock/electron-browser-shell/issues/122

Kilian avatar Jul 29 '25 08:07 Kilian