if(!mPStreamListener) return NS_ERROR_FAILURE;  nsCOMPtr<nsIChannel> channel = do_QueryInterface(request); if (!channel) return NS_ERROR_FAILURE;  nsCAutoString aContentType; rv = channel->GetContentType(aContentType); if (NS_FAILED(rv)) return rv;  if (!aContentType.IsEmpty()) mPluginStreamInfo->SetContentType(aContentType.get());   if (mRequestFailed) aStatus = NS_ERROR_FAILURE;  if (NS_FAILED(aStatus)) {   mPStreamListener->OnStopBinding(mPluginStreamInfo, aStatus); return NS_OK; }   if (mStreamType >= nsPluginStreamType_AsFile) { nsCOMPtr<nsIFile> localFile = do_QueryInterface(mLocalCachedFile); if (!localFile) { nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(request); if (cacheChannel) { cacheChannel->GetCacheFile(getter_AddRefs(localFile)); } else {  nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(request); if (fileChannel) { fileChannel->GetFile(getter_AddRefs(localFile)); } } }  if (localFile) { OnFileAvailable(localFile); } }  if (mStartBinding) {  mPStreamListener->OnStopBinding(mPluginStreamInfo, aStatus); } else {  mPStreamListener->OnStartBinding(mPluginStreamInfo); mPStreamListener->OnStopBinding(mPluginStreamInfo, aStatus); }  if (NS_SUCCEEDED(aStatus)) mPluginStreamInfo->SetStreamComplete(PR_TRUE);  return NS_OK;
return mStreamConverter->OnStopRequest(request, ctxt, status);
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIRequest *request,                                                        nsISupports* aContext,                                                        nsresult aStatus){  nsresult rv = NS_OK;  PLUGIN_LOG(PLUGIN_LOG_NOISY,  ("nsPluginStreamListenerPeer::OnStopRequest this=%p aStatus=%d request=%p\n",  this, aStatus, request));  // for ByteRangeRequest we're just updating the mDataForwardToRequest hash and return.  nsCOMPtr<nsIByteRangeRequest> brr = do_QueryInterface(request);  if (brr) {    PRInt32 absoluteOffset = 0;    brr->GetStartRange(&absoluteOffset);    nsPRUintKey key(absoluteOffset);    // remove the request from our data forwarding count hash.    (void) mDataForwardToRequest->Remove(&key);    PLUGIN_LOG(PLUGIN_LOG_NOISY,    ("                          ::OnStopRequest for ByteRangeRequest Started=%d\n",    absoluteOffset));  } else {    // if this is not byte range request and    // if we are writting the stream to disk ourselves,    // close & tear it down here    mFileCacheOutputStream = nsnull;  }  // if we still have pending stuff to do, lets not close the plugin socket.  if (--mPendingRequests > 0)      return NS_OK;  // we keep our connections around...  nsCOMPtr<nsISupportsPRUint32> container = do_QueryInterface(aContext);  if (container) {    PRUint32 magicNumber = 0;  // set it to something that is not the magic number.    container->GetData(&magicNumber);    if (magicNumber == MAGIC_REQUEST_CONTEXT) {      // this is one of our range requests      return NS_OK;    }  }  if(!mPStreamListener)      return NS_ERROR_FAILURE;  nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);  if (!channel)    return NS_ERROR_FAILURE;  // Set the content type to ensure we don't pass null to the plugin  nsCAutoString aContentType;  rv = channel->GetContentType(aContentType);  if (NS_FAILED(rv))    return rv;  if (!aContentType.IsEmpty())    mPluginStreamInfo->SetContentType(aContentType.get());  // set error status if stream failed so we notify the plugin  if (mRequestFailed)    aStatus = NS_ERROR_FAILURE;  if (NS_FAILED(aStatus)) {    // on error status cleanup the stream    // and return w/o OnFileAvailable()    mPStreamListener->OnStopBinding(mPluginStreamInfo, aStatus);    return NS_OK;  }  // call OnFileAvailable if plugin requests stream type StreamType_AsFile or StreamType_AsFileOnly  if (mStreamType >= nsPluginStreamType_AsFile) {    nsCOMPtr<nsIFile> localFile = do_QueryInterface(mLocalCachedFile);    if (!localFile) {      nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(request);      if (cacheChannel) {        cacheChannel->GetCacheFile(getter_AddRefs(localFile));      } else {        // see if it is a file channel.        nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(request);        if (fileChannel) {          fileChannel->GetFile(getter_AddRefs(localFile));        }      }    }    if (localFile) {      OnFileAvailable(localFile);    }  }  if (mStartBinding)  {    // On start binding has been called    mPStreamListener->OnStopBinding(mPluginStreamInfo, aStatus);  }  else  {    // OnStartBinding hasn't been called, so complete the action.    mPStreamListener->OnStartBinding(mPluginStreamInfo);    mPStreamListener->OnStopBinding(mPluginStreamInfo, aStatus);  }  if (NS_SUCCEEDED(aStatus))    mPluginStreamInfo->SetStreamComplete(PR_TRUE);  return NS_OK;}