"Chrome.tabs is not supported..."
Solution 1:
Typically, the cause is a misbehaving extension. In my case it was "MeasureIt!". To identify, which extension is making troubles, you can either
deactivate them one by one and test
- deactivate all the extensions
- ensure the error is gone
- activate extensions one by one
- test if the error reappears, repeat from step 3
or
search their source code
- open
chrome://extensions
- activate "Developer mode" in the top right corner
- now you can open
background.html
for every extension - Ctrl+F, type in "chrome.tabs" to search for suspicious code spots
- give feedback to the extension creator
Solution 2:
You cannot use chrome.tabs
in content scripts. According to the documentation,
...content scripts have some limitations. They cannot:
- Use chrome.* APIs (except for parts of chrome.extension)
- Use variables or functions defined by their extension's pages
- Use variables or functions defined by web pages or by other content scripts
So, you can only use the chrome.tabs
API in background pages or other extension pages.
You can use extension message passing to request that a background page use chrome.tabs
.
Solution 3:
This is caused by an extension using the chrome.tabs
permission, but without specifying that it does so in the manifest.json
packaged with the extension. The trick is not just to find the extension that uses chrome.tabs
, but to find the one that does so without announcing it.
Start with a more automated approach (multi-line commands for readability): On *nix:
$ find . -type f \
> | xargs grep -l chrome.tabs \
> | cut -d '/' -f 2 \
> | uniq
On Windows, using PowerShell:
> gci -rec |? {-not $_.PSIsContainer} `
>> | sls 'chrome.tabs' `
>> | select -Unique Path `
>> |% {$_.Path.Split('\')[10] } `
>> | select -Unique
>>
Then go to the chrome://extensions
tab to match directories in the results to extension names, and click the permissions of each one to see who isn't copping to their usage of chrome.tabs
. Note that on the 4th line of the PowerShell snippet, I index '10' because that's how many path components there are from C:\
to the Extensions
directory; it could be different on your system.
In my case, I fully automated the search by tacking on a couple more segments to the pipeline:
$ find . type f \
> | xargs grep -l chrome.tabs \
> | cut -d '/' -f 2 \
> | uniq \
> | xargs -I % find % -name 'manifest.json' \
> | xargs grep -L tabs
hipbfijinpcgfogaopmgehiegacbhmob/16.0.544_0/manifest.json
hipbfijinpcgfogaopmgehiegacbhmob/17.1_0/manifest.json
hipbfijinpcgfogaopmgehiegacbhmob/18.1_0/manifest.json
Now, looking in chrome://extensions
:
Busted.