NS_ENSURE_SUCCESS(LoadHistoryEntry(shEntry, LOAD_HISTORY), NS_ERROR_FAILURE);
nsWebShell::GoTo(PRInt32 aHistoryIndex){  nsresult rv = NS_ERROR_ILLEGAL_VALUE;  if ((aHistoryIndex >= 0) &&      (aHistoryIndex < mHistory.Count())) {    nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);    // Give web-shell-container right of refusal    nsAutoString urlSpec(*s);    if (nsnull != mContainer) {      rv = mContainer->WillLoadURL(this, urlSpec.GetUnicode(), nsLoadHistory);      if (NS_FAILED(rv)) {        return rv;      }    }#ifdef DEBUG    printf("Goto %d\n", aHistoryIndex);#endif    mHistoryIndex = aHistoryIndex;    ShowHistory();    // convert the uri spec into a url and then pass it to DoLoadURL    nsCOMPtr<nsIURI> uri;    rv = NS_NewURI(getter_AddRefs(uri), urlSpec, nsnull);    if (NS_FAILED(rv)) return rv;    rv = DoLoadURL(uri,       // URL string                   "view",        // Command                   nsnull,        // Post Data				   nsISessionHistory::LOAD_HISTORY,  // the reload type                   0,            // load attributes                   nsnull);      // referrer  }  return rv;}