Bug 1189967 - Be slightly more explicit about some conversions to std::wstring. r=nfroyd

This commit is contained in:
Mike Hommey 2015-08-21 16:01:47 +09:00
parent 8d38101828
commit d1ad66a0f8
5 changed files with 22 additions and 4 deletions

View File

@ -67,7 +67,7 @@ AddSandboxAllowedFile(vector<std::wstring>& aAllowedFiles, nsIProperties* aDirSv
if (!aSuffix.IsEmpty()) {
userDirPath.Append(aSuffix);
}
aAllowedFiles.push_back(userDirPath.get());
aAllowedFiles.push_back(std::wstring(userDirPath.get()));
return;
}

View File

@ -119,6 +119,12 @@ class CommandLine {
// Append a loose value to the command line.
void AppendLooseValue(const std::wstring& value);
#if defined(OS_WIN)
void AppendLooseValue(const wchar_t* value) {
AppendLooseValue(std::wstring(value));
}
#endif
// Append the arguments from another command line to this one.
// If |include_program| is true, include |other|'s program as well.
void AppendArguments(const CommandLine& other,

View File

@ -116,6 +116,10 @@ class FilePath {
FilePath(const FilePath& that) : path_(that.path_) {}
explicit FilePath(const StringType& path) : path_(path) {}
#if defined(OS_WIN)
explicit FilePath(const wchar_t* path) : path_(path) {}
#endif
FilePath& operator=(const FilePath& that) {
path_ = that.path_;
return *this;

View File

@ -593,7 +593,7 @@ MaybeAddNsprLogFileAccess(std::vector<std::wstring>& aAllowedFilesReadWrite)
// Chromium sandbox can only allow access to fully qualified file paths. This
// only affects the environment for the child process we're about to create,
// because this will get reset to the original value in PerformAsyncLaunch.
aAllowedFilesReadWrite.push_back(resolvedFilePath.get());
aAllowedFilesReadWrite.push_back(std::wstring(resolvedFilePath.get()));
nsAutoCString resolvedEnvVar("NSPR_LOG_FILE=");
AppendUTF16toUTF8(resolvedFilePath, resolvedEnvVar);
PR_SetEnv(resolvedEnvVar.get());

View File

@ -425,6 +425,12 @@ CreateFileFromPath(const xpstring& path, nsIFile** file)
{
NS_NewLocalFile(nsDependentString(path.c_str()), false, file);
}
static void
CreateFileFromPath(const wchar_t* path, nsIFile** file)
{
CreateFileFromPath(std::wstring(path), file);
}
#else
static void
CreateFileFromPath(const xpstring& path, nsIFile** file)
@ -1227,6 +1233,8 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
ExceptionHandler(
#ifdef XP_LINUX
descriptor,
#elif defined(XP_WIN)
std::wstring(tempPath.get()),
#else
tempPath.get(),
#endif
@ -1341,7 +1349,7 @@ nsresult SetMinidumpPath(const nsAString& aPath)
return NS_ERROR_NOT_INITIALIZED;
#ifdef XP_WIN32
gExceptionHandler->set_dump_path(char16ptr_t(aPath.BeginReading()));
gExceptionHandler->set_dump_path(std::wstring(char16ptr_t(aPath.BeginReading())));
#elif defined(XP_LINUX)
gExceptionHandler->set_minidump_descriptor(
MinidumpDescriptor(NS_ConvertUTF16toUTF8(aPath).BeginReading()));
@ -2733,7 +2741,7 @@ OOPInit()
const std::wstring dumpPath = gExceptionHandler->dump_path();
crashServer = new CrashGenerationServer(
NS_ConvertASCIItoUTF16(childCrashNotifyPipe).get(),
std::wstring(NS_ConvertASCIItoUTF16(childCrashNotifyPipe).get()),
nullptr, // default security attributes
nullptr, nullptr, // we don't care about process connect here
OnChildProcessDumpRequested, nullptr,