escPath += "/";
escPath += '/';
net_GetURLSpecFromFile(nsIFile *aFile, nsACString &result){    nsresult rv;    nsCAutoString ePath;    // construct URL spec from native file path    rv = aFile->GetNativePath(ePath);    if (NS_FAILED(rv)) return rv;    // Replace \ with / to convert to an url    for (char *s = ePath.BeginWriting(s); *s; ++s) {        // We need to call isleadbyte because        // Japanese windows can have 0x5C in the sencond byte         // of a Japanese character, for example 0x8F 0x5C is        // one Japanese character        if(isleadbyte(*s) && *(s+1))            ++s;        else if (*s == '\\')            *s = '/';    }    nsCAutoString escPath;    NS_NAMED_LITERAL_CSTRING(prefix, "file:///");    // Escape the path with the directory mask    if (NS_EscapeURL(ePath.get(), ePath.Length(), esc_Directory+esc_Forced, escPath))        escPath.Insert(prefix, 0);    else        escPath.Assign(prefix + ePath);    // esc_Directory does not escape the semicolons, so if a filename     // contains semicolons we need to manually escape them.    escPath.ReplaceSubstring(";", "%3b");    // if this file references a directory, then we need to ensure that the    // URL ends with a slash.  this is important since it affects the rules    // for relative URL resolution when this URL is used as a base URL.    // if the file does not exist, then we make no assumption about its type,    // and simply leave the URL unmodified.    if (escPath.Last() != '/') {        PRBool dir;        rv = aFile->IsDirectory(&dir);        if (NS_SUCCEEDED(rv) && dir)            escPath += "/";    }    result = escPath;    return NS_OK;}