[Bug] WebExtension with `activeTab` permission doesn't give access to tab URL and other restricted properties from popup
Juraj-Masiar opened this issue · comments
Steps to reproduce
- Create extension with
activeTab
permission but nottabs
permission. - In the popup script execute:
console.log((await browser.tabs.query({active: true, lastFocusedWindow: true}))[0].url)
Expected behavior
It should log current tab URL.
Actual behavior
It will log undefined
.
This works in Fennec or if you add tabs
permission.
Device information
- Android device: android emulator
- Fenix version: 80.0.1-beta.2 (Build #2015758613)
┆Issue is synchronized with this Jira Task
My extension also not working, "Missing host permission for the tab". I only request "activeTab" as well.
Whats the problem? This is an old bug, but no one seems to be working on this. Its open now since august last year.
This issue isn't occurring for me any more. It may have been fixed
I've tested one of my addons and it indeed works.
However I have also "<all_urls>" host permission which now grants access to tabs properties so it's expected to work now in such case.
Do you have host permission for the tab? @ken107
Last time I got "Missing host permissions" when trying to inject code with only "activeTab" permission.
This time it no longer happens, and with a few additional fixes my extension now works fine on latest Firefox Nightly.
I have <all_urls>
in my optional_permissions. But it was there last time as well when it wasn't working.
Yeah, but this feature was added only recently in Firefox 86:
https://blog.mozilla.org/addons/2021/02/09/extensions-in-firefox-86/
Extensions that have host permissions for tabs no longer need to request the broader “tabs” permission to have access to the tab URL, title, and favicon URL.
OK, I removed the <all_urls>
optional permission and verified it still works. Went into "Manage extensions" and checked the extension's permissions and it shows nothing. So I think mine is working not because I accidentally have host permission.
You are right, I've just checked and it does work without the host permission now.
Thank you for verifying :)
Although I'm not sure if I'm doing something wrong but as I was testing it and reloading extension, I was getting tab info from a different tab... it feels pretty buggy.
Anyway, it's not like the general addons support is getting anywhere near public anyway (if it actually comes back at all).