Hi all,

This is driving me nuts, so I'd appreciate any thoughts on this.

I am trying set an nsIProgressEventSink for an XMLHttpRequest's channel,
but the sink never fires. I can see the notificationCallback requesting
the nsIProgressEventSink interface but that's as far as it gets.

// ---------------

var nsIProgressEventSink = {
  onProgress: function(request, context, progress, progressMax) {
    dump( "\nProgress: " +progress );
  },
  onStatus: function(request, context, status, statusArg) {
    dump( "\nStatus: " +status );
  },
  QueryInterface: function(iid) {
    if ( iid.equals( Components.interfaces.nsIProgressEventSink ) ||
     iid.equals( Components.interfaces.nsISupports ) )
    return this;
    Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
    return null;
  }
};

var nsIRequestor = {
  eventSink: nsIProgressEventSink,
  getInterface: function(iid)   {
   if (iid.equals(Components.interfaces.nsIProgressEventSink))
     return this.eventSink;
  }
};

var httpRequest =
Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
httpRequest.QueryInterface(Components.interfaces.nsIXMLHttpRequest);

httpRequest.open("POST", "http://host.domain.com/path";);

httpRequest.channel.notificationCallbacks = nsIRequestor;
httpRequest.send(data);

// ---------------


LXR says: "The channel will begin passing notifications to the progress event sink after its 'asyncOpen' method has been called."

I am assuming that as I don't own the nsIChannel that it gets called for
me??

Bug #261083 on nsIChannel callbacks says is't fixed, so I am assuming it isn't that.

Cheers,

Neil



_______________________________________________
Mozilla-netlib mailing list
Mozilla-netlib@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-netlib

Reply via email to