nsresult rv = NS_ERROR_ILLEGAL_VALUE; if ((aHistoryIndex >= 0) && (aHistoryIndex < mHistory.Count())) { nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
NS_ENSURE_STATE(mSessionHistory); NS_ENSURE_TRUE(!IsFrame(), NS_ERROR_FAILURE); nsCOMPtr<nsIHistoryEntry> entry;
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, nsLoadHistory);      if (NS_FAILED(rv)) {        return rv;      }    }    // Give URL listener right of refusal    if (nsnull != mURLListener) {        rv = mURLListener->WillLoadURL(this, urlSpec, nsLoadHistory);        if (NS_FAILED(rv)) {            return rv;        }    }    printf("Goto %d\n", aHistoryIndex);    mHistoryIndex = aHistoryIndex;    ShowHistory();    rv = DoLoadURL(urlSpec,       // URL string                   "view",        // Command                   nsnull,        // Post Data                   nsURLReload,   // the reload type                   0);            // load attributes  }  return rv;}