Bug 1331820 - Fix misuse of NS_NewNativeLocalFile in netwerk/. r=jduell
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 21 Jan 2017 15:37:27 +0900
changeset 330866 03b2b5af651b62fa9fbc4c0d6e09cc5d8b75fe67
parent 330865 91ddc783c0ca5d98f45d375074a1dc0d0e4cffdf
child 330867 c4a0ff9a5a54fd128303166a1865357ed4c8a254
push id86107
push userkwierso@gmail.com
push dateWed, 25 Jan 2017 00:11:05 +0000
treeherdermozilla-inbound@c430436bb9de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs1331820
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1331820 - Fix misuse of NS_NewNativeLocalFile in netwerk/. r=jduell MozReview-Commit-ID: 6OKqRLhGJpm
netwerk/protocol/file/nsFileChannel.cpp
--- a/netwerk/protocol/file/nsFileChannel.cpp
+++ b/netwerk/protocol/file/nsFileChannel.cpp
@@ -252,27 +252,37 @@ nsFileUploadContentStream::OnCopyComplet
 
 nsFileChannel::nsFileChannel(nsIURI *uri) 
 {
   // If we have a link file, we should resolve its target right away.
   // This is to protect against a same origin attack where the same link file
   // 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);
   if (fileURL && 
       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.
     nsCOMPtr<nsIURL> origURL = do_QueryInterface(uri);
     nsCOMPtr<nsIURL> targetURL = do_QueryInterface(targetURI);
     nsAutoCString queryString;
     if (origURL && targetURL && NS_SUCCEEDED(origURL->GetQuery(queryString))) {
       targetURL->SetQuery(queryString);