To my understanding, there are two types of scripts in an extension, one is "content scripts" that run from, and interact with DOM in webpages, which are governed by the same origin policy; the other are scripts, call them "extension scripts", that run in the background and may or may not interact with webpages, like main.js in Firefox or background.js in Chrome. Here is Google's explanation for extension scripts
"...have a single long-running script to manage some task or state ...the background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active"
So the question is, how does same-origin policy apply to "extension scripts"? And why should it, since these scripts are independent from contents on the webpage that is being viewed? What is the domain of an extension script anyway? (Google says "extension attempts to use a security origin other than itself", but doesn't explicitly state what the origin is.)
Could the following be done in an extension?
Example one : get the time from a time server, and display it on the add-on bar.
Example two : an extension that checks whether a recently closed page from an arbitrary domain (or a bookmarked but closed page) is updated, and alert the user if it is.
I know cross domain HTTP and Ftp requests in Chrome can be accomplished by using XMLHttpRequest after declaring permissions Http://*/. But what about Firefox? What about other protocols, like smtp, ppp, etc?
Is WebSocket in HTML5, used in an extension script, shackled by the same-domain policy?