Bug 943524 - fix charset and chardet processing to allow for unique IDs, r=jaws

This commit is contained in:
Gijs Kruitbosch 2013-11-28 11:25:14 +01:00
Родитель e1af4fd4be
Коммит acd2297ca2
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -11,9 +11,9 @@
#endif #endif
oncommand="MultiplexHandler(event)" oncommand="MultiplexHandler(event)"
#ifdef OMIT_ACCESSKEYS #ifdef OMIT_ACCESSKEYS
onpopupshowing="CharsetMenu.build(event);" #expand onpopupshowing="CharsetMenu.build(event, '__ID_PREFIX__');"
#else #else
onpopupshowing="CharsetMenu.build(event, true);" #expand onpopupshowing="CharsetMenu.build(event, '__ID_PREFIX__', true);"
#endif #endif
onpopupshown="UpdateMenus(event);"> onpopupshown="UpdateMenus(event);">
<menupopup> <menupopup>

Просмотреть файл

@ -5087,7 +5087,7 @@ function MultiplexHandler(event)
SelectDetector(event, false); SelectDetector(event, false);
} else if (name == 'charsetGroup') { } else if (name == 'charsetGroup') {
var charset = node.getAttribute('id'); var charset = node.getAttribute('id');
charset = charset.substring('charset.'.length, charset.length) charset = charset.substring(charset.indexOf('charset.') + 'charset.'.length);
BrowserSetForcedCharacterSet(charset); BrowserSetForcedCharacterSet(charset);
} else if (name == 'charsetCustomize') { } else if (name == 'charsetCustomize') {
//do nothing - please remove this else statement, once the charset prefs moves to the pref window //do nothing - please remove this else statement, once the charset prefs moves to the pref window
@ -5100,7 +5100,7 @@ function MultiplexHandler(event)
function SelectDetector(event, doReload) function SelectDetector(event, doReload)
{ {
var uri = event.target.getAttribute("id"); var uri = event.target.getAttribute("id");
var prefvalue = uri.substring('chardet.'.length, uri.length); var prefvalue = uri.substring(uri.indexOf('chardet.') + 'chardet.'.length);
if ("off" == prefvalue) { // "off" is special value to turn off the detectors if ("off" == prefvalue) { // "off" is special value to turn off the detectors
prefvalue = ""; prefvalue = "";
} }

Просмотреть файл

@ -82,7 +82,7 @@ const kPinned = [
]; ];
this.CharsetMenu = Object.freeze({ this.CharsetMenu = Object.freeze({
build: function BuildCharsetMenu(event, showAccessKeys) { build: function BuildCharsetMenu(event, idPrefix="", showAccessKeys=false) {
let parent = event.target; let parent = event.target;
if (parent.lastChild.localName != "menuseparator") { if (parent.lastChild.localName != "menuseparator") {
// Detector menu or charset menu already built // Detector menu or charset menu already built
@ -108,7 +108,7 @@ this.CharsetMenu = Object.freeze({
// Some items intentionally don't have an accesskey // Some items intentionally don't have an accesskey
} }
} }
menuItem.setAttribute("id", "charset." + encoding); menuItem.setAttribute("id", idPrefix + "charset." + encoding);
return menuItem; return menuItem;
} }