Bug 1551072 - Need xpcshell check in addition to automation. r=Felipe

Differential Revision: https://phabricator.services.mozilla.com/D30812

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Kaply 2019-05-13 01:21:40 +00:00
Родитель 461dac7ec3
Коммит 87700a0023
1 изменённых файлов: 5 добавлений и 2 удалений

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

@ -44,6 +44,9 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
});
});
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
const isXpcshell = env.exists("XPCSHELL_TEST_PROFILE_DIR");
function EnterprisePoliciesManager() {
Services.obs.addObserver(this, "profile-after-change", true);
Services.obs.addObserver(this, "final-ui-startup", true);
@ -336,7 +339,7 @@ function areEnterpriseOnlyPoliciesAllowed() {
}
if (AppConstants.MOZ_UPDATE_CHANNEL != "release" ||
Cu.isInAutomation) {
Cu.isInAutomation || isXpcshell) {
return true;
}
@ -388,7 +391,7 @@ class JSONPoliciesProvider {
// testing purposes), but the Background Update Agent will be unable to
// detect the alternate policy file so the DisableAppUpdate policy may not
// work as expected.
if (alternatePath && (Cu.isInAutomation || AppConstants.NIGHTLY_BUILD) &&
if (alternatePath && (Cu.isInAutomation || AppConstants.NIGHTLY_BUILD || isXpcshell) &&
(!configFile || !configFile.exists())) {
if (alternatePath.startsWith(MAGIC_TEST_ROOT_PREFIX)) {
// Intentionally not using a default value on this pref lookup. If no