("nsPluginStreamListenerPeer::OnStartRequest request=%p mime=%s, url=%s\n", request, aContentType, urlSpec));
("nsPluginStreamListenerPeer::OnStartRequest this=%p request=%p mime=%s, url=%s\n", this, request, aContentType, urlSpec));
nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, nsISupports* aContext){  nsresult  rv = NS_OK;  if (mHaveFiredOnStartRequest) {      return NS_OK;  }  mHaveFiredOnStartRequest = PR_TRUE;  // do a little sanity check to make sure our frame isn't gone  // by getting the tag type and checking for an error, we can determine if  // the frame is gone  if (mOwner) {    nsCOMPtr<nsIPluginTagInfo2> pti2 = do_QueryInterface(mOwner);    NS_ENSURE_TRUE(pti2, NS_ERROR_FAILURE);    nsPluginTagType tagType;      if (NS_FAILED(pti2->GetTagType(&tagType)))      return NS_ERROR_FAILURE;  // something happened to our object frame, so bail!  }  nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);  NS_ENSURE_TRUE(channel, NS_ERROR_FAILURE);  nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(channel, &rv);  if (cacheChannel)        rv = cacheChannel->SetCacheAsFile(PR_TRUE);        if (NS_FAILED(rv)) {    // The channel doesn't want to do our bidding, lets cache it to disk ourselves    rv = SetupPluginCacheFile(channel);    if (NS_FAILED(rv))      NS_WARNING("No Cache Aval.  Some plugins wont work OR we don't have a URL");    }  char* aContentType = nsnull;  rv = channel->GetContentType(&aContentType);  if (NS_FAILED(rv)) return rv;  nsCOMPtr<nsIURI> aURL;  rv = channel->GetURI(getter_AddRefs(aURL));  if (NS_FAILED(rv)) return rv;  if (nsnull != aContentType)    mPluginStreamInfo->SetContentType(aContentType);#ifdef PLUGIN_LOGGING  char* urlSpec = nsnull;  if(aURL != nsnull) (void)aURL->GetSpec(&urlSpec);  PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NOISY,  ("nsPluginStreamListenerPeer::OnStartRequest request=%p mime=%s, url=%s\n",  request, aContentType, urlSpec));  PR_LogFlush();  if (urlSpec) nsCRT::free(urlSpec);#endif  nsPluginWindow    *window = nsnull;  // if we don't have an nsIPluginInstance (mInstance), it means  // we weren't able to load a plugin previously because we  // didn't have the mimetype.  Now that we do (aContentType),  // we'll try again with SetUpPluginInstance()   // which is called by InstantiateEmbededPlugin()  // NOTE: we don't want to try again if we didn't get the MIME type this time  if ((nsnull == mInstance) && (nsnull != mOwner) && (nsnull != aContentType))  {    mOwner->GetInstance(mInstance);    mOwner->GetWindow(window);    if ((nsnull == mInstance) && (nsnull != mHost) && (nsnull != window))    {      // determine if we need to try embedded again. FullPage takes a different code path      nsPluginMode mode;      mOwner->GetMode(&mode);      if (mode == nsPluginMode_Embedded)        rv = mHost->InstantiateEmbededPlugin(aContentType, aURL, mOwner);      else        rv = mHost->SetUpPluginInstance(aContentType, aURL, mOwner);      if (NS_OK == rv)      {        // GetInstance() adds a ref        mOwner->GetInstance(mInstance);        if (nsnull != mInstance)        {          mInstance->Start();          mOwner->CreateWidget();          // If we've got a native window, the let the plugin know          // about it.          if (window->window)            mInstance->SetWindow(window);        }      }    }  }  nsCRT::free(aContentType);  //  // Set up the stream listener...  //  PRInt32 length;  rv = channel->GetContentLength(&length);  // it's possible for the server to not send a Content-Length.  We should  // still work in this case.  if (NS_FAILED(rv)) {    mPluginStreamInfo->SetLength(-1);  }  else {    mPluginStreamInfo->SetLength(length);  }  rv = SetUpStreamListener(request, aURL);  if (NS_FAILED(rv)) return rv;  return rv;}