3
3
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=467738
4
4
Forwarded: https://bugzilla.mozilla.org/attachment.cgi?id=351145
7
modules/libpref/src/prefapi.cpp | 5 ++++-
8
modules/libpref/src/prefapi.h | 3 ++-
9
modules/libpref/src/prefread.cpp | 11 ++++++++---
10
modules/libpref/src/prefread.h | 4 +++-
11
4 files changed, 17 insertions(+), 6 deletions(-)
13
Index: firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefread.cpp
6
Index: firefox-trunk-58.0~a1~hg20171027r388661/modules/libpref/Preferences.cpp
14
7
===================================================================
15
--- firefox-trunk-50.0~a1~hg20160801r307508.orig/modules/libpref/prefread.cpp
16
+++ firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefread.cpp
17
@@ -43,6 +43,7 @@ enum {
18
#define BITS_PER_HEX_DIGIT 4
8
--- firefox-trunk-58.0~a1~hg20171027r388661.orig/modules/libpref/Preferences.cpp
9
+++ firefox-trunk-58.0~a1~hg20171027r388661/modules/libpref/Preferences.cpp
14
- bool aIsStickyDefault)
15
+ bool aIsStickyDefault,
21
flags |= kPrefForceSet;
23
pref_HashPref(aPref, aValue, aType, flags);
25
+ PREF_LockPref(aPref, true);
28
//===========================================================================
33
- bool aIsStickyDefault);
34
+ bool aIsStickyDefault,
37
// Report any errors or warnings we encounter during parsing.
38
typedef void (*PrefParseErrorReporter)(const char* aMessage,
40
PrefType mVtype; // PREF_{STRING,INT,BOOL}
41
bool mIsDefault; // true if (default) pref
42
bool mIsStickyDefault; // true if (sticky) pref
43
+ bool mIsLock; // true if (locked) pref
46
// Pref parser states.
48
#define BITS_PER_HEX_DIGIT 4
20
50
static const char kUserPref[] = "user_pref";
21
51
+static const char kLockPref[] = "lockPref";
22
52
static const char kPref[] = "pref";
23
53
static const char kPrefSticky[] = "sticky_pref";
24
54
static const char kTrue[] = "true";
25
@@ -146,7 +147,7 @@ pref_DoCallback(PrefParseState *ps)
28
(*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault,
29
- ps->fstickydefault);
30
+ ps->fstickydefault, ps->flock);
34
@@ -215,6 +216,7 @@ PREF_ParseBuf(PrefParseState *ps, const
35
ps->vtype = PrefType::Invalid;
37
ps->fstickydefault = false;
56
aPS->mVtype = PrefType::Invalid;
57
aPS->mIsDefault = false;
58
aPS->mIsStickyDefault = false;
59
+ aPS->mIsLock = false;
62
case '/': // begin comment block or line?
63
@@ -1527,11 +1534,14 @@
65
case 'u': // indicating user_pref
66
case 's': // indicating sticky_pref
67
+ case 'l': // indicating lockPref
68
case 'p': // indicating pref
70
aPS->mStrMatch = kUserPref;
71
} else if (c == 's') {
72
aPS->mStrMatch = kPrefSticky;
73
+ } else if (c == 'l') {
74
+ aPS->mStrMatch = kLockPref;
76
aPS->mStrMatch = kPref;
41
case '/': /* begin comment block or line? */
42
@@ -225,11 +227,14 @@ PREF_ParseBuf(PrefParseState *ps, const
44
case 'u': /* indicating user_pref */
45
case 's': /* indicating sticky_pref */
46
+ case 'l': /* indicating lockPref */
47
case 'p': /* indicating pref */
49
ps->smatch = kUserPref;
50
} else if (c == 's') {
51
ps->smatch = kPrefSticky;
52
+ } else if (c == 'l') {
53
+ ps->smatch = kLockPref;
57
@@ -277,8 +282,10 @@ PREF_ParseBuf(PrefParseState *ps, const
59
case PREF_PARSE_UNTIL_NAME:
60
if (c == '\"' || c == '\'') {
61
- ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky);
62
+ ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky ||
63
+ ps->smatch == kLockPref);
64
ps->fstickydefault = (ps->smatch == kPrefSticky);
65
+ ps->flock = (ps->smatch == kLockPref);
67
ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */
68
state = PREF_PARSE_QUOTED_STRING;
69
Index: firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefread.h
70
===================================================================
71
--- firefox-trunk-50.0~a1~hg20160801r307508.orig/modules/libpref/prefread.h
72
+++ firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefread.h
73
@@ -34,7 +34,8 @@ typedef void (*PrefReader)(void *c
82
* Report any errors or warnings we encounter during parsing.
83
@@ -62,6 +63,7 @@ typedef struct PrefParseState {
84
PrefType vtype; /* PREF_STRING,INT,BOOL */
85
bool fdefault; /* true if (default) pref */
86
bool fstickydefault; /* true if (sticky) pref */
87
+ bool flock; /* true if (locked) pref */
91
Index: firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefapi.cpp
92
===================================================================
93
--- firefox-trunk-50.0~a1~hg20160801r307508.orig/modules/libpref/prefapi.cpp
94
+++ firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefapi.cpp
95
@@ -997,7 +997,8 @@ void PREF_ReaderCallback(void *clo
99
- bool isStickyDefault)
100
+ bool isStickyDefault,
105
@@ -1010,4 +1011,6 @@ void PREF_ReaderCallback(void *clo
106
flags |= kPrefForceSet;
108
pref_HashPref(pref, value, type, flags);
110
+ PREF_LockPref(pref, true);
112
Index: firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefapi.h
113
===================================================================
114
--- firefox-trunk-50.0~a1~hg20160801r307508.orig/modules/libpref/prefapi.h
115
+++ firefox-trunk-50.0~a1~hg20160801r307508/modules/libpref/prefapi.h
116
@@ -243,7 +243,8 @@ void PREF_ReaderCallback( void *closure,
120
- bool isStickyDefault);
121
+ bool isStickyDefault,
79
case PREF_PARSE_UNTIL_NAME:
80
if (c == '\"' || c == '\'') {
82
- (aPS->mStrMatch == kPref || aPS->mStrMatch == kPrefSticky);
83
+ (aPS->mStrMatch == kPref || aPS->mStrMatch == kPrefSticky || aPS->mStrMatch == kLockPref);
84
aPS->mIsStickyDefault = (aPS->mStrMatch == kPrefSticky);
85
+ aPS->mIsLock = (aPS->mStrMatch == kLockPref);
87
aPS->mNextState = PREF_PARSE_UNTIL_COMMA; // return here when done
88
state = PREF_PARSE_QUOTED_STRING;
93
- aPS->mIsStickyDefault);
94
+ aPS->mIsStickyDefault,
97
state = PREF_PARSE_INIT;
98
} else if (c == '/') {