Bug 622480, no need to save old presentation always, r=bz, a=blocking
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Tue, 18 Jan 2011 21:55:04 +0200
changeset 60827 62157abe57bfc6bd50b66df731cf501b97e0a24e
parent 60826 5337fe8a5bfb1bb9499c51f9a7bb3242be61f07b
child 60828 c0c31420a5e32b2d34e834de9a8724ae93ceab50
push id18124
push useropettay@mozilla.com
push dateTue, 18 Jan 2011 21:24:13 +0000
treeherdermozilla-central@62157abe57bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, blocking
bugs622480
milestone2.0b10pre
first release with
nightly win64
62157abe57bf / 4.0b10pre / 20110118132817 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
Bug 622480, no need to save old presentation always, r=bz, a=blocking
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -6443,17 +6443,18 @@ nsDocShell::EnsureContentViewer()
         doc->SetIsInitialDocument(PR_TRUE);
     }
 
     return rv;
 }
 
 nsresult
 nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
-                                          nsIURI* aBaseURI)
+                                          nsIURI* aBaseURI,
+                                          PRBool aTryToSaveOldPresentation)
 {
   nsCOMPtr<nsIDocument> blankDoc;
   nsCOMPtr<nsIContentViewer> viewer;
   nsresult rv = NS_ERROR_FAILURE;
 
   /* mCreatingDocument should never be true at this point. However, it's
      a theoretical possibility. We want to know about it and make it stop,
      and this sounds like a job for an assertion. */
@@ -6475,17 +6476,18 @@ nsDocShell::CreateAboutBlankContentViewe
     PRBool okToUnload;
     rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
 
     if (NS_SUCCEEDED(rv) && !okToUnload) {
       // The user chose not to unload the page, interrupt the load.
       return NS_ERROR_FAILURE;
     }
 
-    mSavingOldViewer = CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
+    mSavingOldViewer = aTryToSaveOldPresentation && 
+                       CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
 
     // Make sure to blow away our mLoadingURI just in case.  No loads
     // from inside this pagehide.
     mLoadingURI = nsnull;
     
     // Notify the current document that it is about to be unloaded!!
     //
     // It is important to fire the unload() notification *before* any state
@@ -9987,17 +9989,20 @@ nsDocShell::LoadHistoryEntry(nsISHEntry 
     PRBool isJS;
     nsresult rv = uri->SchemeIs("javascript", &isJS);
     if (NS_FAILED(rv) || isJS) {
         // We're loading a URL that will execute script from inside asyncOpen.
         // Replace the current document with about:blank now to prevent
         // anything from the current document from leaking into any JavaScript
         // code in the URL.
         nsCOMPtr<nsIPrincipal> prin = do_QueryInterface(owner);
-        rv = CreateAboutBlankContentViewer(prin, nsnull);
+        // Don't cache the presentation if we're going to just reload the
+        // current entry. Caching would lead to trying to save the different
+        // content viewers in the same nsISHEntry object.
+        rv = CreateAboutBlankContentViewer(prin, nsnull, aEntry != mOSHE);
 
         if (NS_FAILED(rv)) {
             // The creation of the intermittent about:blank content
             // viewer failed for some reason (potentially because the
             // user prevented it). Interrupt the history load.
             return NS_OK;
         }
 
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -283,17 +283,18 @@ protected:
     virtual ~nsDocShell();
     virtual void DestroyChildren();
 
     // Content Viewer Management
     NS_IMETHOD EnsureContentViewer();
     // aPrincipal can be passed in if the caller wants.  If null is
     // passed in, the about:blank principal will end up being used.
     nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
-                                           nsIURI* aBaseURI);
+                                           nsIURI* aBaseURI,
+                                           PRBool aTryToSaveOldPresentation = PR_TRUE);
     NS_IMETHOD CreateContentViewer(const char * aContentType, 
         nsIRequest * request, nsIStreamListener ** aContentHandler);
     NS_IMETHOD NewContentViewerObj(const char * aContentType, 
         nsIRequest * request, nsILoadGroup * aLoadGroup, 
         nsIStreamListener ** aContentHandler, nsIContentViewer ** aViewer);
     NS_IMETHOD SetupNewViewer(nsIContentViewer * aNewViewer);
 
     void SetupReferrerFromChannel(nsIChannel * aChannel);