Upstream the changes from bug 1345294 - nsIPrefBranch should have methods to get/set unicode strings

Note that in order to not break compatibility for the Firefox addon, the preprocessor is used.

Re: [bug 1345294](https://bugzilla.mozilla.org/show_bug.cgi?id=1345294) and also [this commit](https://hg.mozilla.org/mozilla-central/rev/5a8192a650e9).
This commit is contained in:
Jonas Jenwald 2017-03-18 11:14:02 +01:00
parent 3ff872b796
commit ebae24cacc
2 changed files with 16 additions and 5 deletions

View File

@ -93,7 +93,12 @@ function getIntPref(pref, def) {
function getStringPref(pref, def) {
try {
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
//#if !MOZCENTRAL
if (!Services.prefs.getStringPref) {
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
}
//#endif
return Services.prefs.getStringPref(pref);
} catch (ex) {
return def;
}

View File

@ -273,10 +273,16 @@ var PdfjsChromeUtils = {
_setStringPref(aPrefName, aPrefValue) {
this._ensurePreferenceAllowed(aPrefName);
let str = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
str.data = aPrefValue;
Services.prefs.setComplexValue(aPrefName, Ci.nsISupportsString, str);
//#if !MOZCENTRAL
if (!Services.prefs.setStringPref) {
let str = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
str.data = aPrefValue;
Services.prefs.setComplexValue(aPrefName, Ci.nsISupportsString, str);
return;
}
//#endif
Services.prefs.setStringPref(aPrefName, aPrefValue);
},
/*