Backed out changeset 6dde6dcea46a (bug 1583466) for bustages on nsXREDirProvider.cpp . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2019-10-24 15:10:12 +03:00
parent cbd1c370a8
commit d7b145656a
3 changed files with 2 additions and 26 deletions

View file

@ -23,9 +23,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
// ${InstallDir}/distribution folder.
const POLICIES_FILENAME = "policies.json";
// When true browser policy is loaded per-user from
// /run/user/$UID/appname
const PREF_PER_USER_DIR = "toolkit.policies.perUserDir";
// For easy testing, modify the helpers/sample.json file,
// and set PREF_ALTERNATE_PATH in firefox.js as:
// /your/repo/browser/components/enterprisepolicies/helpers/sample.json
@ -458,12 +455,7 @@ class JSONPoliciesProvider {
_getConfigurationFile() {
let configFile = null;
try {
let perUserPath = Services.prefs.getBoolPref(PREF_PER_USER_DIR, false);
if (perUserPath) {
configFile = Services.dirsvc.get("XREUserRunTimeDir", Ci.nsIFile);
} else {
configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile);
}
configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile);
configFile.append(POLICIES_FILENAME);
} catch (ex) {
// Getting the correct directory will fail in xpcshell tests. This should

View file

@ -45,7 +45,6 @@
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "nsPrintfCString.h"
#include <stdlib.h>
@ -104,7 +103,7 @@ nsCOMPtr<nsIFile> gDataDirProfile = nullptr;
// These are required to allow nsXREDirProvider to be usable in xpcshell tests.
// where gAppData is null.
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_UNIX)
#if defined(XP_MACOSX) || defined(XP_WIN)
static const char* GetAppName() {
if (gAppData) {
return gAppData->name;
@ -462,14 +461,6 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
#endif
} else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DEV_DIR)) {
return GetSysUserExtensionsDevDirectory(aFile);
} else if (!strcmp(aProperty, XRE_USER_RUNTIME_DIR)) {
#ifdef MOZ_WIDGET_GTK
nsPrintfCString path("/run/user/%d/%s/", getuid(), GetAppName());
ToLowerCase(path);
return NS_NewNativeLocalFile(path, false, aFile);
#else
return NS_ERROR_FAILURE;
#endif
} else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) {
bool persistent = false;
rv = GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(file));

View file

@ -141,13 +141,6 @@
*/
#define XRE_ADDON_APP_DIR "XREAddonAppDir"
/**
* A directory service key which specifies the distribution specific files for
* the application unique for each user.
* It's located at /run/user/$UID/<product name>/
*/
#define XRE_USER_RUNTIME_DIR "XREUserRunTimeDir"
/**
* A directory service key which provides the update directory. Callers should
* fall back to appDir.