mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 03:05:34 +00:00
e7207b6fd8
Preferences::SetPreference() is used when setting prefs in the content process from dom::Pref values that are passed from the parent process. Currently we use the high-level Set*InAnyProcess() methods to do this -- basically the same code path as sets done via the API -- but this has several problems. - It is subtly broken. If the content process already has a pref of type T with a default value and then we get a SetPreference() call that tries to change it to type U, it will erroneously fail. In practice this never(?) happens, but it shows that things aren't arranged very well. - SetPreference() also looks up the hashtable twice to get the same pref if both a default value and a user value are present in the dom::Pref. - This happens in content processes, while all other pref set operations occur in the parent process. This is the main reason we have the Set*InAnyProcess() functions. In short, the setting of prefs via IPC is quite different to the setting of prefs via other means -- because it happens in content processes, and it's more of a clobber that can set both values at once -- and so should be handled differently. The solution is to make Preferences::SetPreference() use lower-level operations to do the update. It now does the hash table lookup/add itself, and then calls the new Pref::FromDomPref() method. That method then possibly calls the new PrefValue::FromDomPrefValue() method for both kinds of value, and overwrites them as necessary. SetValueFromDom() is no longer used and the patch removes it. MozReview-Commit-ID: 2Rg8VMOc0Cl --HG-- extra : rebase_source : 0eddc3a4b694a79af3e173aefa7758f8e2ae776b |
||
---|---|---|
.. | ||
init | ||
test | ||
greprefs.js | ||
moz.build | ||
nsIPrefBranch.idl | ||
nsIPrefLocalizedString.idl | ||
nsIPrefService.idl | ||
nsIRelativeFilePref.idl | ||
Preferences.cpp | ||
Preferences.h |