Bug 461858 - windows mobile minor cleanup of xulrunner r=bsmedberg
authorBrad Lassey <blassey@mozilla.com>
Wed, 03 Dec 2008 08:41:12 -0500
changeset 22243 eae733a929f547ba0e96056898813412649328ba
parent 22242 c047d4fb2c00ab8219573bcb282a9511b15544b6
child 22244 652cba7f3f1da4c44db65ce82bd4daa621f2dc43
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs461858
milestone1.9.2a1pre
Bug 461858 - windows mobile minor cleanup of xulrunner r=bsmedberg
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsWindowsRestart.cpp
toolkit/xre/nsXREDirProvider.cpp
xulrunner/stub/nsXULStub.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -144,18 +144,20 @@
 #ifdef XP_BEOS
 // execv() behaves bit differently in R5 and Zeta, looks unreliable in such situation
 //#include <unistd.h>
 #include <AppKit.h>
 #include <AppFileInfo.h>
 #endif //XP_BEOS
 
 #ifdef XP_WIN
+#ifndef WINCE
 #include <process.h>
 #include <shlobj.h>
+#endif
 #include "nsThreadUtils.h"
 #endif
 
 #ifdef XP_MACOSX
 #include "nsILocalFileMac.h"
 #include "nsCommandLineServiceMac.h"
 #endif
 
@@ -2531,18 +2533,20 @@ XRE_main(int argc, char* argv[], const n
     gtkModulesStr.ReplaceSubstring("atk-bridge", "");
     char* expr = PR_smprintf("GTK_MODULES=%s", gtkModulesStr.get());
     if (expr)
       PR_SetEnv(expr);
     // We intentionally leak |expr| here since it is required by PR_SetEnv.
   }
 #endif
 
+#ifndef WINCE
   // Unbuffer stdout, needed for tinderbox tests.
   setbuf(stdout, 0);
+#endif
 
 #if defined(FREEBSD)
   // Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
   // trap behavior that trips up on floating-point tests performed by
   // the JS engine.  See bugzilla bug 9967 details.
   fpsetmask(0);
 #endif
 
--- a/toolkit/xre/nsWindowsRestart.cpp
+++ b/toolkit/xre/nsWindowsRestart.cpp
@@ -337,30 +337,31 @@ WinLaunchChild(const PRUnichar *exePath,
   return ok;
 }
 
 BOOL
 WinLaunchChild(const PRUnichar *exePath, int argc, PRUnichar **argv, int needElevation)
 {
   PRUnichar *cl;
   BOOL ok;
+#ifndef WINCE
   if (needElevation > 0) {
     cl = MakeCommandLine(argc - 1, argv + 1);
     if (!cl)
       return FALSE;
     ok = ShellExecuteW(NULL, // no special UI window
                        NULL, // use default verb
                        exePath,
                        cl,
                        NULL, // use my current directory
                        SW_SHOWDEFAULT) > (HINSTANCE)32;
     free(cl);
     return ok;
   }
-
+#endif
   cl = MakeCommandLine(argc, argv);
   if (!cl)
     return FALSE;
 
   if (needElevation < 0) {
     // try to launch as a normal user first
     ok = LaunchAsNormalUser(exePath, cl);
     // if it fails, fallback to normal launching
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -911,24 +911,27 @@ nsXREDirProvider::GetUpdateRootDir(nsIFi
   // AppDir may be a short path. Convert to long path to make sure
   // the consistency of the update folder location
   nsString longPath;
   PRUnichar* buf;
 
   PRUint32 bufLength = longPath.GetMutableData(&buf, MAXPATHLEN);
   NS_ENSURE_TRUE(bufLength >= MAXPATHLEN, NS_ERROR_OUT_OF_MEMORY);
 
+#ifdef WINCE
+  longPath.Assign(appPath);
+#else
   DWORD len = GetLongPathNameW(appPath.get(), buf, bufLength);
 
   // Failing GetLongPathName() is not fatal.
   if (len <= 0 || len >= bufLength)
     longPath.Assign(appPath);
   else
     longPath.SetLength(len);
-
+#endif
   // Use <UserLocalDataDir>\updates\<relative path to app dir from
   // Program Files> if app dir is under Program Files to avoid the
   // folder virtualization mess on Windows Vista
   nsAutoString programFiles;
   rv = GetShellFolderPath(CSIDL_PROGRAM_FILES, programFiles);
   NS_ENSURE_SUCCESS(rv, rv);
 
   programFiles.AppendLiteral("\\");
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -255,18 +255,23 @@ main(int argc, char **argv)
   *(++lastSlash) = '\0';
 
   // On Linux/Win, look for XULRunner in appdir/xulrunner
 
   snprintf(greDir, sizeof(greDir),
            "%sxulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL,
            iniPath);
 
+#ifdef WINCE
+  DWORD fileAttrs = GetFileAttributesW(NS_ConvertUTF8toUTF16(greDir).get());
+  greFound = fileAttrs != INVALID_FILE_ATTRIBUTES && 
+             fileAttrs | FILE_ATTRIBUTE_DIRECTORY;
+#else
   greFound = (access(greDir, R_OK) == 0);
-
+#endif
   strncpy(lastSlash, "application.ini", sizeof(iniPath) - (lastSlash - iniPath));
 
 #endif
 
   nsINIParser parser;
   rv = parser.Init(iniPath);
   if (NS_FAILED(rv)) {
     fprintf(stderr, "Could not read application.ini\n");