зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556131 - P3. Enable check on automation. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D34475 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
641efc6972
Коммит
35eb8f536a
|
@ -1,5 +1,11 @@
|
|||
add_task(async function() {
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
// We must temporarily disable `Once` StaticPrefs check for the duration of
|
||||
// this test (see bug 1556131). We must do so in a separate operation as
|
||||
// pushPrefEnv doesn't set the preferences in the order one could expect.
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["preferences.force-disable.check.once.policy", true],
|
||||
]});
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["gfx.direct2d.disabled", false],
|
||||
["layers.acceleration.disabled", false],
|
||||
]});
|
||||
|
|
|
@ -2,6 +2,12 @@ const DEFAULT_HW_ACCEL_PREF = Services.prefs.getDefaultBranch(null).getBoolPref(
|
|||
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
|
||||
|
||||
add_task(async function() {
|
||||
// We must temporarily disable `Once` StaticPrefs check for the duration of
|
||||
// this test (see bug 1556131). We must do so in a separate operation as
|
||||
// pushPrefEnv doesn't set the preferences in the order one could expect.
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["preferences.force-disable.check.once.policy", true],
|
||||
]});
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["layers.acceleration.disabled", DEFAULT_HW_ACCEL_PREF],
|
||||
["dom.ipc.processCount", DEFAULT_PROCESS_COUNT],
|
||||
|
|
|
@ -2,6 +2,12 @@ const DEFAULT_HW_ACCEL_PREF = Services.prefs.getDefaultBranch(null).getBoolPref(
|
|||
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
|
||||
|
||||
add_task(async function() {
|
||||
// We must temporarily disable `Once` StaticPrefs check for the duration of
|
||||
// this test (see bug 1556131). We must do so in a separate operation as
|
||||
// pushPrefEnv doesn't set the preferences in the order one could expect.
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["preferences.force-disable.check.once.policy", true],
|
||||
]});
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["layers.acceleration.disabled", DEFAULT_HW_ACCEL_PREF],
|
||||
["dom.ipc.processCount", DEFAULT_PROCESS_COUNT],
|
||||
|
|
|
@ -2,6 +2,12 @@ const DEFAULT_HW_ACCEL_PREF = Services.prefs.getDefaultBranch(null).getBoolPref(
|
|||
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
|
||||
|
||||
add_task(async function() {
|
||||
// We must temporarily disable `Once` StaticPrefs check for the duration of
|
||||
// this test (see bug 1556131). We must do so in a separate operation as
|
||||
// pushPrefEnv doesn't set the preferences in the order one could expect.
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["preferences.force-disable.check.once.policy", true],
|
||||
]});
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["layers.acceleration.disabled", DEFAULT_HW_ACCEL_PREF],
|
||||
["dom.ipc.processCount", DEFAULT_PROCESS_COUNT],
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
#include "PLDHashTable.h"
|
||||
#include "plstr.h"
|
||||
#include "prlink.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <map>
|
||||
|
@ -1705,7 +1706,9 @@ static void NotifyCallbacks(const char* aPrefName, const PrefWrapper* aPref) {
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (XRE_IsParentProcess() && StaticPrefs::preferences_check_once_policy()) {
|
||||
if (XRE_IsParentProcess() &&
|
||||
!StaticPrefs::preferences_force_disable_check_once_policy() &&
|
||||
(StaticPrefs::preferences_check_once_policy() || xpc::IsInAutomation())) {
|
||||
// Check that we aren't modifying a `Once` pref using that prefName.
|
||||
// We have about 100 `Once` StaticPrefs defined. std::map performs a search
|
||||
// in O(log n), so this is fast enough for our case.
|
||||
|
@ -5517,26 +5520,27 @@ void StaticPrefs::InitOncePrefs() {
|
|||
// and that maybe instead they should have been made `Live`.
|
||||
#define PREF(name, cpp_type, value)
|
||||
#ifdef DEBUG
|
||||
# define VARCACHE_PREF(policy, name, id, cpp_type, value) \
|
||||
if (UpdatePolicy::policy == UpdatePolicy::Once) { \
|
||||
StaticPrefs::sVarCache_##id = PreferencesInternalMethods::GetPref( \
|
||||
name, StripAtomic<cpp_type>(value)); \
|
||||
auto checkPref = [&]() { \
|
||||
if (!sOncePrefRead) { \
|
||||
return; \
|
||||
} \
|
||||
StripAtomic<cpp_type> staticPrefValue = StaticPrefs::id(); \
|
||||
StripAtomic<cpp_type> preferenceValue = \
|
||||
PreferencesInternalMethods::GetPref(Get##id##PrefName(), \
|
||||
StripAtomic<cpp_type>(value)); \
|
||||
MOZ_ASSERT( \
|
||||
staticPrefValue == preferenceValue, \
|
||||
"Preference '" name "' got modified since StaticPrefs::" #id \
|
||||
" got initialized. Consider using a `Live` StaticPrefs instead"); \
|
||||
}; \
|
||||
gOnceStaticPrefsAntiFootgun->insert( \
|
||||
std::pair<const char*, AntiFootgunCallback>(Get##id##PrefName(), \
|
||||
std::move(checkPref))); \
|
||||
# define VARCACHE_PREF(policy, name, id, cpp_type, value) \
|
||||
if (UpdatePolicy::policy == UpdatePolicy::Once) { \
|
||||
StaticPrefs::sVarCache_##id = PreferencesInternalMethods::GetPref( \
|
||||
name, StripAtomic<cpp_type>(value)); \
|
||||
auto checkPref = [&]() { \
|
||||
if (!sOncePrefRead) { \
|
||||
return; \
|
||||
} \
|
||||
StripAtomic<cpp_type> staticPrefValue = StaticPrefs::id(); \
|
||||
StripAtomic<cpp_type> preferenceValue = \
|
||||
PreferencesInternalMethods::GetPref( \
|
||||
StaticPrefs::Get##id##PrefName(), \
|
||||
StripAtomic<cpp_type>(value)); \
|
||||
MOZ_ASSERT( \
|
||||
staticPrefValue == preferenceValue, \
|
||||
"Preference '" name "' got modified since StaticPrefs::" #id \
|
||||
" got initialized. Consider using a `Live` StaticPrefs instead"); \
|
||||
}; \
|
||||
gOnceStaticPrefsAntiFootgun->insert( \
|
||||
std::pair<const char*, AntiFootgunCallback>(Get##id##PrefName(), \
|
||||
std::move(checkPref))); \
|
||||
}
|
||||
#else
|
||||
# define VARCACHE_PREF(policy, name, id, cpp_type, value) \
|
||||
|
|
|
@ -6795,6 +6795,16 @@ VARCACHE_PREF(
|
|||
preferences_check_once_policy,
|
||||
bool, false
|
||||
)
|
||||
|
||||
// If set to true, StaticPrefs Once policy check will be skipped during
|
||||
// automation regression test. Use with care. This pref must be set back to
|
||||
// false as soon as specific test has completed.
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"preferences.force-disable.check.once.policy",
|
||||
preferences_force_disable_check_once_policy,
|
||||
bool, false
|
||||
)
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче