Bug 1438433 - Make network.predictor.cleaned-up a non-VarCache pref. r=hurley.

mCleanedUp is a VarCache variable, which mirrors the canonical value of the
network.predictor.cleaned-up pref. When the canonical pref value is modified,
e.g. by SetBool(), then mCleanedUp is also updated.

But the updating relationship is one-way -- if mCleanedUp is modified, the
canonical value of the pref is not updated. Such an inconsistency is bad! For
example, Predictor.cpp will use mCleanedUp's value, but about:config will show
the canonical value.

(For this reason, VarCache prefs are meant to be read-only outside of libpref.
Bug 1436655 will enforce this.)

This patch changes mCleanedUp so it's not a VarCache variable, avoiding the
mirroring issue.

MozReview-Commit-ID: LIG02gMkRjF

--HG--
extra : rebase_source : 273b2372ce718b0f346695a0dc96a189cd3ba233
This commit is contained in:
Nicholas Nethercote 2018-03-13 13:06:30 +11:00
Родитель f87fadb9cb
Коммит 439e258873
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -438,7 +438,7 @@ Predictor::InstallObserver()
PREDICTOR_MAX_RESOURCES_PREF,
PREDICTOR_MAX_RESOURCES_DEFAULT);
Preferences::AddBoolVarCache(&mCleanedUp, PREDICTOR_CLEANED_UP_PREF, false);
mCleanedUp = Preferences::GetBool(PREDICTOR_CLEANED_UP_PREF, false);
Preferences::AddUintVarCache(&mMaxURILength, PREDICTOR_MAX_URI_LENGTH_PREF,
PREDICTOR_MAX_URI_LENGTH_DEFAULT);