Bug 792625: Fix xpcshell to accept non-ASCII command line arguments on Windows. r=bsmedberg

This commit is contained in:
Kyle Huey 2012-09-30 09:45:05 -07:00
parent 53271e4c0c
commit 03cf2b648a
3 changed files with 28 additions and 0 deletions

View File

@ -16,6 +16,10 @@ SDK_BINARY = $(PROGRAM)
CPPSRCS = xpcshell.cpp
LOCAL_INCLUDES += \
-I$(topsrcdir)/toolkit/xre \
$(NULL)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
CMMSRCS += xpcshellMacUtils.mm
endif
@ -63,6 +67,13 @@ ifeq ($(OS_TEST),ia64)
LIBS += $(JEMALLOC_LIBS)
endif
include $(topsrcdir)/config/config.mk
ifdef _MSC_VER
# Always enter a Windows program through wmain, whether or not we're
# a console application.
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
endif
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk

View File

@ -51,6 +51,13 @@
#ifdef XP_WIN
#include <windows.h>
#include <shlobj.h>
// we want a wmain entry point
#define XRE_DONT_PROTECT_DLL_LOAD
#define XRE_WANT_ENVIRON
#include "nsWindowsWMain.cpp"
#define snprintf _snprintf
#define strcasecmp _stricmp
#endif
#ifdef ANDROID

View File

@ -42,7 +42,11 @@ int main(int argc, char **argv)
#define main NS_internal_main
#ifndef XRE_WANT_ENVIRON
int main(int argc, char **argv);
#else
int main(int argc, char **argv, char **envp);
#endif
static char*
AllocConvertUTF16toUTF8(const WCHAR *arg)
@ -97,7 +101,13 @@ int wmain(int argc, WCHAR **argv)
}
for (int i = 0; i < argc; i++)
deleteUs[i] = argvConverted[i];
#ifndef XRE_WANT_ENVIRON
int result = main(argc, argvConverted);
#else
// Force creation of the multibyte _environ variable.
getenv("PATH");
int result = main(argc, argvConverted, _environ);
#endif
delete[] argvConverted;
FreeAllocStrings(argc, deleteUs);