зеркало из https://github.com/mozilla/gecko-dev.git
Bug 976631 Fix fallout from bug 956657 and port code simplification r=Gijs
This commit is contained in:
Родитель
e294e12dd4
Коммит
230ead1b0d
|
@ -678,8 +678,8 @@ const CustomizableWidgets = [{
|
||||||
let elem = aDocument.createElementNS(kNSXUL, "toolbarbutton");
|
let elem = aDocument.createElementNS(kNSXUL, "toolbarbutton");
|
||||||
elem.setAttribute("label", item.label);
|
elem.setAttribute("label", item.label);
|
||||||
elem.setAttribute("type", "checkbox");
|
elem.setAttribute("type", "checkbox");
|
||||||
elem.section = aSection == "detectors" ? "detectors" : "charsets";
|
elem.section = aSection;
|
||||||
elem.value = item.id;
|
elem.value = item.value;
|
||||||
elem.setAttribute("class", "subviewbutton");
|
elem.setAttribute("class", "subviewbutton");
|
||||||
containerElem.appendChild(elem);
|
containerElem.appendChild(elem);
|
||||||
}
|
}
|
||||||
|
@ -687,10 +687,7 @@ const CustomizableWidgets = [{
|
||||||
updateCurrentCharset: function(aDocument) {
|
updateCurrentCharset: function(aDocument) {
|
||||||
let content = aDocument.defaultView.content;
|
let content = aDocument.defaultView.content;
|
||||||
let currentCharset = content && content.document && content.document.characterSet;
|
let currentCharset = content && content.document && content.document.characterSet;
|
||||||
if (currentCharset) {
|
currentCharset = CharsetMenu.foldCharset(currentCharset);
|
||||||
currentCharset = aDocument.defaultView.FoldCharset(currentCharset);
|
|
||||||
}
|
|
||||||
currentCharset = currentCharset ? ("charset." + currentCharset) : "";
|
|
||||||
|
|
||||||
let pinnedContainer = aDocument.getElementById("PanelUI-characterEncodingView-pinned");
|
let pinnedContainer = aDocument.getElementById("PanelUI-characterEncodingView-pinned");
|
||||||
let charsetContainer = aDocument.getElementById("PanelUI-characterEncodingView-charsets");
|
let charsetContainer = aDocument.getElementById("PanelUI-characterEncodingView-charsets");
|
||||||
|
@ -700,13 +697,11 @@ const CustomizableWidgets = [{
|
||||||
},
|
},
|
||||||
updateCurrentDetector: function(aDocument) {
|
updateCurrentDetector: function(aDocument) {
|
||||||
let detectorContainer = aDocument.getElementById("PanelUI-characterEncodingView-autodetect");
|
let detectorContainer = aDocument.getElementById("PanelUI-characterEncodingView-autodetect");
|
||||||
let detectorEnum = CharsetManager.GetCharsetDetectorList();
|
|
||||||
let currentDetector;
|
let currentDetector;
|
||||||
try {
|
try {
|
||||||
currentDetector = Services.prefs.getComplexValue(
|
currentDetector = Services.prefs.getComplexValue(
|
||||||
"intl.charset.detector", Ci.nsIPrefLocalizedString).data;
|
"intl.charset.detector", Ci.nsIPrefLocalizedString).data;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
currentDetector = "chardet." + (currentDetector || "off");
|
|
||||||
|
|
||||||
this._updateElements(detectorContainer.childNodes, currentDetector);
|
this._updateElements(detectorContainer.childNodes, currentDetector);
|
||||||
},
|
},
|
||||||
|
@ -762,13 +757,8 @@ const CustomizableWidgets = [{
|
||||||
// The behavior as implemented here is directly based off of the
|
// The behavior as implemented here is directly based off of the
|
||||||
// `MultiplexHandler()` method in browser.js.
|
// `MultiplexHandler()` method in browser.js.
|
||||||
if (section != "detectors") {
|
if (section != "detectors") {
|
||||||
let charset = value.substring(value.indexOf('charset.') + 'charset.'.length);
|
window.BrowserSetForcedCharacterSet(value);
|
||||||
window.BrowserSetForcedCharacterSet(charset);
|
|
||||||
} else {
|
} else {
|
||||||
value = value.replace(/^chardet\./, "");
|
|
||||||
if (value == "off") {
|
|
||||||
value = "";
|
|
||||||
}
|
|
||||||
// Set the detector pref.
|
// Set the detector pref.
|
||||||
try {
|
try {
|
||||||
let str = Cc["@mozilla.org/supports-string;1"]
|
let str = Cc["@mozilla.org/supports-string;1"]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче