--- mozilla/modules/libpref/Preferences.cpp.orig 2021-03-01 21:17:57.000000000 +0300
+++ mozilla/modules/libpref/Preferences.cpp 2021-03-10 21:24:24.556800552 +0300
@@ -1284,7 +1284,8 @@ PREF_ReaderCallback(void* aClosure,
PrefValue aValue,
PrefType aType,
bool aIsDefault,
- bool aIsStickyDefault)
+ bool aIsStickyDefault,
+ bool aIsLocked)
{
uint32_t flags = 0;
if (aIsDefault) {
@@ -1296,6 +1297,9 @@ PREF_ReaderCallback(void* aClosure,
flags |= kPrefForceSet;
}
pref_HashPref(aPref, aValue, aType, flags);
+ if (aIsLocked) {
+ PREF_LockPref(aPref, true);
+ }
}
//===========================================================================
@@ -1317,7 +1321,8 @@ typedef void (*PrefReader)(void* aClosur
PrefValue aValue,
PrefType aType,
bool aIsDefault,
- bool aIsStickyDefault);
+ bool aIsStickyDefault,
+ bool aIsLocked);
// Report any errors or warnings we encounter during parsing.
typedef void (*PrefParseErrorReporter)(const char* aMessage,
@@ -1345,6 +1350,7 @@ struct PrefParseState
PrefType mVtype; // PREF_{STRING,INT,BOOL}
bool mIsDefault; // true if (default) pref
bool mIsStickyDefault; // true if (sticky) pref
+ bool mIsLocked; // true if (locked) pref
};
// Pref parser states.
@@ -1374,6 +1380,7 @@ enum
#define BITS_PER_HEX_DIGIT 4
static const char kUserPref[] = "user_pref";
+static const char kLockPref[] = "lockPref";
static const char kPref[] = "pref";
static const char kPrefSticky[] = "sticky_pref";
static const char kTrue[] = "true";
@@ -1521,6 +1528,7 @@ PREF_ParseBuf(PrefParseState* aPS, const
aPS->mVtype = PrefType::Invalid;
aPS->mIsDefault = false;
aPS->mIsStickyDefault = false;
+ aPS->mIsLocked = false;
}
switch (c) {
case '/': // begin comment block or line?
@@ -1532,10 +1540,13 @@ PREF_ParseBuf(PrefParseState* aPS, const
case 'u': // indicating user_pref
case 's': // indicating sticky_pref
case 'p': // indicating pref
+ case 'l': // indicating lockPref
if (c == 'u') {
aPS->mStrMatch = kUserPref;
} else if (c == 's') {
aPS->mStrMatch = kPrefSticky;
+ } else if (c == 'l') {
+ aPS->mStrMatch = kLockPref;
} else {
aPS->mStrMatch = kPref;
}
@@ -1584,8 +1595,10 @@ PREF_ParseBuf(PrefParseState* aPS, const
case PREF_PARSE_UNTIL_NAME:
if (c == '\"' || c == '\'') {
aPS->mIsDefault =
- (aPS->mStrMatch == kPref || aPS->mStrMatch == kPrefSticky);
+ (aPS->mStrMatch == kPref || aPS->mStrMatch == kPrefSticky ||
+ aPS->mStrMatch == kLockPref);
aPS->mIsStickyDefault = (aPS->mStrMatch == kPrefSticky);
+ aPS->mIsLocked = (aPS->mStrMatch == kLockPref);
aPS->mQuoteChar = c;
aPS->mNextState = PREF_PARSE_UNTIL_COMMA; // return here when done
state = PREF_PARSE_QUOTED_STRING;
@@ -1914,7 +1927,8 @@ PREF_ParseBuf(PrefParseState* aPS, const
value,
aPS->mVtype,
aPS->mIsDefault,
- aPS->mIsStickyDefault);
+ aPS->mIsStickyDefault,
+ aPS->mIsLocked);
state = PREF_PARSE_INIT;
} else if (c == '/') {