>> Suppose I have custom sources for some html, css, js and images that >> I can't save to the files, and I want mozilla browser to use them as >> memory streams. Is there a way to intercept URLs/URIs activity and >> provide my own streams with content I have? What interfaces/listeners >> to check? Any ideas? > > You can register a protocol handler for a custom protocol (as in, > myproto://anything) . You create an XPCOM component implementing > nsIProtocolHandler, and register it under the contractid of > "@mozilla.org/network/protocol;1?name=myproto". The real work happens in > nsIProtocolHandler::NewChannel where you need to create and return an > nsIChannel implementation given a URL. Probably the easiest way is to use > nsIInputStreamChannel component, which is a channel that gets its data > from a stream (specifically nsIInputStream). >
Thanks Igor, That's a good way indeed. But I wanted to work with good old http. Is it possible to intercept all http/https requests, handle all requests with specific host name, and pass all the other requests to the standard handler? I think it may require intercepting service that creates nsIOService. Right or there is a simplier way? Also I found some info related to nsIURIContentListener, but could not get DoContent() method called yet, and looks like it unconditionally goes through the standard network. If so, it is not what I need. Is there another way? TIA. _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
