Bug 766269 - Thunderbird Permanent orange: TEST_UNEXPECTED_FAIL | test_0030_general.js. Correctly handle MOZ_APP_BASENAME and MOZ_APP_VENDOR being unset when determining the update location for unit tests on Windows. r=ehsan, test-only
authorMark Banner <bugzilla@standard8.plus.com>
Fri, 29 Jun 2012 07:24:33 +0100
changeset 97902 c7da6936a2c8d2d71e31f114561f88c13e2b36b3
parent 97901 00ed57f00db0a044c9e41915381c2cdf13279e5a
child 97918 22fa45431e1a862727bd1a50039b6cc3e0a63e3f
push id11278
push userbugzilla@standard8.plus.com
push dateFri, 29 Jun 2012 07:46:35 +0000
treeherdermozilla-inbound@c7da6936a2c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test-only
bugs766269
milestone16.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 766269 - Thunderbird Permanent orange: TEST_UNEXPECTED_FAIL | test_0030_general.js. Correctly handle MOZ_APP_BASENAME and MOZ_APP_VENDOR being unset when determining the update location for unit tests on Windows. r=ehsan, test-only
js/xpconnect/shell/Makefile.in
js/xpconnect/shell/xpcshell.cpp
--- a/js/xpconnect/shell/Makefile.in
+++ b/js/xpconnect/shell/Makefile.in
@@ -16,23 +16,27 @@ SDK_BINARY	= $(PROGRAM)
 
 CPPSRCS		= xpcshell.cpp
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CMMSRCS += xpcshellMacUtils.mm
 endif
 
 ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
-ifdef MOZ_APP_PROFILE
-DEFINES += -DMOZ_APP_PROFILE='"$(MOZ_APP_PROFILE)"'
-else
-DEFINES += -DMOZ_APP_VENDOR='"$(MOZ_APP_VENDOR)"'
-DEFINES += -DMOZ_APP_BASENAME='"$(MOZ_APP_BASENAME)"'
-DEFINES += -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
-endif
+  ifdef MOZ_APP_PROFILE
+    DEFINES += -DMOZ_APP_PROFILE='"$(MOZ_APP_PROFILE)"'
+  else
+    ifdef MOZ_APP_VENDOR
+      DEFINES += -DMOZ_APP_VENDOR='"$(MOZ_APP_VENDOR)"'
+    endif
+    ifdef MOZ_APP_BASENAME
+      DEFINES += -DMOZ_APP_BASENAME='"$(MOZ_APP_BASENAME)"'
+    endif
+    DEFINES += -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
+  endif
 endif
 
 LIBS		= \
 		$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
 		$(LIBXUL_LIBS) \
 		$(XPCOM_LIBS) \
 		$(NULL)
 
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -2027,28 +2027,37 @@ XPCShellDirProvider::GetFile(const char 
 #ifdef XP_WIN
         char appData[MAX_PATH] = {'\0'};
         char path[MAX_PATH] = {'\0'};
         LPITEMIDLIST pItemIDList;
         if (FAILED(SHGetSpecialFolderLocation(NULL, CSIDL_LOCAL_APPDATA, &pItemIDList)) ||
             FAILED(SHGetPathFromIDListA(pItemIDList, appData))) {
             return NS_ERROR_FAILURE;
         }
-#ifdef MOZ_APP_PROFILE
-        sprintf(path, "%s\\%s", appData, MOZ_APP_PROFILE);
-#else
-        sprintf(path, "%s\\%s\\%s\\%s", appData, MOZ_APP_VENDOR, MOZ_APP_BASENAME, MOZ_APP_NAME);
-#endif
         nsAutoString pathName;
-        pathName.AssignASCII(path);
+        pathName.AssignASCII(appData);
         nsCOMPtr<nsIFile> localFile;
         nsresult rv = NS_NewLocalFile(pathName, true, getter_AddRefs(localFile));
         if (NS_FAILED(rv)) {
             return rv;
         }
+
+#ifdef MOZ_APP_PROFILE
+        localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_PROFILE));
+#else
+        // MOZ_APP_VENDOR and MOZ_APP_BASENAME are optional.
+#ifdef MOZ_APP_VENDOR
+        localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_VENDOR));
+#endif
+#ifdef MOZ_APP_BASENAME
+        localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_BASENAME));
+#endif
+        // However app name is always appended.
+        localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_NAME));
+#endif
         return localFile->Clone(result);
 #else
         // Fail on non-Windows platforms, the caller is supposed to fal back on
         // the app dir.
         return NS_ERROR_FAILURE;
 #endif
     }