convertFileToURL(nsString(aURLSpec), urlSpec);
nsString urlStr = aURLSpec; urlStr.Trim(" ", PR_TRUE, PR_TRUE); convertFileToURL(urlStr, urlSpec);
nsWebShell::LoadURL(const PRUnichar *aURLSpec,                    const char* aCommand,                    nsIPostData* aPostData,                    PRBool aModifyHistory,#ifdef NECKO                    nsLoadFlags aType,#else                    nsURLReloadType aType,#endif                    const PRUint32 aLocalIP){  nsresult rv;  nsAutoString urlSpec;  convertFileToURL(nsString(aURLSpec), urlSpec);//#ifdef NECKO//  nsCOMPtr<nsIURI> url;//  rv = NS_NewURI(getter_AddRefs(url), urlSpec);//  if (NS_FAILED(rv)) return rv;//#else  PRInt32 colon, fSlash;  PRUnichar port;  fSlash=urlSpec.Find('/');  // if no scheme (protocol) is found, assume http.  if ( ((colon=urlSpec.Find(':')) == -1) // no colon at all       || ( (fSlash > -1) && (colon > fSlash) ) // the only colon comes after the first slash       || ( (colon < urlSpec.Length()-1) // the first char after the first colon is a digit (i.e. a port)            && ((port=urlSpec.CharAt(colon+1)) <= '9')            && (port > '0') )) {    // find host name    int hostPos = urlSpec.FindCharInSet("./:");    if (hostPos == -1) {      hostPos = urlSpec.Length();    }    // extract host name    nsAutoString hostSpec;    urlSpec.Left(hostSpec, hostPos);    // insert url spec corresponding to host name    if (hostSpec.EqualsIgnoreCase("www")) {      nsString ftpDef("http://");      urlSpec.Insert(ftpDef, 0, 7);    } else if (hostSpec.EqualsIgnoreCase("ftp")) {      nsString ftpDef("ftp://");      urlSpec.Insert(ftpDef, 0, 6);    } else {      nsString httpDef("http://");      urlSpec.Insert(httpDef, 0, 7);    }  }  //Take care of mailto: url  nsIWebShell * root= nsnull;  PRInt32 index = urlSpec.Find("mailto:");  PRBool  isMail= PR_FALSE, isBrowser = PR_FALSE;  if (index == 0) {     isMail = PR_TRUE;  }    nsresult res = GetRootWebShell(root);  if (NS_SUCCEEDED(res) && root) {     nsIDocumentLoaderObserver * dlObserver = nsnull;      res = root->GetDocLoaderObserver(dlObserver);     if (NS_SUCCEEDED(res) && dlObserver) {        isBrowser = PR_TRUE;     }     NS_IF_RELEASE(dlObserver);   }    /* Ask the URL dispatcher to take car of this URL only if it is a   * mailto: link clicked inside a browser or any link clicked   * inside a *non-browser* window. Note this mechanism s'd go away once    * we have the protocol registry and window manager available   */  if (isMail) {    //Ask the container to load the appropriate component for the URL.    if (root) {       nsCOMPtr<nsIUrlDispatcher>  urlDispatcher = nsnull;       res = GetUrlDispatcher(*getter_AddRefs(urlDispatcher));       if (NS_SUCCEEDED(res) && urlDispatcher) {		  printf("calling HandleUrl\n");          urlDispatcher->HandleUrl(LinkCommand.GetUnicode(), urlSpec.GetUnicode(), aPostData);          return NS_OK;                 }    }  }  NS_IF_RELEASE(root);     mURL = urlSpec.GetUnicode();     /* If this is one of the frames, get it from the top level shell */  if (aModifyHistory) {	  nsCOMPtr<nsIWebShell> webShell;	  nsresult res = GetRootWebShell(*getter_AddRefs(webShell));	  if (NS_SUCCEEDED(res) && webShell)	  {      nsCOMPtr<nsISessionHistory> shist;	    webShell->GetSessionHistory(*getter_AddRefs(shist));	      /* Add yourself to the Session History */		  if (shist) {		    PRInt32  ret=0;		    ret = shist->add(this);		  }		}  }     nsString* url = new nsString(urlSpec);  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();  /* The session History may have changed the URL. So pass on the   * right one for loading    */  // Give web-shell-container right of refusal  if (nsnull != mContainer) {    rv = mContainer->WillLoadURL(this, mURL.GetUnicode(), nsLoadURL);    if (NS_FAILED(rv)) {      return rv;    }  }    const PRUnichar * urlString=nsnull;  GetURL(&urlString);  nsAutoString  newURL(urlString);  return DoLoadURL(newURL, aCommand, aPostData, aType, aLocalIP);//#endif}