Bug 1428258 - Disallow nsIFile::GetNativePath on Windows. r?froydnj
MozReview-Commit-ID: JDryRqHcVw2
--- 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);
}