I would like to create a Google Chrome extension that can fetch a remote javascript (via HTTPS) and execute it on a webpage (from within the extension sandbox). Basically, the script parses the page and generates data that I could then send back to my remote server.
The reason I want to do this is because I have a similar extension in Firefox, and I would like to unify the codebase as much as possible. I've already figured out how to do this in Firefox using a XmlHttpRequest and their evalInSandbox function.
Is this even possible in Chrome? It appears I can't use a XmlHttpRequest in Chrome, because it only allows XML or valid JSON (which excludes functions). I couldn't just insert a script tag on the page either, because then it wouldn't execute within the extension sandbox. Is there any way to do this?