On 4/8/13 11:31 AM,
jef...@gmail.com wrote:
> Hi Boris. I would like to return the new channel, but newChannel is not asynchronous, but the call to nsIChannel asyncOpen is asynchronous. I need to use the initial URI to look up on the network which can take a few seconds, and then redirect so that Firefox can asynchronously load from the new URI.
OK. In that case, you probably want to do an actual redirect from your
old channel to the new one.
That mainly consists of the following:
1) Creating the new channel and setting it up correctly.
2) Notifying redirect observers that you're redirecting and waiting
for them to respond.
3) calling asyncOpen on the new channel with your request observer.
I don't see any JS examples offhand, unfortunately, but this should all
be doable from JS, yes.
> Is it OK for newChannel to block for a few seconds while looking up the new URI?
No, it's not. ;)
-Boris