ImageConsumer::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg) #endif
ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresult status, const PRUnichar* aMsg)
ImageConsumer::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)#endif{  if (mTimer != nsnull) {    NS_RELEASE(mTimer);  }  if (NS_BINDING_SUCCEEDED != status) {    mStatus = MK_INTERRUPTED;  }  // Since we're still holding on to the stream, there's still data  // that needs to be read. So, pump the stream ourselves.  if((mStream != nsnull) && (status == NS_BINDING_SUCCEEDED)) {    PRUint32 str_length;    nsresult err = mStream->Available(&str_length);    if (NS_SUCCEEDED(err)) {      NS_ASSERTION((str_length > 0), "No data left in the stream!");#ifdef NECKO      err = OnDataAvailable(channel, aContext, mStream, 0, str_length);  // XXX fix offset#else      err = OnDataAvailable(aURL, mStream, str_length);#endif      if (NS_SUCCEEDED(err)) {        // If we still have the stream, there's still data to be         // pumped, so we set a timer to call us back again.        if (mStream) {          SetKeepPumpingData(channel, aContext);          if ((NS_OK != NS_NewTimer(&mTimer)) ||              (NS_OK != mTimer->Init(ImageConsumer::KeepPumpingStream, this, 0))) {            mStatus = MK_IMAGE_LOSSAGE;            NS_RELEASE(mStream);          }          else {            return NS_OK;          }        }      }      else {        mStatus = MK_IMAGE_LOSSAGE;        NS_IF_RELEASE(mStream);      }    }    else {      mStatus = MK_IMAGE_LOSSAGE;      NS_IF_RELEASE(mStream);    }  }  ilINetReader *reader = mURL->GetReader();  if (0 != mStatus) {    reader->StreamAbort(mStatus);  }  else {    reader->StreamComplete(PR_FALSE);  }  reader->NetRequestDone(mURL, mStatus);  NS_RELEASE(reader);  #ifdef NECKO  return mContext->RequestDone(this, channel, aContext, status, aMsg);#else  mContext->RequestDone(this);  return NS_OK;#endif}