NS_ADDREF(this);
nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,                                                         nsIURI* aURL){  nsresult rv = NS_OK;  // If we don't yet have a stream listener, we need to get   // one from the plugin.  // NOTE: this should only happen when a stream was NOT created   // with GetURL or PostURL (i.e. it's the initial stream we   // send to the plugin as determined by the SRC or DATA attribute)  if(mPStreamListener == nsnull && mInstance != nsnull)	  	   rv = mInstance->NewStream(&mPStreamListener);  if(rv != NS_OK)	   return rv;  if(mPStreamListener == nsnull)    return NS_ERROR_NULL_POINTER;    // get httpChannel to retrieve some info we need for nsIPluginStreamInfo setup  nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);  nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);  /*   * Assumption   * By the time nsPluginStreamListenerPeer::OnDataAvailable() gets   * called, all the headers have been read.   */  if (httpChannel)     httpChannel->VisitResponseHeaders(this);    mSetUpListener = PR_TRUE;    // set seekability  PRBool bSeekable = PR_FALSE;  if (httpChannel)  {    nsXPIDLCString range;    if(NS_SUCCEEDED(httpChannel->GetResponseHeader("accept-ranges", getter_Copies(range))))    {      if (0 == PL_strcmp(range.get(), "bytes"))        bSeekable = PR_TRUE;      /* XXX FIX-ME (see Bug 83183)         This is a hack to keep byte range request streams open but it casues a leak.         A good place to release would probablybe when the instance is stopped.      */      NS_ADDREF(this);    }  }  mPluginStreamInfo->SetSeekable(bSeekable);   // get Last-Modified header for plugin info  if (httpChannel)   {    char * lastModified = nsnull;    if (NS_SUCCEEDED(httpChannel->GetResponseHeader("last-modified", &lastModified)) &&        lastModified)    {      PRTime time64;      PR_ParseTimeString(lastModified, PR_TRUE, &time64);  //convert string time to interger time       // Convert PRTime to unix-style time_t, i.e. seconds since the epoch      double fpTime;      LL_L2D(fpTime, time64);      mPluginStreamInfo->SetLastModified((PRUint32)(fpTime * 1e-6 + 0.5));      nsCRT::free(lastModified);    }  }   char* urlString;  aURL->GetSpec(&urlString);  mPluginStreamInfo->SetURL(urlString);  nsCRT::free(urlString);  rv = mPStreamListener->OnStartBinding((nsIPluginStreamInfo*)mPluginStreamInfo);  mStartBinding = PR_TRUE;  if(rv == NS_OK)  {    mPStreamListener->GetStreamType(&mStreamType);    // check to see if we need to cache the file as well    if ((mStreamType == nsPluginStreamType_AsFile) ||         (mStreamType == nsPluginStreamType_AsFileOnly))    rv = SetUpCache(aURL);  }  return rv;}