Bug 1348215. Fix the SIMPLE_WORKER_PREF setup to not mishandle pref names that start with the worker pref name. r=ehsan
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 17 Mar 2017 14:10:40 -0400
changeset 348228 5491d388cdf43fae200369d886e063b779f68c00
parent 348227 1143fd4a40f5c1d4fd08a0680d986070c2e9b6e1
child 348261 5800d1391c10dcd268421a374bde6a514f8dcd10
push id88169
push userbzbarsky@mozilla.com
push dateFri, 17 Mar 2017 18:11:17 +0000
treeherdermozilla-inbound@5491d388cdf4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1348215
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/workers/RuntimeService.cpp
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -2047,22 +2047,24 @@ RuntimeService::Init()
                                              PREF_JS_OPTIONS_PREFIX PREF_GCZEAL,
                                              nullptr)) ||
 #endif
 
 #define WORKER_SIMPLE_PREF(name, getter, NAME)                                \
       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
 
       NS_FAILED(Preferences::RegisterCallbackAndCall(
                                                    LoadContextOptions,
                                                    PREF_WORKERS_OPTIONS_PREFIX,
                                                    nullptr)) ||