I’ve just been updating a chrome plugin to manifest version 2. I’ve had no issues with permissions relating to javascript but the plugin has some image assets packaged with it that are no longer showing up.
The two specific cases are in popup notifications when the user interacts with the plugin in certain ways and some small images the plugin inserts into certain pages. In both cases the images are packaged with the plugin. I’m having no issue with the plugin loading images from external resources. My object-src setting in the content_security_policy includes 'self'.
What am I missing? I can open the images if I navigate to them directly via “chrome-extension:///some_img.png” so they are definitely there. I’ve used the webkit inspector and finding the img that has been inserted, right clicking on the img src and opening in a new tab also shows the img so the urls being inserted are correct (which they should be, I’m using the chrome.extension.getURL function).
UPDATE:
Setting img-src in the content_security_policy also did nothing. I don’t know if chrome even uses that particular option but it’s in the W3C spec.
After digging through the changelog for the last few chrome versions, I came across a new (added in Chrome 18) manifest option
web_accessible_resources. This needs to be added to your manifest with a value that’s a list of strings. The strings are paths in you plugin’s directory to resources (imgs etc…) that you want to be accessible within web pages (or importantly, chrome desktop notifications). Adding this parameter to my manifest gave permissions for the necessary images to be loaded.