Bug 660687: Add configure switches that can override confvars.sh's choice of an app basename and disable all system extension directories. r=ted

This commit is contained in:
Zack Weinberg 2010-07-23 11:00:16 -07:00
Родитель 1df027a28e
Коммит c5095222cf
3 изменённых файлов: 51 добавлений и 3 удалений

Просмотреть файл

@ -4311,6 +4311,7 @@ dnl ========================================================
MOZ_ARG_HEADER(Application) MOZ_ARG_HEADER(Application)
ENABLE_TESTS=1 ENABLE_TESTS=1
ENABLE_SYSTEM_EXTENSION_DIRS=1
MOZ_BRANDING_DIRECTORY= MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING= MOZ_OFFICIAL_BRANDING=
MOZ_FEEDS=1 MOZ_FEEDS=1
@ -4455,7 +4456,7 @@ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
# Allow someone to change MOZ_APP_NAME in mozconfig # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
MOZ_ARG_WITH_STRING(app-name, MOZ_ARG_WITH_STRING(app-name,
[--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME], [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
WITH_APP_NAME=$withval, WITH_APP_NAME=$withval,
@ -4465,6 +4466,15 @@ if test -n "$WITH_APP_NAME" ; then
MOZ_APP_NAME="$WITH_APP_NAME" MOZ_APP_NAME="$WITH_APP_NAME"
fi fi
MOZ_ARG_WITH_STRING(app-basename,
[--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
WITH_APP_BASENAME=$withval,
)
if test -n "$WITH_APP_BASENAME" ; then
MOZ_APP_BASENAME="$WITH_APP_BASENAME"
fi
# Now is a good time to test for logic errors, define mismatches, etc. # Now is a good time to test for logic errors, define mismatches, etc.
case "$MOZ_BUILD_APP" in case "$MOZ_BUILD_APP" in
xulrunner) xulrunner)
@ -5602,6 +5612,23 @@ MOZ_ARG_DISABLE_BOOL(pref-extensions,
MOZ_PREF_EXTENSIONS=, MOZ_PREF_EXTENSIONS=,
MOZ_PREF_EXTENSIONS=1 ) MOZ_PREF_EXTENSIONS=1 )
dnl ========================================================
dnl Searching of system directories for extensions.
dnl Note: this switch is meant to be used for test builds
dnl whose behavior should not depend on what happens to be
dnl installed on the local machine.
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
[ --disable-system-extension-dirs
Disable searching system- and account-global
directories for extensions of any kind; use
only profile-specific extension directories],
ENABLE_SYSTEM_EXTENSION_DIRS=,
ENABLE_SYSTEM_EXTENSION_DIRS=1 )
if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
fi
dnl ======================================================== dnl ========================================================
dnl = Universalchardet dnl = Universalchardet
dnl ======================================================== dnl ========================================================

Просмотреть файл

@ -318,18 +318,30 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
} }
#if defined(XP_UNIX) || defined(XP_MACOSX) #if defined(XP_UNIX) || defined(XP_MACOSX)
else if (!strcmp(aProperty, XRE_SYS_LOCAL_EXTENSION_PARENT_DIR)) { else if (!strcmp(aProperty, XRE_SYS_LOCAL_EXTENSION_PARENT_DIR)) {
#ifdef ENABLE_SYSTEM_EXTENSION_DIRS
return GetSystemExtensionsDirectory((nsILocalFile**)(nsIFile**) aFile); return GetSystemExtensionsDirectory((nsILocalFile**)(nsIFile**) aFile);
#else
return NS_ERROR_FAILURE;
#endif
} }
#endif #endif
#if defined(XP_UNIX) && !defined(XP_MACOSX) #if defined(XP_UNIX) && !defined(XP_MACOSX)
else if (!strcmp(aProperty, XRE_SYS_SHARE_EXTENSION_PARENT_DIR)) { else if (!strcmp(aProperty, XRE_SYS_SHARE_EXTENSION_PARENT_DIR)) {
#ifdef ENABLE_SYSTEM_EXTENSION_DIRS
static const char *const sysLExtDir = "/usr/share/mozilla/extensions"; static const char *const sysLExtDir = "/usr/share/mozilla/extensions";
return NS_NewNativeLocalFile(nsDependentCString(sysLExtDir), return NS_NewNativeLocalFile(nsDependentCString(sysLExtDir),
false, (nsILocalFile**)(nsIFile**) aFile); false, (nsILocalFile**)(nsIFile**) aFile);
#else
return NS_ERROR_FAILURE;
#endif
} }
#endif #endif
else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DIR)) { else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DIR)) {
#ifdef ENABLE_SYSTEM_EXTENSION_DIRS
return GetSysUserExtensionsDirectory((nsILocalFile**)(nsIFile**) aFile); return GetSysUserExtensionsDirectory((nsILocalFile**)(nsIFile**) aFile);
#else
return NS_ERROR_FAILURE;
#endif
} }
else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) { else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) {
rv = GetAppDir()->Clone(getter_AddRefs(file)); rv = GetAppDir()->Clone(getter_AddRefs(file));

Просмотреть файл

@ -224,17 +224,23 @@ nsAppFileLocationProvider::GetFile(const char *prop, bool *persistent, nsIFile *
"Use nsAppFileLocationProvider::GetFiles(...)."); "Use nsAppFileLocationProvider::GetFiles(...).");
const char *pathVar = PR_GetEnv("MOZ_PLUGIN_PATH"); const char *pathVar = PR_GetEnv("MOZ_PLUGIN_PATH");
if (pathVar && *pathVar) if (pathVar && *pathVar)
rv = NS_NewNativeLocalFile(nsDependentCString(pathVar), true, getter_AddRefs(localFile)); rv = NS_NewNativeLocalFile(nsDependentCString(pathVar), true,
getter_AddRefs(localFile));
} }
else if (nsCRT::strcmp(prop, NS_USER_PLUGINS_DIR) == 0) else if (nsCRT::strcmp(prop, NS_USER_PLUGINS_DIR) == 0)
{ {
#ifdef ENABLE_SYSTEM_EXTENSION_DIRS
rv = GetProductDirectory(getter_AddRefs(localFile)); rv = GetProductDirectory(getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME); rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
#else
rv = NS_ERROR_FAILURE;
#endif
} }
#ifdef XP_UNIX #ifdef XP_UNIX
else if (nsCRT::strcmp(prop, NS_SYSTEM_PLUGINS_DIR) == 0) { else if (nsCRT::strcmp(prop, NS_SYSTEM_PLUGINS_DIR) == 0) {
static const char *const sysLPlgDir = #ifdef ENABLE_SYSTEM_EXTENSION_DIRS
static const char *const sysLPlgDir =
#if defined(HAVE_USR_LIB64_DIR) && defined(__LP64__) #if defined(HAVE_USR_LIB64_DIR) && defined(__LP64__)
"/usr/lib64/mozilla/plugins"; "/usr/lib64/mozilla/plugins";
#else #else
@ -242,6 +248,9 @@ nsAppFileLocationProvider::GetFile(const char *prop, bool *persistent, nsIFile *
#endif #endif
rv = NS_NewNativeLocalFile(nsDependentCString(sysLPlgDir), rv = NS_NewNativeLocalFile(nsDependentCString(sysLPlgDir),
false, getter_AddRefs(localFile)); false, getter_AddRefs(localFile));
#else
rv = NS_ERROR_FAILURE;
#endif
} }
#endif #endif
#endif #endif