Open Bug 1686080 Opened 3 years ago Updated 3 years ago

support tabs.onUpdated changeInfo.url with activeTab permission

Categories

(WebExtensions :: General, defect, P5)

Firefox 85
defect

Tracking

(firefox84 affected, firefox85 affected, firefox86 affected)

Tracking Status
firefox84 --- affected
firefox85 --- affected
firefox86 --- affected

People

(Reporter: robbendebiene, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

Load the example add-on provided below.
Visit any page like https://www.example.com
Click the add-on action button at least once. This will grant the activeTab permission and inject a content script which updates the current URL hash.
Inspect the console logs of the add-on.

manifest.json

{ "manifest_version": 2, "name": "T", "version": "1", "permissions": ["activeTab"], "background": { "scripts": ["background.js"] }, "browser_action": { "default_title": "Click to change Hash" } }
background.js

browser.tabs.onUpdated.addListener((t,c) => { console.log(c); }); browser.browserAction.onClicked.addListener(() => { browser.tabs.executeScript({code:"document.location.hash = Math.random()"}); });

Actual results:

The URL of the tab is not logged.

Expected results:

URL should be logged for the active tab.

(same code as above but formatted for better readability)

manifest.json

{
  "manifest_version": 2,
  "name": "T",
  "version": "1",
  "permissions": ["tabs"],
  "background": {
    "scripts": ["background.js"]
  },
  "browser_action": {
    "default_title": "Click to change Hash"
  }
}

background.js

browser.tabs.onUpdated.addListener((t,c) => {
  console.log(c);
});
browser.browserAction.onClicked.addListener(() => {
  browser.tabs.executeScript({code:"document.location.hash = Math.random()"});
});

Hello,

I believe I managed to reproduce the issue on the latest Nightly (86.0a1/20210113043149), Beta (85.0b8/20210112185508) and Release (84.0.2/20210105180113) under Windows 10 x64 and Ubuntu 16.04 LTS, however I’m not entirely sure and would appreciate it if you could confirm the results.

What I’ve obtained is the following:

Once I’m on https://www.example.com and click the add-on toolbar icon, a Uncaught (in promise) Error: Missing host permission for the tab error is logged in the add-on console. The rest of the objects are from when initially visiting the page. For more details, please see the attached screenshot.

Is the mentioned error (generated when clicking the add-on toolbar icon) the issue you are having? As it’s not entirely clear to me.

Thank you !

Flags: needinfo?(robbendebiene)
Attached image 2021-01-13_09h27_33.png

My bad.. I added the "tabs" permission for testing purposes but forgot to remove it when I re-posted the code above.

manifest.json

{
  "manifest_version": 2,
  "name": "T",
  "version": "1",
  "permissions": ["activeTab"],
  "background": {
    "scripts": ["background.js"]
  },
  "browser_action": {
    "default_title": "Click to change Hash"
  }
}

background.js

browser.tabs.onUpdated.addListener((t,c) => {
  console.log(c);
});
browser.browserAction.onClicked.addListener(() => {
  browser.tabs.executeScript({code:"document.location.hash = Math.random()"});
});

Just some clarification.
This bug was detected by working on the following bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1679688. We came to the decision that this should be fixed in a separate bug.

Flags: needinfo?(robbendebiene)

Thank you for the quick response !

I’ve re-built the extension and tested it on the same builds and OSes as earlier. As you mentioned in the original description, the URL of the tab is not logged when clicking on the add-on icon.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Linking to bug 1679688 for visibility. The patch for that bug added a test in toolkit/components/extensions/test/mochitest/test_ext_tabs_permissions.html , with // TODO bug 1686080: support changeInfo.url with activeTab.

Severity: -- → S3
Priority: -- → P5
See Also: → 1679688
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: