NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIRequest *request, nsISupports* aContext, nsresult aStatus)
nsPluginCacheListener::OnStopRequest(nsIRequest *request, nsISupports* aContext, nsresult aStatus)
NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIRequest *request,                                                         nsISupports* aContext,                                                        nsresult aStatus){    nsresult rv = NS_OK;  nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(request);  nsCOMPtr<nsIFile> localFile;  nsXPIDLCString pathAndFilename;  // doing multiple requests, the main url load (the cacheable entry) could come  // out of order.  Here we will check to see if the request is main url load.    if (cacheChannel) {    rv = cacheChannel->GetCacheFile(getter_AddRefs(localFile));    if (NS_SUCCEEDED(rv)) {        localFile->GetPath(getter_Copies(pathAndFilename));        mPluginStreamInfo->SetLocalCachedFile(pathAndFilename);    }  }  // remove the request from our data forwarding count hash.  nsCOMPtr<nsIByteRangeRequest> brr = do_QueryInterface(request);  if (brr) {    PRInt32 absoluteOffset = 0;    brr->GetStartRange(&absoluteOffset);        nsPRUintKey key(absoluteOffset);    if (!mDataForwardToRequest)        return NS_ERROR_FAILURE;        (void) mDataForwardToRequest->Remove(&key);  }  // 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...  PRUint32 magicNumber = 0;  // set it to something that is not the magic number.  nsCOMPtr<nsISupportsPRUint32> container = do_QueryInterface(aContext);  if (container)    container->GetData(&magicNumber);        if (magicNumber == MAGIC_REQUEST_CONTEXT)  {    // this is one of our range requests    return NS_OK;  }    if(!mPStreamListener)      return NS_ERROR_FAILURE;  if (!pathAndFilename)    mPluginStreamInfo->GetLocalCachedFile(getter_Copies(pathAndFilename));  if (!pathAndFilename) {    // see if it is a file channel.    nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(request);    if (fileChannel)      fileChannel->GetFile(getter_AddRefs(localFile));    if (localFile)        localFile->GetPath(getter_Copies(pathAndFilename));    mPluginStreamInfo->SetLocalCachedFile(pathAndFilename);  }  if (pathAndFilename)    OnFileAvailable(pathAndFilename);    nsCOMPtr<nsIURI> aURL;  nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);  if (!channel)     return NS_ERROR_FAILURE;  rv = channel->GetURI(getter_AddRefs(aURL));  if (NS_FAILED(rv))     return rv;    nsXPIDLCString urlString;  rv = aURL->GetSpec(getter_Copies(urlString));  if (NS_SUCCEEDED(rv))     mPluginStreamInfo->SetURL(urlString);    // Set the content type to ensure we don't pass null to the plugin  nsXPIDLCString aContentType;  rv = channel->GetContentType(getter_Copies(aContentType));  if (NS_FAILED(rv))     return rv;  if (aContentType)    mPluginStreamInfo->SetContentType(aContentType);  if (mStartBinding)  {    // On start binding has been called    mPStreamListener->OnStopBinding((nsIPluginStreamInfo*)mPluginStreamInfo, aStatus);  }  else  {    // OnStartBinding hasn't been called, so complete the action.    mPStreamListener->OnStartBinding((nsIPluginStreamInfo*)mPluginStreamInfo);    mPStreamListener->OnStopBinding((nsIPluginStreamInfo*)mPluginStreamInfo, aStatus);  }  return NS_OK;}