Bug 413171 : "could not initialize the application's security component" with non-native characters in the profile path diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -119,6 +119,10 @@ #include "base64.h" #include "secerr.h" #include "sslerr.h" + +#ifdef XP_WIN +#include "nsILocalFileWin.h" +#endif extern "C" { #include "pkcs12.h" @@ -1517,7 +1521,15 @@ nsNSSComponent::InitializeNSS(PRBool sho return rv; #endif + #if defined(XP_WIN) + // Native path will drop Unicode characters that cannot be mapped to system's + // codepage, using short (canonical) path as workaround. + nsCOMPtr profilePathWin(do_QueryInterface(profilePath, &rv)); + if (profilePathWin) + rv = profilePathWin->GetNativeCanonicalPath(profileStr); + #else rv = profilePath->GetNativePath(profileStr); + #endif if (NS_FAILED(rv)) return rv;