Skip to content

Commit

Permalink
Merge pull request #8172 from Snuffleupagus/bug-1345294
Browse files Browse the repository at this point in the history
Upstream the changes from bug 1345294 - nsIPrefBranch should have methods to get/set unicode strings
  • Loading branch information
yurydelendik authored Mar 20, 2017
2 parents 3ff872b + ebae24c commit b2ed788
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 6 additions & 1 deletion extensions/firefox/content/PdfStreamConverter.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 10 additions & 4 deletions extensions/firefox/content/PdfjsChromeUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

/*
Expand Down

0 comments on commit b2ed788

Please sign in to comment.