On Aug 27, 8:41 am, Christian Biesinger <[EMAIL PROTECTED]> wrote:
> Diaa wrote:
> > Is there any example/sample code that I can use as a guide?
> > How to use the listener, for example, from the main thread when the
> > data is actually received in the worker thread?
>
> Unfortunately I'm not aware of any sample code for this. As for calling
> the listener, all you have to do is use
> nsIProxyObjectManager::GetProxyForObject (or the NS_GetProxyForObject
> helper method) at asyncOpen time (make sure to pass PROXY_ALWAYS), then
> you can just call methods on that object from any thread and have the
> calls be forwarded to the correct thread.
>
> -christian

Yes I did that and it worked properly, thanks much.
There's another problem I ran into which is that no progress bar is
displayed and FF is not aware about loading(even the Stop button is
disabled), I tried using the NotificationCallbacks provided by the
client but nothing happened, then when I used the loadgroup(Called
AddRequest & RemoveRequest), everything went fine except that -
strangely - 2 channels(and sometimes more) are created for each
request, other channels are created with the same URI and load the
resource again, I can't find out why this is happeneing, but when I
remove the loadgroup AddRequest and RemoveRequest it works properly
and only one channel is created.
Do you have any ideas?

Here's a log that shows sequence of function calls:

ZipChannel()
Init()
SetNotificationCallbacks()
SetLoadFlags()
AsyncOpen()
Leaving AsyncOpen()
ZipChannel()    <-- another channel created.
Init()
SetNotificationCallbacks()
SetLoadFlags()
SetOriginalURI()
SetLoadFlags()
SetLoadFlags()
GetURI()
SetLoadGroup()
AsyncOpen()
SetLoadFlags()
SetLoadFlags()
SetLoadFlags()
GetURI()
GetURI()
SetLoadFlags()
Leaving AsyncOpen()
Cancel()
OnStartRequest()
GetContentType()
Cancel()
OnStartRequest()
GetStatus()
GetContentType()
filesize: 568159
Retrieving data
filesize: 568159
Thread finished
Done retrieving data, 131072 bytes
OnDataAvailable()
SetContentType()
GetStatus()
GetContentType()
SetLoadFlags()
SetLoadFlags()
SetLoadFlags()
GetURI()
SetLoadFlags()
GetOriginalURI()
SetLoadFlags()
GetContentType()
SetLoadFlags()
GetOriginalURI()
GetLoadGroup()
GetSecurityInfo()
GetSecurityInfo()
GetURI()
GetURI()
GetContentType()
GetURI()
SetLoadFlags()
GetLoadGroup()
GetContentType()
GetStatus()
Retrieving data
GetURI()
Done retrieving data, 131072 bytes
OnDataAvailable()
Retrieving data
Done retrieving data, 131072 bytes
OnDataAvailable()
Retrieving data
Done retrieving data, 131072 bytes
OnDataAvailable()
Retrieving data
Done retrieving data, 43871 bytes
OnDataAvailable()
Thread finished
OnStopRequest()
GetOriginalURI()
SetLoadFlags()
GetURI()
SetLoadFlags()
GetURI()
SetLoadFlags()
GetNotificationCallbacks()
GetSecurityInfo()
GetSecurityInfo()
GetStatus()
GetURI()
SetLoadFlags()
GetURI()
GetURI()
GetOriginalURI()
ZipChannel()    <-- A third channel created.
Init()
SetNotificationCallbacks()
AsyncOpen()
Leaving AsyncOpen()
GetURI()
GetURI()
SetLoadFlags()
OnStartRequest()
filesize: 568159
Retrieving data
Done retrieving data, 131072 bytes
OnDataAvailable()
Retrieving data
calling OnProgress
Done retrieving data, 131072 bytes
Retrieving data
OnDataAvailable()
calling OnProgress
Done retrieving data, 131072 bytes
Retrieving data
OnDataAvailable()
calling OnProgress
Done retrieving data, 131072 bytes
Retrieving data
OnDataAvailable()
calling OnProgress
Done retrieving data, 43871 bytes
Thread finished
OnDataAvailable()
calling OnProgress
OnStopRequest()

Thanks

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

Reply via email to