mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1271032 - Make getPref Unicode-aware. r=mkaply
This commit is contained in:
parent
4e12ba331b
commit
4881494273
@ -114,6 +114,12 @@ function getPref(prefName) {
|
||||
switch (prefBranch.getPrefType(prefName)) {
|
||||
|
||||
case prefBranch.PREF_STRING:
|
||||
if (gIsUTF8) {
|
||||
const nsISupportsString = Components.interfaces.nsISupportsString;
|
||||
let string = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(nsISupportsString);
|
||||
return prefBranch.getComplexValue(prefName, nsISupportsString).data;
|
||||
}
|
||||
return prefBranch.getCharPref(prefName);
|
||||
|
||||
case prefBranch.PREF_INT:
|
||||
|
@ -2,4 +2,5 @@
|
||||
// ©
|
||||
lockPref("_test.string.ASCII", "ASCII");
|
||||
lockPref("_test.string.non-ASCII", "日本語");
|
||||
lockPref("_test.string.getPref", getPref("_test.string.non-ASCII"));
|
||||
lockPref("_test.string.gIsUTF8", String(this.gIsUTF8));
|
||||
|
@ -2,4 +2,5 @@
|
||||
|
||||
lockPref("_test.string.ASCII", "UTF-8");
|
||||
lockPref("_test.string.non-ASCII", "日本語");
|
||||
lockPref("_test.string.getPref", getPref("_test.string.non-ASCII"));
|
||||
lockPref("_test.string.gIsUTF8", String(this.gIsUTF8));
|
||||
|
@ -31,6 +31,7 @@ function run_test() {
|
||||
prefs: {
|
||||
"_test.string.ASCII": "UTF-8",
|
||||
"_test.string.non-ASCII": "日本語",
|
||||
"_test.string.getPref": "日本語",
|
||||
"_test.string.gIsUTF8": "true"
|
||||
}
|
||||
}, {
|
||||
@ -38,6 +39,7 @@ function run_test() {
|
||||
prefs: {
|
||||
"_test.string.ASCII": "ASCII",
|
||||
"_test.string.non-ASCII": "日本語",
|
||||
"_test.string.getPref": "日本語",
|
||||
"_test.string.gIsUTF8": "false",
|
||||
}
|
||||
}];
|
||||
|
Loading…
Reference in New Issue
Block a user