GeckoFx - sample for installing own content handlers?

219 Views Asked by At

I've been playing around with GeckoFx (v29 from Bitbucket) and have got it to do almost everything I need except one key thing, which is to provide my own content handlers that are responsible for all network requests for any resources. I.e., I'm assuming there's some sort of callback or class I can register that gets called every time Gecko needs to perform any HTTP(s) request (GET/POST/PUT etc.) at which point I can handle this behaviour myself and return the result. But I can't find any samples showing how to do it, and nothing I've tried so far has worked.

Unfortunately it looks like Gecko won't be able to support one thing I do sort of need - which is to be able to match each request to the originating DOM element/attribute where applicable - i.e. if there's in the source, then I'd want the callback function to be informed not just that the result of a "GET apple.png" is needed, but that it was due to such and such IMG element in the DOM - and indeed if it was, for instance, an XMLHttpRequest, I'd like to know what line in the JavaScript code it was coming from.

Any help appreciated, including any suggestions of alternative libraries that might be able to do this, or other forums where this might be better asked (I can't seem to find any, and didn't get any response from a message posted to the bitbucket repository owner).

Thanks

Dylan

P.S. what I've tried is to write a class implementing nsIHttpProtocolHandler and nsIObserver, a matching nsIFactory class, and use BaseNsFactory.Register("@mozilla.org/network/protocol;1?name=http"); The factory class gets called fine, but on attempting to do any navigation I get FaultExecutionEngineError. This is all guesswork, as I can't seem to find any documentation explaining how to do it.

0

There are 0 best solutions below