--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -673,34 +673,34 @@ public:
mHasUserValue = false;
mHasChangedSinceInit = true;
}
nsresult SetDefaultValue(PrefType aType,
PrefValue aValue,
bool aIsSticky,
bool aIsLocked,
- bool aFromFile,
+ bool aFromInit,
bool* aValueChanged)
{
// Types must always match when setting the default value.
if (!IsType(aType)) {
return NS_ERROR_UNEXPECTED;
}
// Should we set the default value? Only if the pref is not locked, and
// doing so would change the default value.
if (!IsLocked()) {
if (aIsLocked) {
SetIsLocked(true);
}
if (!ValueMatches(PrefValueKind::Default, aType, aValue)) {
mDefaultValue.Replace(Type(), aType, aValue);
mHasDefaultValue = true;
- if (!aFromFile) {
+ if (!aFromInit) {
mHasChangedSinceInit = true;
}
if (aIsSticky) {
mIsSticky = true;
}
if (!mHasUserValue) {
*aValueChanged = true;
}
@@ -708,44 +708,44 @@ public:
// Should we clear the user value? Currently we don't.
}
}
return NS_OK;
}
nsresult SetUserValue(PrefType aType,
PrefValue aValue,
- bool aFromFile,
+ bool aFromInit,
bool* aValueChanged)
{
// If we have a default value, types must match when setting the user
// value.
if (mHasDefaultValue && !IsType(aType)) {
return NS_ERROR_UNEXPECTED;
}
// Should we clear the user value, if present? Only if the new user value
// matches the default value, and the pref isn't sticky, and we aren't
- // force-setting it.
+ // force-setting it during initialization.
if (ValueMatches(PrefValueKind::Default, aType, aValue) && !mIsSticky &&
- !aFromFile) {
+ !aFromInit) {
if (mHasUserValue) {
ClearUserValue();
if (!IsLocked()) {
*aValueChanged = true;
}
}
// Otherwise, should we set the user value? Only if doing so would
// change the user value.
} else if (!ValueMatches(PrefValueKind::User, aType, aValue)) {
mUserValue.Replace(Type(), aType, aValue);
SetType(aType); // needed because we may have changed the type
mHasUserValue = true;
- if (!aFromFile) {
+ if (!aFromInit) {
mHasChangedSinceInit = true;
}
if (!IsLocked()) {
*aValueChanged = true;
}
}
return NS_OK;
}
@@ -1146,17 +1146,17 @@ pref_HashTableLookup(const char* aPrefNa
static nsresult
pref_SetPref(const char* aPrefName,
PrefType aType,
PrefValueKind aKind,
PrefValue aValue,
bool aIsSticky,
bool aIsLocked,
- bool aFromFile)
+ bool aFromInit)
{
MOZ_ASSERT(NS_IsMainThread());
if (!gHashTable) {
return NS_ERROR_OUT_OF_MEMORY;
}
auto entry = static_cast<PrefEntry*>(gHashTable->Add(aPrefName, fallible));
@@ -1169,20 +1169,20 @@ pref_SetPref(const char* aPrefName,
// New entry. Set the type.
pref->SetType(aType);
}
bool valueChanged = false;
nsresult rv;
if (aKind == PrefValueKind::Default) {
rv = pref->SetDefaultValue(
- aType, aValue, aIsSticky, aIsLocked, aFromFile, &valueChanged);
+ aType, aValue, aIsSticky, aIsLocked, aFromInit, &valueChanged);
} else {
MOZ_ASSERT(!aIsLocked); // `locked` is disallowed in user pref files
- rv = pref->SetUserValue(aType, aValue, aFromFile, &valueChanged);
+ rv = pref->SetUserValue(aType, aValue, aFromInit, &valueChanged);
}
if (NS_FAILED(rv)) {
NS_WARNING(
nsPrintfCString(
"Rejected attempt to change type of pref %s's %s value from %s to %s",
aPrefName,
(aKind == PrefValueKind::Default) ? "default" : "user",
PrefTypeToString(pref->Type()),
@@ -1344,17 +1344,17 @@ private:
{
sNumPrefs++;
pref_SetPref(aPrefName,
aType,
aKind,
aValue,
aIsSticky,
aIsLocked,
- /* fromFile */ true);
+ /* fromInit */ true);
}
static void HandleError(const char* aMsg)
{
nsresult rv;
nsCOMPtr<nsIConsoleService> console =
do_GetService("@mozilla.org/consoleservice;1", &rv);
if (NS_SUCCEEDED(rv)) {
@@ -4407,51 +4407,51 @@ Preferences::SetCString(const char* aPre
const nsCString& flat = PromiseFlatCString(aValue);
prefValue.mStringVal = flat.get();
return pref_SetPref(aPrefName,
PrefType::String,
aKind,
prefValue,
/* isSticky */ false,
/* isLocked */ false,
- /* fromFile */ false);
+ /* fromInit */ false);
}
/* static */ nsresult
Preferences::SetBool(const char* aPrefName, bool aValue, PrefValueKind aKind)
{
ENSURE_PARENT_PROCESS("SetBool", aPrefName);
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
PrefValue prefValue;
prefValue.mBoolVal = aValue;
return pref_SetPref(aPrefName,
PrefType::Bool,
aKind,
prefValue,
/* isSticky */ false,
/* isLocked */ false,
- /* fromFile */ false);
+ /* fromInit */ false);
}
/* static */ nsresult
Preferences::SetInt(const char* aPrefName, int32_t aValue, PrefValueKind aKind)
{
ENSURE_PARENT_PROCESS("SetInt", aPrefName);
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
PrefValue prefValue;
prefValue.mIntVal = aValue;
return pref_SetPref(aPrefName,
PrefType::Int,
aKind,
prefValue,
/* isSticky */ false,
/* isLocked */ false,
- /* fromFile */ false);
+ /* fromInit */ false);
}
/* static */ nsresult
Preferences::SetComplex(const char* aPrefName,
const nsIID& aType,
nsISupports* aValue,
PrefValueKind aKind)
{