Bug 1428538 - Use UTF-8 file paths for NSS database. r=keeler
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 28 Dec 2017 20:56:33 +0900
changeset 453301 95e2f1556c172a88792415f3a5637f9cbcac2358
parent 453300 35dcf8417877e6cfe7dda378a1c2f3682c3c3af1
child 453302 dd2b9748cbb66622643d5a15a2efe6edd8707ff1
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1428538
milestone59.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 1428538 - Use UTF-8 file paths for NSS database. r=keeler
security/manager/ssl/nsNSSComponent.cpp
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -1752,25 +1752,27 @@ GetNSSProfilePath(nsAutoCString& aProfil
                                        getter_AddRefs(profileFile));
   if (NS_FAILED(rv)) {
     NS_WARNING("NSS will be initialized without a profile directory. "
                "Some things may not work as expected.");
     return NS_OK;
   }
 
 #if defined(XP_WIN)
-  // Native path will drop Unicode characters that cannot be mapped to system's
-  // codepage, using short (canonical) path as workaround.
+  // SQLite always takes UTF-8 file paths regardless of the current system
+  // code page.
   nsCOMPtr<nsILocalFileWin> profileFileWin(do_QueryInterface(profileFile));
   if (!profileFileWin) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Error,
            ("Could not get nsILocalFileWin for profile directory.\n"));
     return NS_ERROR_FAILURE;
   }
-  rv = profileFileWin->GetNativeCanonicalPath(aProfilePath);
+  nsAutoString u16ProfilePath;
+  rv = profileFileWin->GetCanonicalPath(u16ProfilePath);
+  CopyUTF16toUTF8(u16ProfilePath, aProfilePath);
 #else
   rv = profileFile->GetNativePath(aProfilePath);
 #endif
   if (NS_FAILED(rv)) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Error,
            ("Could not get native path for profile directory.\n"));
     return rv;
   }