On Wed, 27 Jun 2007 17:41:31 -0500, Boris Zbarsky wrote:
> Fabrice Desré wrote:
>> doContent: function(contentType, isContentPreferred, request,
>> contentHandler) {
>> dump("-- loading " + request.name + "\n"); contentHandler.value =
>> this.QueryInterface(CI.nsIStreamListener);
>
> I assume that |this| QIs to nsIStreamListener and nsIRequestObserver?
> And implements both? Is your OnStartRequest called?
I just added nsIRequestObserver support, and onStartRequest(),
onDataAvailable() and onStopRequest(). I'm using the following code in
onDataAvailable() :
onDataAvailable: function(request, context, inputStream, offset, count) {
var parser = CC["@mozilla.org/xmlextras/domparser;1"].
createInstance(CI.nsIDOMParser);
var doc = parser.parseFromStream(inputStream, null,
inputStream.available(), "text/xml");
if (doc.documentElement) {
// do useful stuff
}
}
So far it's working but it will probably fail if there are several
successive calls to onDataAvailable(), when loading a big file for
instance. What could be a solution in such a situation ?
Fabrice
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network