I'm looking for some guidance on how to replace requests for a specific javascript file with another file that I'll package with the Firefox addon.
views:
97answers:
1
+4
A:
See How can I implement a content converter in Firefox for all page elements? (its scope is much wider than what you really need -- read on) on how to use registerFactory
to register a surrogate HTTP protocol handler, which can then instantiate channels with alternate (e.g. file:///...
-type) URIs when newChannel
is called with your particualr script's URI.
vladr
2010-06-30 18:56:22
So replace newchannel in `var newchannel = this.savedHttpHandler.newChannel(locationURI);` when locationURI is a ga.js uri? and replace it to a channel for a local copy included with the extension?
Erik Vold
2010-07-01 06:37:28
Exactly.Another option would have been to rewrite `<javascript>` nodes in the DOM, but I think that the protocol factory is simpler and more generic in this case.
vladr
2010-07-01 13:43:24
Thanks this information is helping, I'll be trying it out soon.
Erik Vold
2010-07-05 23:23:39