diff --git a/browser/base/content/browser-charsetmenu.inc b/browser/base/content/browser-charsetmenu.inc index dca869a92e5a..628de1341fea 100644 --- a/browser/base/content/browser-charsetmenu.inc +++ b/browser/base/content/browser-charsetmenu.inc @@ -11,9 +11,9 @@ #endif oncommand="MultiplexHandler(event)" #ifdef OMIT_ACCESSKEYS - onpopupshowing="CharsetMenu.build(event);" +#expand onpopupshowing="CharsetMenu.build(event, '__ID_PREFIX__');" #else - onpopupshowing="CharsetMenu.build(event, true);" +#expand onpopupshowing="CharsetMenu.build(event, '__ID_PREFIX__', true);" #endif onpopupshown="UpdateMenus(event);"> diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index c9d226d18ff2..57a941970b0b 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5087,7 +5087,7 @@ function MultiplexHandler(event) SelectDetector(event, false); } else if (name == 'charsetGroup') { var charset = node.getAttribute('id'); - charset = charset.substring('charset.'.length, charset.length) + charset = charset.substring(charset.indexOf('charset.') + 'charset.'.length); BrowserSetForcedCharacterSet(charset); } else if (name == 'charsetCustomize') { //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) { 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 prefvalue = ""; } diff --git a/browser/modules/CharsetMenu.jsm b/browser/modules/CharsetMenu.jsm index ed6a10ee4e87..75c45953dfca 100644 --- a/browser/modules/CharsetMenu.jsm +++ b/browser/modules/CharsetMenu.jsm @@ -82,7 +82,7 @@ const kPinned = [ ]; this.CharsetMenu = Object.freeze({ - build: function BuildCharsetMenu(event, showAccessKeys) { + build: function BuildCharsetMenu(event, idPrefix="", showAccessKeys=false) { let parent = event.target; if (parent.lastChild.localName != "menuseparator") { // Detector menu or charset menu already built @@ -108,7 +108,7 @@ this.CharsetMenu = Object.freeze({ // Some items intentionally don't have an accesskey } } - menuItem.setAttribute("id", "charset." + encoding); + menuItem.setAttribute("id", idPrefix + "charset." + encoding); return menuItem; }