Hi Boris,

Thanks for the quick response.

<snip>
> <http://lxr.mozilla.org/seamonkey/search?string=NS_NewInputStreamChann> for 
> C++
> examples), and return that channel.  The bad behavior is having to block the
> calling thread (so the UI thread) while you do your socket access.  This is 
> also
> suboptimal because you'll make the connection to the server even if the caller
> doesn't actually want to do so.

I was actually already doing this, but never thought about the
blocking behavior. Thanks for pointing this out, this solution is
definitely not desirable as it may take a considerable amount of time
to establish a 9P connection.

> A better approach is to create your own implementation of 
> nsIChannel/nsIRequest.
>   Return your object, then when the consumer calls AsyncOpen actually make the
> connection to the server... and wait for the data.  When you get a response,
> create whatever HTML you want to create, stick it in an input stream, and make
> the requisite OnStartRequest/OnDataAvailable/OnStopRequest calls.

I assume this means something like what has been implemented in the
SeaMonkey finger extension. I will try to understand its code and
adapt it to JavaScript (I am weak with C++!). Does this mean I can
display a small XUL file that shows some sort of "loading" message
while the request is being processed, and then show the actual data
when it arrives? Also, is asyncOpen() the only method I am expected to
implement for an nsIChannel?

If there are any extensions that already implement their own
nsIChannel in JavaScript, it would be ideal :) (I looked at some of
the Jabber extensions, but they don't seem to follow this method).

Thanks again,

Regards,
--
Anant

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

Reply via email to