I need to pass my variable defined in my content script to the script that I inject into the web page. For example, I need to use an image defined in the content script like this:
var myImage = browser.extension.getURL("myImage.jpg");
Then I inject some script from the content script to the loaded page as:
var s = document.createElement('script');
s.src = browser.extension.getURL("myscript.js");
document.body.appendChild(s);
How can I access the variable "myImage" in the script "myscript.js"?