On 07/24/2012 06:54 AM, justSomeGuy wrote:
Hi,
I'm trying to get responses but I can't seem to figure out how to use
nsiTraceableChannel. What I already did is that i registered an observer for
http-on-modify-request and http-on-examine-response, which is working just
fine. Now what I'm trying to do is use nsiTraceableChannel to replace a stream
listener with my own which i implemented. This code is not working:
...
nsresult rv;
...
if(strcmp(aTopic, "http-on-examine-response"))
{
nsCOMPtr<nsITraceableChannel> traceableChannel = do_QueryInterface(aSubject,
&rv);
MyListener *myListener = new MyListener;
//nsCOMPtry<MyListener> myListener = new MyListener; //i tried this way too
rv = traceableChannel->SetNewListener(myListener,
getter_AddRefs(myListener->mListener)); //I put the nsCOMPtr<nsIStreamListener>
mListener; into the implementation of nsIStreamListener
...
}
It seems not to work. Am I doing something wrong (maybe i should create my
object in a diferent way)? Because my implementation of onStartRequest,
onDataAvailable and onStopRequest are never called.
In rv (nsresult) i get 0 (NS_OK). But it seems that the listener was never
replaced. I would realy apreciate your help.
Thank you in advanced for your help!
Looking over this code again, |if(strcmp(aTopic,
"http-on-examine-response"))| is incorrect. If that's present in the
original code, you should fix it.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform