Getting URL of a chrome:// tab requires "tabs" permission even with "<all_urls>" present |
||
Issue descriptionchrome.tabs.query returns 'undefined' in a chrome:// Tab's url unless the "tabs" permission is present (or "activeTab" where applicable), even with "<all_urls>" permission. 1. Install the attached extension 2. Open a chrome:// url, e.g. chrome://extensions 3. Open the test extension's popup 4. See no URL 5. Inspect the popup 6. See 'URL: undefined' in console If a regular page is opened in (2) instead, the URL appears in the popup and console log as expected. If "tabs" or "activeTab" permission is added to the manifest, the chrome:// URL (e.g., "chrome://extensions") appears in the popup and console log as expected.
,
Nov 11 2016
> Almost more interesting is that it *works* with activeTab - that seems like a bug to me. Wait, is it the case that adding the activeTab permission lets you see the url of tabs other than the active one? If so that's definitely a bug. If it just grants you tabs permission to see the url of whatever tab is focused when the browser action was clicked, then that sounds like WorkingAsIntended(tm).
,
Nov 11 2016
We have a few pieces of logic here. If the extension has "tabs" permission, we can always show the tab urls - that's what the permission's for. If the extension has access to inject scripts into Tab, then we can return the url of Tab (because the extension could just inject a script to message the location.href). If the extension has activeTab permission and is invoked on Tab, then it can inject scripts there (and thus we can return the url). Now, what's happening is that without activeTab and without the tabs permission but with all urls, we return the url for 99% of tabs - because the extension can inject everywhere. This is WAI. On chrome pages, we don't return the url, because the extension *can't* inject there. IMO, also WAI. But with activeTab (and still without tabs permission), the extension *can* get the url of chrome:// pages, even though it cannot inject there. To me, that last part seems like a bug, since our logic is supposed to be "if the extension can inject here, return the url because it could figure it out anyway" - but that's not the case for a chrome:// page.
,
Nov 11 2016
Quoting from https://developer.chrome.com/extensions/activeTab#what-activeTab-allows : While the activeTab permission is enabled for a tab, an extension can: * Call tabs.executeScript or tabs.insertCSS on that tab. * Get the URL, title, and favicon for that tab via an API that returns a tabs.Tab object (essentially, activeTab grants the tabs permission temporarily). ----- That last part seems to me like this is working as specified.
,
Nov 11 2016
Right, but that's explicitly disallowed on chrome pages. e.g. even with activeTab we don't (and definitely shouldn't!) let an extension call executeScript on chrome://settings or chrome://extensions.
,
May 15 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by rdevlin....@chromium.org
, Nov 11 2016