Bug 665964: If the nsISHistoryListener vetoes navigation, reset mRequestedIndex to make it clear that the navigation has been cancelled. r=bz
authorKyle Huey <khuey@kylehuey.com>
Fri, 08 Jul 2011 14:30:36 -0700
changeset 72668 ffeea656548be04fb05f63938f959452d995fecd
parent 72667 7fae5c9da3cf0bfbb07f70e620bb3a13a2240581
child 72669 e0a0e1800c6a164b9316f85f51ea7984ea0d3247
push id224
push userkhuey@mozilla.com
push dateTue, 12 Jul 2011 21:38:44 +0000
treeherdermozilla-aurora@e0a0e1800c6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs665964
milestone7.0a2
Bug 665964: If the nsISHistoryListener vetoes navigation, reset mRequestedIndex to make it clear that the navigation has been cancelled. r=bz
docshell/shistory/src/nsSHistory.cpp
--- a/docshell/shistory/src/nsSHistory.cpp
+++ b/docshell/shistory/src/nsSHistory.cpp
@@ -1491,16 +1491,17 @@ nsSHistory::LoadEntry(PRInt32 aIndex, lo
         listener->OnHistoryGotoIndex(aIndex, nextURI, &canNavigate);
       }
     }
   }
 
   if (!canNavigate) {
     // If the listener asked us not to proceed with 
     // the operation, simply return.    
+    mRequestedIndex = -1;
     return NS_OK;  // XXX Maybe I can return some other error code?
   }
 
   nsCOMPtr<nsIURI> nexturi;
   PRInt32 pCount=0, nCount=0;
   nsCOMPtr<nsISHContainer> prevAsContainer(do_QueryInterface(prevEntry));
   nsCOMPtr<nsISHContainer> nextAsContainer(do_QueryInterface(nextEntry));
   if (prevAsContainer && nextAsContainer) {