G'day everyone,
I'm trying to write a new protocol handler for firefox. At the first
level it will take a nereus://[EMAIL PROTECTED]/path url and rearrange
this to a http://domain/machine/path URL.
This works fine. However I don't want it to change the actual
displayed address in the addressbar? Any ideas are very welcome. Thank
you very much for your help.
I was also wondering if it is possible in javascript to hook in the
firefox functions to use rsa encryption of a channel?
The relevant method (i think) is included here:
newChannel: function(aURI)
{
//alert("here we are2");
var ios =
Components.classes[kIOSERVICE_CONTRACTID].getService(nsIIOService);
//hack against crash by providing a correct return channel
var dumbnsiURI = ios.newURI("chrome://nereus/locale/
formatError.html", null, null);
var dumbChannel =
ios.newChannelFromURI(dumbnsiURI).QueryInterface(Components.interfaces.nsIChannel);
var uri = Components.classes["@mozilla.org/network/standard-url;
1"].createInstance(nsIURI);
var partURI = aURI.spec.split("@");
var machine = partURI[0].substring(9);
var rest = partURI[1];
var index = rest.indexOf("/");
var domain = rest.substring(0, index);
var path = rest.substring(index + 1);
uri.spec = "http://" + domain + "/" + machine + "/" + path + path;
myURI = uri.resolve(uri.spec);
try
{
// rewrites the url in the location bar back to http
// try not to rewrite .. and it works ..
nsiURI = ios.newURI("http:" + myURI.substring(7), null, null);
}
catch(e)
{
// it isn't a valid url
return dumbChannel;
}
// if it doesnt come from a link the ref is written here
var myChannel =
ios.newChannelFromURI(nsiURI).QueryInterface(Components.interfaces.nsIHttpChannel);
// else if it comes from a link we call "http-on-modify-request"
this.observe(null,"app-startup",null)
return myChannel;
},
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network