const char *cmd = mViewSource ? "view-source" : "view" ; mViewSource = PR_FALSE; return LoadURL(aURLSpec, cmd, aPostDataStream, aModifyHistory,aType, aLocalIP, aHistoryState, aReferrer);
convertFileToURL(urlStr, urlSpec); rv = NS_NewURI(getter_AddRefs(uri), urlSpec, nsnull); if (NS_FAILED(rv)) {         if ( #ifdef XP_PC     (urlStr.FindChar('.') == -1) || #endif (urlStr.First() == '?') || (urlStr.FindChar(' ') > -1) ) { nsAutoString keywordSpec("keyword:"); keywordSpec.Append(aURLSpec); rv = NS_NewURI(getter_AddRefs(uri), keywordSpec, nsnull); }  if (NS_FAILED(rv)) { PRInt32 colon, fSlash = urlSpec.FindChar('/'); PRUnichar port;  if ( ((colon=urlSpec.FindChar(':')) == -1) || ( (fSlash > -1) && (colon > fSlash) ) || ( (colon < urlSpec.Length()-1) && ((port=urlSpec.CharAt(colon+1)) <= '9') && (port > '0') )) {  PRInt32 hostPos = urlSpec.FindCharInSet("./:"); if (hostPos == -1) { hostPos = urlSpec.Length(); }   nsAutoString hostSpec; urlSpec.Left(hostSpec, hostPos);   if (hostSpec.EqualsIgnoreCase("ftp")) { urlSpec.Insert("ftp: } else { urlSpec.Insert("http: } } rv = NS_NewURI(getter_AddRefs(uri), urlSpec, nsnull);  nsAutoString  url(aURLSpec); if (((url.Find("mailto:", PR_TRUE))<0) && (NS_FAILED(rv))) {  return rv; } } }  }  if (!uri) return rv;   PRBool  isMail= PR_FALSE; rv = uri->GetSpec(getter_Copies(spec)); if (NS_FAILED(rv)) return rv;  nsAutoString urlAStr(spec); if ((urlAStr.Find("mailto", PR_TRUE)) >= 0) { isMail = PR_TRUE; }   nsCOMPtr<nsIWebShell>  root; nsCOMPtr<nsISessionHistory> shist; PRBool  isLoadingHistory=PR_FALSE; rv = GetRootWebShell(*getter_AddRefs(root));  if (NS_SUCCEEDED(rv) && root) { root->GetSessionHistory(*getter_AddRefs(shist)); } if (shist) shist->GetLoadingFlag(&isLoadingHistory);   if (root && isMail) {  nsCOMPtr<nsIUrlDispatcher>  urlDispatcher; rv = root->GetUrlDispatcher(*getter_AddRefs(urlDispatcher)); if (NS_SUCCEEDED(rv) && urlDispatcher) { nsAutoString LinkCommand("linkclick"); urlDispatcher->HandleUrl(LinkCommand.GetUnicode(), urlAStr.GetUnicode(), aPostDataStream); return NS_OK; } }   if (shist) { PRInt32  indix; shist->GetCurrentIndex(&indix); if (indix >= 0 && (aModifyHistory)) { nsCOMPtr<nsISupports>  historyState; rv = GetHistoryState(getter_AddRefs(historyState)); if (NS_SUCCEEDED(rv) && historyState) shist->SetHistoryObjectForIndex(indix, historyState); } }  SetHistoryState(aHistoryState);   if (aModifyHistory && shist)  { PRInt32  ret; ret = shist->Add(spec, this); }  nsCOMPtr<nsIWebShell> parent; nsresult res = GetParent(*getter_AddRefs(parent)); nsAutoString urlstr;  if ((isLoadingHistory)) {  urlstr = mURL; } else{  urlstr=spec; }  nsCOMPtr<nsIURI>   newURI; res = NS_NewURI(getter_AddRefs(newURI), urlstr, nsnull);  if (NS_SUCCEEDED(res)) {  return LoadURI(newURI, aCommand, aPostDataStream, aModifyHistory, aType, aLocalIP, aHistoryState, aReferrer); } return rv;
nsWebShell::LoadURL(const PRUnichar *aURLSpec,                    nsIInputStream* aPostDataStream,                    PRBool aModifyHistory,                    nsLoadFlags aType,                    const PRUint32 aLocalIP,                    nsISupports * aHistoryState,                    const PRUnichar* aReferrer){  // Initialize margnwidth, marginheight. Put scrolling back the way it was  // before the last document was loaded.	InitFrameData(PR_FALSE);  const char *cmd = mViewSource ? "view-source" : "view" ;  mViewSource = PR_FALSE; // reset it  return LoadURL(aURLSpec, cmd, aPostDataStream,                 aModifyHistory,aType, aLocalIP, aHistoryState,                 aReferrer);}