[Greasemonkey] How to specify script injection time

Steve Krulewitz shooz at mm.st
Sun Jul 17 13:32:30 EDT 2005

Aaron Boodman wrote:
>>It seems like there might be a few possibilities, the most obvious would
>>be to replace the stock nsHTTPHandler with a custom version. 
> Yep, that's exactly what I tried to do, and is definitely the sexiest
> solution. I'll have to post the code at some point.

Yes, I would love to see how this was done :)

> Basically what I
> did was wrap try to wrap the stream coming off the server and a new
> nsIMemoryStream in nsIMultiplexStream. It should have been fast, even
> implemented in JS because the real work continues being done in the
> native C++ stream. Only a tiny bit of work at the very end gets done
> in JavaScript.

Keeping GM 100% JS would be the best situation, but having some C++ in
there may not be the end of the world.  The new Google Toolbar uses
natively compiled XPCOM services, and the install was as simple as any
other extension on my system (x86 linux).

Hopefully, such a hack will indeed be possible in JS, otherwise, would
the complexity of building the native code outweigh the benefits of this
style of injection?


More information about the Greasemonkey mailing list