Bug 1331820 - Fix misuse of NS_NewNativeLocalFile in netwerk/. r=jduell

MozReview-Commit-ID: 6OKqRLhGJpm

--HG--
extra : rebase_source : 39bf499ef8e24c6bc7818e087564d19b5158212d
This commit is contained in:
Masatoshi Kimura 2017-01-21 15:37:27 +09:00
parent 2f33a39f13
commit c82e3f0369

View File

@ -257,7 +257,11 @@ nsFileChannel::nsFileChannel(nsIURI *uri)
// can point to different resources right after the first resource is loaded.
nsCOMPtr<nsIFile> file;
nsCOMPtr <nsIURI> targetURI;
#ifdef XP_WIN
nsAutoString fileTarget;
#else
nsAutoCString fileTarget;
#endif
nsCOMPtr<nsIFile> resolvedFile;
bool symLink;
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(uri);
@ -265,9 +269,15 @@ nsFileChannel::nsFileChannel(nsIURI *uri)
NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
NS_SUCCEEDED(file->IsSymlink(&symLink)) &&
symLink &&
#ifdef XP_WIN
NS_SUCCEEDED(file->GetTarget(fileTarget)) &&
NS_SUCCEEDED(NS_NewLocalFile(fileTarget, PR_TRUE,
getter_AddRefs(resolvedFile))) &&
#else
NS_SUCCEEDED(file->GetNativeTarget(fileTarget)) &&
NS_SUCCEEDED(NS_NewNativeLocalFile(fileTarget, PR_TRUE,
getter_AddRefs(resolvedFile))) &&
#endif
NS_SUCCEEDED(NS_NewFileURI(getter_AddRefs(targetURI),
resolvedFile, nullptr))) {
// Make an effort to match up the query strings.