Bug 1348215. Fix the SIMPLE_WORKER_PREF setup to not mishandle pref names that start with the worker pref name. r=ehsan

Without this change, we will call WorkerPrefChanged if a pref whose name just
_starts_ with the name of one of our WORKER_SIMPLE_PREF prefs changes.  Then in
WorkerPrefChanged we will get the value of the pref that changed, and store it
under the key identified by the closure, thus writing the value of an incorrect
pref in there.

MozReview-Commit-ID: JTsvvtC5P1o
This commit is contained in:
Boris Zbarsky 2017-03-17 14:10:40 -04:00
Родитель eda24647b8
Коммит 7d85fda7ff
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -2052,12 +2052,14 @@ RuntimeService::Init()
NS_FAILED(Preferences::RegisterCallbackAndCall( \
WorkerPrefChanged, \
name, \
reinterpret_cast<void*>(WORKERPREF_##NAME))) ||
reinterpret_cast<void*>(WORKERPREF_##NAME), \
Preferences::ExactMatch)) ||
#define WORKER_PREF(name, callback) \
NS_FAILED(Preferences::RegisterCallbackAndCall( \
callback, \
name, \
nullptr)) ||
nullptr, \
Preferences::ExactMatch)) ||
#include "WorkerPrefs.h"
#undef WORKER_SIMPLE_PREF
#undef WORKER_PREF