Created
August 29, 2011 18:08
-
-
Save bmidgley/1178985 to your computer and use it in GitHub Desktop.
fennec browser load/switch detection + local proxy server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Cc = Components.classes; | |
var Ci = Components.interfaces; | |
var Cu = Components.utils; | |
Cu.import("resource://gre/modules/Services.jsm"); | |
function startup(aData, aReason) { | |
var gBaseURL; | |
var installSpec = Services.io.newFileURI(aData.installPath).spec; | |
if (aData.installPath.isDirectory()) | |
gBaseURL = installSpec; | |
else | |
gBaseURL = "jar:" + installSpec + "!/"; | |
var contentURL = gBaseURL + "content.js"; | |
var messageManager = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIChromeFrameMessageManager); | |
messageManager.loadFrameScript(contentURL, true); | |
} | |
function shutdown(aData, aReason) {} | |
function install(aData, aReason) {} | |
function uninstall(aData, aReason) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Cc = Components.classes; | |
var Ci = Components.interfaces; | |
var Cu = Components.utils; | |
addEventListener("load", doCheck, true); | |
addEventListener("focus", doCheck, true); | |
function doCheck(event) { | |
state = event.originalTarget.body.classList.contains("stereo"); | |
var req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); | |
req.open("GET", "http://localhost:3000?stereo=" + state, true); | |
req.send(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> | |
<Description about="urn:mozilla:install-manifest"> | |
<em:id>[email protected]</em:id> | |
<em:type>2</em:type> | |
<em:name>Simple</em:name> | |
<em:version>1.0</em:version> | |
<em:bootstrap>true</em:bootstrap> | |
<em:creator>Midgley</em:creator> | |
<em:targetApplication> | |
<Description> | |
<em:id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</em:id> | |
<em:minVersion>4.0b4pre</em:minVersion> | |
<em:maxVersion>7.*</em:maxVersion> | |
</Description> | |
</em:targetApplication> | |
</Description> | |
</RDF> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment