summaryrefslogtreecommitdiff
path: root/mozilla-440908.patch
blob: ec41ab38bc2f7a37212d20037ff9a757e0431c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
diff -up firefox-49.0/modules/libpref/prefapi.cpp.440908 firefox-49.0/modules/libpref/prefapi.cpp
--- firefox-49.0/modules/libpref/prefapi.cpp.440908	2016-07-25 22:22:05.000000000 +0200
+++ firefox-49.0/modules/libpref/prefapi.cpp	2016-09-08 11:45:51.283206722 +0200
@@ -971,8 +971,8 @@ void PREF_ReaderCallback(void       *clo
                          PrefValue   value,
                          PrefType    type,
                          bool        isDefault,
-                         bool        isStickyDefault)
-
+                         bool        isStickyDefault,
+                         bool        isLocked)
 {
     uint32_t flags = 0;
     if (isDefault) {
@@ -984,4 +984,6 @@ void PREF_ReaderCallback(void       *clo
         flags |= kPrefForceSet;
     }
     pref_HashPref(pref, value, type, flags);
+    if (isLocked)
+        PREF_LockPref(pref, true);
 }
diff -up firefox-49.0/modules/libpref/prefapi.h.440908 firefox-49.0/modules/libpref/prefapi.h
--- firefox-49.0/modules/libpref/prefapi.h.440908	2016-06-01 06:11:44.000000000 +0200
+++ firefox-49.0/modules/libpref/prefapi.h	2016-09-08 11:45:51.283206722 +0200
@@ -243,7 +243,8 @@ void PREF_ReaderCallback( void *closure,
                           PrefValue   value,
                           PrefType    type,
                           bool        isDefault,
-                          bool        isStickyDefault);
+                          bool        isStickyDefault,
+                          bool        isLocked);
 
 #ifdef __cplusplus
 }
diff -up firefox-49.0/modules/libpref/prefread.cpp.440908 firefox-49.0/modules/libpref/prefread.cpp
--- firefox-49.0/modules/libpref/prefread.cpp.440908	2016-09-05 22:12:58.000000000 +0200
+++ firefox-49.0/modules/libpref/prefread.cpp	2016-09-08 11:45:51.284206727 +0200
@@ -43,6 +43,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";
@@ -146,7 +147,7 @@ pref_DoCallback(PrefParseState *ps)
         break;
     }
     (*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault,
-                  ps->fstickydefault);
+                  ps->fstickydefault, ps->flock);
     return true;
 }
 
@@ -215,6 +216,7 @@ PREF_ParseBuf(PrefParseState *ps, const
                 ps->vtype = PrefType::Invalid;
                 ps->fdefault = false;
                 ps->fstickydefault = false;
+                ps->flock = false;
             }
             switch (c) {
             case '/':       /* begin comment block or line? */
@@ -225,11 +227,14 @@ PREF_ParseBuf(PrefParseState *ps, const
                 break;
             case 'u':       /* indicating user_pref */
             case 's':       /* indicating sticky_pref */
+            case 'l':       /* indicating lockPref */
             case 'p':       /* indicating pref */
                 if (c == 'u') {
                   ps->smatch = kUserPref;
                 } else if (c == 's') {
                   ps->smatch = kPrefSticky;
+                } else if (c == 'l') {
+                  ps->smatch = kLockPref;
                 } else {
                   ps->smatch = kPref;
                 }
@@ -277,8 +282,10 @@ PREF_ParseBuf(PrefParseState *ps, const
         /* name parsing */
         case PREF_PARSE_UNTIL_NAME:
             if (c == '\"' || c == '\'') {
-                ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky);
+                ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky
+                                || ps->smatch == kLockPref);
                 ps->fstickydefault = (ps->smatch == kPrefSticky);
+                ps->flock = (ps->smatch == kLockPref);
                 ps->quotechar = c;
                 ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */
                 state = PREF_PARSE_QUOTED_STRING;
diff -up firefox-49.0/modules/libpref/prefread.h.440908 firefox-49.0/modules/libpref/prefread.h
--- firefox-49.0/modules/libpref/prefread.h.440908	2016-09-05 22:12:58.000000000 +0200
+++ firefox-49.0/modules/libpref/prefread.h	2016-09-08 11:57:09.485889976 +0200
@@ -34,7 +34,8 @@ typedef void (*PrefReader)(void       *c
                            PrefValue   val,
                            PrefType    type,
                            bool        defPref,
-                           bool        stickyPref);
+                           bool        stickyPref,
+                           bool        lockPref);
 
 /**
  * Report any errors or warnings we encounter during parsing.
@@ -62,6 +63,7 @@ typedef struct PrefParseState {
     PrefType    vtype;      /* PREF_STRING,INT,BOOL          */
     bool        fdefault;   /* true if (default) pref        */
     bool        fstickydefault; /* true if (sticky) pref     */
+    bool        flock;      /* true if pref to be locked     */
 } PrefParseState;
 
 /**
@@ -90,7 +92,7 @@ void PREF_InitParseState(PrefParseState
  *
  * @param ps
  *        PrefParseState instance.
- */        
+ */
 void PREF_FinalizeParseState(PrefParseState *ps);
 
 /**
bgstack15