On Wed, 24 Oct 2007, [EMAIL PROTECTED] wrote:
> 
> What if i replace the component @mozilla.org/network/protocol;1?
> name=http
> with my own protocol handler that basically forwards all API methods
> to the original
> http handler.
> 
> I should be able to intercept requests i'm interested in (presumably
> within the
> newChannel method) and return a channel of my own that i can control
> at will.
> 
> Would this method work implemented in javascript ?
> 

I once tried to do the same think in javascript and had some problems
with AJAX requests using my handler (I don't remember now if these
requests were using original handler or weren't working at all).  I
wrote then some note about this approach and attached source code, it
may be useful for you:
http://blues.ath.cx/firekeeper/archives/2006-06.html#e2006-06-09T00_02_55.txt


I ended up doing this in C++ but it is really painful. As Boris wrote
to make it work I had to implement all the interfaces that
nsHttpChannel implements. 

But additionally, it turned out that I also had to implement replacement
objects for channel's LoadGroup and NotificationCallback.  These
objects receive some progress notification for a request, but without
replacing them, listener receives information about original requests
not proxy ones and doesn't know what to do with them.

It basically is a lot of work and lot of frustrating debugging.

Regards,
Jan

_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network

Reply via email to