if (!mDidAddRef) { mDidAddRef=PR_TRUE; NS_ADDREF(mPluginStreamListenerPeer); }
nsPluginStreamInfo::RequestRead(nsByteRange* rangeList){  mPluginStreamListenerPeer->mAbort = PR_TRUE;  nsresult rv = NS_OK;  nsCOMPtr<nsIURI> url;  rv = NS_NewURI(getter_AddRefs(url), mURL);  nsCOMPtr<nsIChannel> channel;  rv = NS_OpenURI(getter_AddRefs(channel), url, nsnull, nsnull, nsnull);  if (NS_FAILED(rv))     return rv;  nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));  if(!httpChannel)    return NS_ERROR_FAILURE;  char *rangeString;  PRInt32 numRequests;  MakeByteRangeString(rangeList, &rangeString, &numRequests);    if(!rangeString)    return NS_ERROR_FAILURE;  httpChannel->SetRequestHeader("Range", rangeString);  delete [] rangeString;  // instruct old stream listener to cancel the request on the next  // attempt to write.   nsCOMPtr<nsIStreamListener> converter = mPluginStreamListenerPeer;  if (numRequests > 1) {    nsCOMPtr<nsIStreamConverterService> serv = do_GetService(kStreamConverterServiceCID, &rv);    if (NS_FAILED(rv))        return rv;      rv = serv->AsyncConvertData(NS_LITERAL_STRING(MULTIPART_BYTERANGES).get(),                                NS_LITERAL_STRING("*/*").get(),                                mPluginStreamListenerPeer,                                nsnull,                                getter_AddRefs(converter));    if (NS_FAILED(rv))        return rv;  }  mPluginStreamListenerPeer->mPendingRequests += numRequests;   nsCOMPtr<nsISupportsPRUint32> container = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID, &rv);   if (NS_FAILED(rv)) return rv;   rv = container->SetData(MAGIC_REQUEST_CONTEXT);   if (NS_FAILED(rv)) return rv;   return channel->AsyncOpen(converter, container);}