Content scripts have some limitations. They cannot:
Use chrome.* APIs, with the exception of:
- extension ( getURL , inIncognitoContext , lastError , onRequest , sendRequest )
- i18n
- runtime ( connect , getManifest , getURL , id , onConnect , onMessage , sendMessage )
- storage
(
https://developer.chrome.com/extensions/content_scripts )
Перенесите код в background скрипт.