Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { classes: Cc, interfaces: Ci } = Components;
- /**
- * oldCompose namespace
- */
- if (typeof oldCompose == "undefined") {
- var oldCompose =
- {
- // called by addObserver
- QueryInterface: function (iid) {
- if (iid.equals(Ci.nsIObserver) || iid.equals(Ci.nsISupports))
- return this;
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
- observe: function(subject, topic, data) {
- // Change user agent according to the host
- var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
- var host = httpChannel.getRequestHeader("Host").toLowerCase();
- if (host.indexOf("mail.google.com") == 0) {
- var agent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)";
- httpChannel.setRequestHeader("User-Agent", agent, false);
- }
- },
- install: function() {
- this.observerService =
- Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
- this.observerService.addObserver(this, "http-on-modify-request", false);
- },
- uninstall: function() {
- this.observerService.removeObserver(this, "http-on-modify-request");
- }
- }
- };
- /**
- * Global event handlers
- */
- function startup(data, aReason) {
- oldCompose.install();
- }
- function shutdown(data, aReason) {
- oldCompose.uninstall();
- }
- function install(data, aReason) {}
- function uninstall(data, aReason) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement