mFiredUnloadEvent = PR_FALSE;
nsWebShell::SetupNewViewer(nsIContentViewer* aViewer){   NS_ENSURE_SUCCESS(FireUnloadEvent(), NS_ERROR_FAILURE);   NS_ENSURE_SUCCESS(nsDocShell::SetupNewViewer(aViewer), NS_ERROR_FAILURE);   // Set mFiredUnloadEvent = PR_FALSE so that the unload handler for the   // *new* document will fire.   mFiredUnloadEvent = PR_FALSE;    // If the history state has been set by session history,    // set it on the pres shell now that we have a content    // viewer.   if(mContentViewer && mHistoryState)      {      nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(mContentViewer));      if(docv)         {         nsCOMPtr<nsIPresShell> shell;         docv->GetPresShell(*getter_AddRefs(shell));         if(shell)            shell->SetHistoryState((nsILayoutHistoryState*)mHistoryState);         }      }   return NS_OK;}