Skip to content

Commit

Permalink
Upstream the changes from bug 1345294 - nsIPrefBranch should have met…
Browse files Browse the repository at this point in the history
…hods 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).
  • Loading branch information
Snuffleupagus committed Mar 20, 2017
1 parent 3ff872b commit ebae24c
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 ebae24c

Please sign in to comment.