Bug 1428258 - Disallow nsIFile::GetNativePath on Windows. r?froydnj draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 11 Jan 2018 22:38:33 +0900
changeset 757102 3b62cb1ec39fa78191e3e39d2ccdebac6319d6a9
parent 757049 3dad7e389efb0df3fbd4dc313dd05b255ca816c9
push id99658
push userVYV03354@nifty.ne.jp
push dateMon, 19 Feb 2018 22:10:19 +0000
reviewersfroydnj
bugs1428258
milestone60.0a1
Bug 1428258 - Disallow nsIFile::GetNativePath on Windows. r?froydnj MozReview-Commit-ID: JDryRqHcVw2
xpcom/io/nsIFile.idl
xpcom/io/nsLocalFileWin.cpp
--- a/xpcom/io/nsIFile.idl
+++ b/xpcom/io/nsIFile.idl
@@ -255,17 +255,19 @@ interface nsIFile : nsISupports
      *  native filesystem charset.
      *
      */
     readonly attribute AString target;
     [noscript] readonly attribute ACString nativeTarget;
     readonly attribute AString path;
     [notxpcom,nostdcall,must_use] PathString nativePath();
 %{C++
+#ifndef XP_WIN
     nsresult GetNativePath(nsACString& aPath);
+#endif
     /*
      * Returns a human-readable path string.
      */
     nsCString HumanReadablePath();
 %}
 
     boolean exists();
     boolean isWritable();
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -3357,23 +3357,16 @@ nsLocalFile::SetNativeLeafName(const nsA
 
 
 nsString
 nsLocalFile::NativePath()
 {
   return mWorkingPath;
 }
 
-nsresult
-nsIFile::GetNativePath(nsACString& aResult)
-{
-  //NS_WARNING("This API is lossy. Use GetPath !");
-  return NS_CopyUnicodeToNative(NativePath(), aResult);
-}
-
 nsCString
 nsIFile::HumanReadablePath()
 {
   nsString path;
   DebugOnly<nsresult> rv = GetPath(path);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
   return NS_ConvertUTF16toUTF8(path);
 }