Bug 921148 - Remove XRE_UPDATE_ROOT_DIR dir provider along with MOZ_APP_NAME, MOZ_APP_PROFILE, MOZ_APP_VENDOR, and MOZ_APP_BASENAME from xpcshell. r=bbondy
authorRobert Strong <robert.bugzilla@gmail.com>
Sun, 12 Jan 2014 13:47:44 -0800
changeset 179082 3f4af26d05351fe23283e7e8c1552ad2fb39b16f
parent 179081 7c4ed21fed281cda422b6a1176e36d7fb0098f4f
child 179083 9ce81e47d4abefe159135158a486b71f42844647
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs921148
milestone29.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 921148 - Remove XRE_UPDATE_ROOT_DIR dir provider along with MOZ_APP_NAME, MOZ_APP_PROFILE, MOZ_APP_VENDOR, and MOZ_APP_BASENAME from xpcshell. r=bbondy
js/xpconnect/src/XPCShellImpl.cpp
js/xpconnect/src/moz.build
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -33,17 +33,16 @@
 #include "nsIPrincipal.h"
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #ifdef XP_WIN
 #include <windows.h>
-#include <shlobj.h>
 #endif
 
 // all this crap is needed to do the interactive shell stuff
 #include <stdlib.h>
 #include <errno.h>
 #ifdef HAVE_IO_H
 #include <io.h>     /* for isatty() */
 #endif
@@ -1662,54 +1661,16 @@ XPCShellDirProvider::GetFile(const char 
         nsCOMPtr<nsIFile> file;
         *persistent = true;
         if (NS_FAILED(mGREDir->Clone(getter_AddRefs(file))) ||
             NS_FAILED(file->AppendNative(NS_LITERAL_CSTRING("defaults"))) ||
             NS_FAILED(file->AppendNative(NS_LITERAL_CSTRING("pref"))))
             return NS_ERROR_FAILURE;
         NS_ADDREF(*result = file);
         return NS_OK;
-    } else if (mAppFile && !strcmp(prop, XRE_UPDATE_ROOT_DIR)) {
-        // For xpcshell, we pretend that the update root directory is always
-        // the same as the GRE directory, except for Windows, where we immitate
-        // the algorithm defined in nsXREDirProvider::GetUpdateRootDir.
-        *persistent = true;
-#ifdef XP_WIN
-        char appData[MAX_PATH] = {'\0'};
-        char path[MAX_PATH] = {'\0'};
-        LPITEMIDLIST pItemIDList;
-        if (FAILED(SHGetSpecialFolderLocation(nullptr, CSIDL_LOCAL_APPDATA, &pItemIDList)) ||
-            FAILED(SHGetPathFromIDListA(pItemIDList, appData))) {
-            return NS_ERROR_FAILURE;
-        }
-        nsAutoString pathName;
-        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
-        return mAppFile->GetParent(result);
-#endif
     }
 
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 XPCShellDirProvider::GetFiles(const char *prop, nsISimpleEnumerator* *result)
 {
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -70,28 +70,16 @@ FINAL_LIBRARY = 'gklayout'
 
 GENERATED_FILES = [
     'DictionaryHelpers.h',
     'dom_quickstubs.h',
     'GeneratedEventClasses.h',
     'GeneratedEvents.h',
 ]
 
-# XPCShellImpl.cpp requires hardcoded vendor/profile/appname stuff on Windows
-# This sucks, bug 921148 tracks this.
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    if CONFIG['MOZ_APP_PROFILE']:
-        DEFINES['MOZ_APP_PROFILE'] = '"%s"' % CONFIG['MOZ_APP_PROFILE']
-    else:
-        if CONFIG['MOZ_APP_VENDOR']:
-            DEFINES['MOZ_APP_VENDOR'] = '"%s"' % CONFIG['MOZ_APP_VENDOR']
-        if CONFIG['MOZ_APP_BASENAME']:
-            DEFINES['MOZ_APP_BASENAME'] = '"%s"' % CONFIG['MOZ_APP_BASENAME']
-        DEFINES['MOZ_APP_NAME'] = '"%s"' % CONFIG['MOZ_APP_NAME']
-
 DEFINES['JS_THREADSAFE'] = True
 
 if CONFIG['MOZ_JSDEBUGGER']:
     DEFINES['MOZ_JSDEBUGGER'] = True
 
 LOCAL_INCLUDES += [
     '../loader',
     '../wrappers',