mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-05 23:07:31 +09:00
ported "Allow .js preference files to set locked prefs with lock_pref()" patch
This commit is contained in:
parent
09a00ad3bd
commit
102302fa48
4 changed files with 17 additions and 5 deletions
|
|
@ -989,7 +989,8 @@ void PREF_ReaderCallback(void *closure,
|
||||||
PrefValue value,
|
PrefValue value,
|
||||||
PrefType type,
|
PrefType type,
|
||||||
bool isDefault,
|
bool isDefault,
|
||||||
bool isStickyDefault)
|
bool isStickyDefault,
|
||||||
|
bool isLocked)
|
||||||
|
|
||||||
{
|
{
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
|
@ -1002,4 +1003,6 @@ void PREF_ReaderCallback(void *closure,
|
||||||
flags |= kPrefForceSet;
|
flags |= kPrefForceSet;
|
||||||
}
|
}
|
||||||
pref_HashPref(pref, value, type, flags);
|
pref_HashPref(pref, value, type, flags);
|
||||||
|
if (isLocked)
|
||||||
|
PREF_LockPref(pref, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,8 @@ void PREF_ReaderCallback( void *closure,
|
||||||
PrefValue value,
|
PrefValue value,
|
||||||
PrefType type,
|
PrefType type,
|
||||||
bool isDefault,
|
bool isDefault,
|
||||||
bool isStickyDefault);
|
bool isStickyDefault,
|
||||||
|
bool isLocked);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ enum {
|
||||||
#define BITS_PER_HEX_DIGIT 4
|
#define BITS_PER_HEX_DIGIT 4
|
||||||
|
|
||||||
static const char kUserPref[] = "user_pref";
|
static const char kUserPref[] = "user_pref";
|
||||||
|
static const char kLockPref[] = "lock_pref";
|
||||||
static const char kPref[] = "pref";
|
static const char kPref[] = "pref";
|
||||||
static const char kPrefSticky[] = "sticky_pref";
|
static const char kPrefSticky[] = "sticky_pref";
|
||||||
static const char kTrue[] = "true";
|
static const char kTrue[] = "true";
|
||||||
|
|
@ -146,7 +147,7 @@ pref_DoCallback(PrefParseState *ps)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault,
|
(*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault,
|
||||||
ps->fstickydefault);
|
ps->fstickydefault, ps->flock);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,6 +216,7 @@ PREF_ParseBuf(PrefParseState *ps, const char *buf, int bufLen)
|
||||||
ps->vtype = PrefType::Invalid;
|
ps->vtype = PrefType::Invalid;
|
||||||
ps->fdefault = false;
|
ps->fdefault = false;
|
||||||
ps->fstickydefault = false;
|
ps->fstickydefault = false;
|
||||||
|
ps->flock = false;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '/': /* begin comment block or line? */
|
case '/': /* begin comment block or line? */
|
||||||
|
|
@ -225,11 +227,14 @@ PREF_ParseBuf(PrefParseState *ps, const char *buf, int bufLen)
|
||||||
break;
|
break;
|
||||||
case 'u': /* indicating user_pref */
|
case 'u': /* indicating user_pref */
|
||||||
case 's': /* indicating sticky_pref */
|
case 's': /* indicating sticky_pref */
|
||||||
|
case 'l': /* indicating lock_pref */
|
||||||
case 'p': /* indicating pref */
|
case 'p': /* indicating pref */
|
||||||
if (c == 'u') {
|
if (c == 'u') {
|
||||||
ps->smatch = kUserPref;
|
ps->smatch = kUserPref;
|
||||||
} else if (c == 's') {
|
} else if (c == 's') {
|
||||||
ps->smatch = kPrefSticky;
|
ps->smatch = kPrefSticky;
|
||||||
|
} else if (c == 'l') {
|
||||||
|
ps->smatch = kLockPref;
|
||||||
} else {
|
} else {
|
||||||
ps->smatch = kPref;
|
ps->smatch = kPref;
|
||||||
}
|
}
|
||||||
|
|
@ -277,8 +282,9 @@ PREF_ParseBuf(PrefParseState *ps, const char *buf, int bufLen)
|
||||||
/* name parsing */
|
/* name parsing */
|
||||||
case PREF_PARSE_UNTIL_NAME:
|
case PREF_PARSE_UNTIL_NAME:
|
||||||
if (c == '\"' || c == '\'') {
|
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->fstickydefault = (ps->smatch == kPrefSticky);
|
||||||
|
ps->flock = (ps->smatch == kLockPref);
|
||||||
ps->quotechar = c;
|
ps->quotechar = c;
|
||||||
ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */
|
ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */
|
||||||
state = PREF_PARSE_QUOTED_STRING;
|
state = PREF_PARSE_QUOTED_STRING;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ typedef void (*PrefReader)(void *closure,
|
||||||
PrefValue val,
|
PrefValue val,
|
||||||
PrefType type,
|
PrefType type,
|
||||||
bool defPref,
|
bool defPref,
|
||||||
bool stickyPref);
|
bool stickyPref,
|
||||||
|
bool lockPref);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report any errors or warnings we encounter during parsing.
|
* Report any errors or warnings we encounter during parsing.
|
||||||
|
|
@ -62,6 +63,7 @@ typedef struct PrefParseState {
|
||||||
PrefType vtype; /* PREF_STRING,INT,BOOL */
|
PrefType vtype; /* PREF_STRING,INT,BOOL */
|
||||||
bool fdefault; /* true if (default) pref */
|
bool fdefault; /* true if (default) pref */
|
||||||
bool fstickydefault; /* true if (sticky) pref */
|
bool fstickydefault; /* true if (sticky) pref */
|
||||||
|
bool flock; /* true if pref to be locked */
|
||||||
} PrefParseState;
|
} PrefParseState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue