In Firefox 42, I’m getting a security error when my addon attempts to load a local image file into one of its resource HTML pages. The error looks like this:
Security Error: Content at resource://jid1-aahxeyitr16k5q-at-jetpack/tabtrekker/data/tabtrekker.html may not load or link to file:///Users/gordonwong/Library/Application%20Support/Firefox/Profiles/hfs6diri.dev-edition-default/tabtrekker/images/1/0.jpg.
I wasn’t getting this error in previous Firefox versions. Is this intended behavior now?
My addon downloads those images so that it can load them faster in the future, but it looks like I can no longer do this. Any suggestions?
Try making a resource UI out of the file:/// uri you have there.
This makes a resource URI:
let res = Services.io.getProtocolHandler(“resource”).QueryInterface(Ci.nsIResProtocolHandler);
res.setSubstitution(“rawr”, Services.io.newURI(‘http://www.bing.com/’,null,null));
Or if you are using the sdk, you can create a data folder which will automatically assign resource urls to its content. Which are handled automatically by some sdk modules. And can be retreived through the self module.