nsresult rv; CancelRefreshURITimers(); nsXPIDLCString scheme, CUriSpec;  if (!aUri) return NS_ERROR_NULL_POINTER;  rv = aUri->GetScheme(getter_Copies(scheme)); if (NS_FAILED(rv)) return rv; rv = aUri->GetSpec(getter_Copies(CUriSpec)); if (NS_FAILED(rv)) return rv;  nsAutoString uriSpec(CUriSpec);  nsXPIDLCString spec; rv = aUri->GetSpec(getter_Copies(spec)); if (NS_FAILED(rv)) return rv;  nsString* url = new nsString(uriSpec); if (aModifyHistory) {  PRInt32 i, n = mHistory.Count(); i = mHistoryIndex + 1; while (--n >= i) { nsString* u = (nsString*) mHistory.ElementAt(n); delete u; mHistory.RemoveElementAt(n); }   mHistory.AppendElement(url); mHistoryIndex++; } else {   nsString* u = (nsString*) mHistory.ElementAt(mHistoryIndex); if (nsnull != u) { delete u; } mHistory.ReplaceElementAt(url, mHistoryIndex); } ShowHistory();    if (nsnull != mContainer) { nsAutoString str(spec); rv = mContainer->WillLoadURL(this, str.GetUnicode(), nsLoadURL); if (NS_FAILED(rv)) { return rv; } }   return DoLoadURL(aUri, aCommand, aPostDataStream, aType, aLocalIP, aReferrer);
nsresult rv = PrepareToLoadURI(aUri, aCommand, aPostDataStream, aModifyHistory, aType, aLocalIP, aHistoryState, aReferrer); if (NS_SUCCEEDED(rv)) rv =  DoLoadURL(aUri, aCommand, aPostDataStream, aType, aLocalIP, aReferrer); return rv;
nsWebShell::LoadURI(nsIURI * aUri,                    const char * aCommand,                    nsIInputStream* aPostDataStream,                    PRBool aModifyHistory,                    nsLoadFlags aType,                    const PRUint32 aLocalIP,					          nsISupports * aHistoryState,                    const PRUnichar* aReferrer){  nsresult rv;  CancelRefreshURITimers();  nsXPIDLCString scheme, CUriSpec;  if (!aUri) return NS_ERROR_NULL_POINTER;  rv = aUri->GetScheme(getter_Copies(scheme));  if (NS_FAILED(rv)) return rv;  rv = aUri->GetSpec(getter_Copies(CUriSpec));  if (NS_FAILED(rv)) return rv;  nsAutoString uriSpec(CUriSpec);  nsXPIDLCString spec;  rv = aUri->GetSpec(getter_Copies(spec));  if (NS_FAILED(rv)) return rv;  nsString* url = new nsString(uriSpec);  if (aModifyHistory) {    // Discard part of history that is no longer reachable    PRInt32 i, n = mHistory.Count();    i = mHistoryIndex + 1;    while (--n >= i) {      nsString* u = (nsString*) mHistory.ElementAt(n);      delete u;      mHistory.RemoveElementAt(n);    }    // Tack on new url    mHistory.AppendElement(url);    mHistoryIndex++;  }  else {	      // Replace the current history index with this URL    nsString* u = (nsString*) mHistory.ElementAt(mHistoryIndex);    if (nsnull != u) {      delete u;    }    mHistory.ReplaceElementAt(url, mHistoryIndex);  }  ShowHistory();  // Give web-shell-container right of refusal  if (nsnull != mContainer) {    nsAutoString str(spec);    rv = mContainer->WillLoadURL(this, str.GetUnicode(), nsLoadURL);    if (NS_FAILED(rv)) {      return rv;    }  }  return DoLoadURL(aUri, aCommand, aPostDataStream, aType, aLocalIP, aReferrer);}