nsCOMPtr<nsIIOService> serv; if (ioService == nsnull) { nsresult rv; serv = do_GetIOService(&rv); if (NS_FAILED(rv)) return rv; ioService = serv.get(); } return ioService->GetURLSpecFromFile(aFile, aUrl);
nsCOMPtr<nsIFileProtocolHandler> fileHandler; nsresult rv = NS_GetFileProtocolHandler(getter_AddRefs(fileHandler), ioService); if (NS_FAILED(rv)) return rv;  return fileHandler->GetURLSpecFromFile(aFile, aUrl);
NS_GetURLSpecFromFile(nsIFile* aFile, nsACString &aUrl,                      nsIIOService *ioService=nsnull){    nsCOMPtr<nsIIOService> serv;    if (ioService == nsnull) {        nsresult rv;        serv = do_GetIOService(&rv);        if (NS_FAILED(rv)) return rv;        ioService = serv.get();    }    return ioService->GetURLSpecFromFile(aFile, aUrl);}