Skip to content

Commit

Permalink
untabify
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzker committed Jun 27, 2011
1 parent 7442893 commit 0bccfc9
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions components/hxxp.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,38 +17,38 @@ HxxpProtocol.prototype = {
classID: Components.ID("{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"), classID: Components.ID("{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"),
contractID: "@mozilla.org/network/protocol;1?name=hxxp", contractID: "@mozilla.org/network/protocol;1?name=hxxp",
protocolFlags: (Ci.nsIProtocolHandler.URI_NORELATIVE | protocolFlags: (Ci.nsIProtocolHandler.URI_NORELATIVE |
Ci.nsIProtocolHandler.URI_NOAUTH | Ci.nsIProtocolHandler.URI_NOAUTH |
Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE), Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler, Ci.nsIObserver]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler, Ci.nsIObserver]),


newURI: function(spec, charset, base) { newURI: function(spec, charset, base) {
var uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI); var uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
uri.spec = spec; uri.spec = spec;
return uri; return uri;
}, },


newChannel: function(uri) { newChannel: function(uri) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var url = uri.spec.split(";ref://")[0].replace(/^hxxp:/, "http:"); var url = uri.spec.split(";ref://")[0].replace(/^hxxp:/, "http:");
channel = ios.newChannel(url, null, null); channel = ios.newChannel(url, null, null);
channel.originalURI = uri; channel.originalURI = uri;
return channel; return channel;
}, },


observe: function(subject, topic, data) observe: function(subject, topic, data)
{ {
if (topic == "http-on-modify-request") { if (topic == "http-on-modify-request") {
var channel = subject.QueryInterface(Ci.nsIHttpChannel); var channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (channel.originalURI.spec.match(/^hxxp:/)) { if (channel.originalURI.spec.match(/^hxxp:/)) {
var s = channel.originalURI.spec.split(";ref://"); var s = channel.originalURI.spec.split(";ref://");
var ref = s[1] ? "http://" + s[1] : channel.URI.spec; var ref = s[1] ? "http://" + s[1] : channel.URI.spec;
channel.setRequestHeader("Referer", ref, false); channel.setRequestHeader("Referer", ref, false);
} }
} }
else if (topic == "profile-after-change") { else if (topic == "profile-after-change") {
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.addObserver(this, "http-on-modify-request", false); os.addObserver(this, "http-on-modify-request", false);
} }
}, },
} }


Expand Down

0 comments on commit 0bccfc9

Please sign in to comment.