Bug 775009 - Part 2: Fix. r=bz a=akeybl
authorJustin Lebar <justin.lebar@gmail.com>
Sat, 25 Aug 2012 18:23:53 -0400
changeset 81992 149fc18b680b7f793d79b20173324e68a0155eaf
parent 81991 cf5c29f970194c74169c0c0ba7c0fbaf0674aa74
child 81993 5c74f60500ecd7480185cabc63ea9b3c8cbc3706
push id268
push userjlebar@mozilla.com
push dateFri, 14 Sep 2012 17:03:14 +0000
reviewersbz, akeybl
bugs775009
milestone10.0.8esrpre
Bug 775009 - Part 2: Fix. r=bz a=akeybl
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8340,16 +8340,27 @@ nsDocShell::InternalLoad(nsIURI * aURI,
 
         // Fire a hashchange event if we're doing a short-circuited load and the
         // URIs differ only in their hashes.
         bool doHashchange = doShortCircuitedLoad &&
                               sameExceptHashes &&
                               !curHash.Equals(newHash);
 
         if (doShortCircuitedLoad) {
+            // Cancel any outstanding loads if this is a history load.
+            //
+            // We can't cancel the oustanding load unconditionally, because if a page does
+            //   - load a.html
+            //   - start loading b.html
+            //   - load a.html#h
+            // we break the web if we cancel the load of b.html.
+            if (aSHEntry) {
+                Stop(nsIWebNavigation::STOP_NETWORK);
+            }
+
             // Save the current URI; we need it if we fire a hashchange later.
             nsCOMPtr<nsIURI> oldURI = mCurrentURI;
 
             // Save the position of the scrollers.
             nscoord cx = 0, cy = 0;
             GetCurScrollPos(ScrollOrientation_X, &cx);
             GetCurScrollPos(ScrollOrientation_Y, &cy);