Chrome extension says "Wants access to this site"

Viewed 351

My Chrome extension's manifest.json contains the following sections:

"permissions": [
  "activeTab",
  "webNavigation",
  "webRequest",
  "webRequestBlocking",
  "*://example.com/*",
  "*://*.example.com/*"
],

"content_scripts": [
    {
      "run_at": "document_start",
      "matches": [
        "*://example.com/*",
        "*://*.example.com/*"
      ],
      "all_frames": true,
      "match_about_blank": true,
      "js": [ "scripts/init.js" ]
    }
  ]

so it operates only on a single domain name (e.g.) example.com


My background.js script contains the following code:

async function setIcon(tabId, path) {
  // based on several parameters show the icon in different colors
  // calls chrome.browserAction.setIcon with customized imageData
}

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
  if (changeInfo && (changeInfo.status === 'loading') && (tabId === tab.id)) {
    setIcon(tabId, (tab.url != undefined) ? '../icons/active/scalable.svg' :
                                            '../icons/inactive/scalable.svg');
  }
});

which switches the extension icon between grayed (inactive) and colored (active) based on the matching URL of the tab.


When the tab shows the content of the matching URL document, the icon is colored (active) and when I hover my mouse over this icon, the tooltip says "Has access to this site".

When the tab shows the content of the non-matching URL document, the icon is grayed (inactive) and when I hover my mouse over this icon, the tooltip says "Wants access to this site".

Why does the tooltip say that the extension wants access to a non-matching site (e.g. https://stackoverflow.com) when it is not true? This surely confuses users. Can I prevent such a message from being shown?

1 Answers

I found out what causes this message.

It is the webNavigation permission. When this permission is added, such a message is shown.

Related