Bug 943524 - fix issues in holly caused by bug 805374, r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 26 Nov 2013 22:04:01 +0100
changeset 157722 a1c1679379fdc0bb3fda6e4c7742f94a2919e4c1
parent 157721 5d90f8c198bfd26760a0d22fb1f09987022ef67f
child 157723 6f55de7392337a47fa333e8b261a2b193c370f45
push id25721
push usercbook@mozilla.com
push dateWed, 27 Nov 2013 10:02:03 +0000
treeherdermozilla-central@6ecf0c4dfcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs943524, 805374
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 943524 - fix issues in holly caused by bug 805374, r=jaws
browser/base/content/browser-charsetmenu.inc
browser/modules/CharsetMenu.jsm
--- a/browser/base/content/browser-charsetmenu.inc
+++ b/browser/base/content/browser-charsetmenu.inc
@@ -1,41 +1,62 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #filter substitution
 
 #expand <menu id="__ID_PREFIX__charsetMenu"
     label="&charsetMenu.label;"
+#ifndef OMIT_ACCESSKEYS
     accesskey="&charsetMenu.accesskey;"
+#endif
     oncommand="MultiplexHandler(event)"
+#ifdef OMIT_ACCESSKEYS
     onpopupshowing="CharsetMenu.build(event);"
+#else
+    onpopupshowing="CharsetMenu.build(event, true);"
+#endif
     onpopupshown="UpdateMenus(event);">
   <menupopup>
     <menu label="&charsetMenuAutodet.label;"
-          accesskey="&charsetMenuAutodet.accesskey;">
+#ifndef OMIT_ACCESSKEYS
+          accesskey="&charsetMenuAutodet.accesskey;"
+#endif
+        >
       <menupopup>
         <menuitem type="radio"
                   name="detectorGroup"
-                  id="chardet.off"
+#expand           id="__ID_PREFIX__chardet.off"
                   label="&charsetMenuAutodet.off.label;"
-                  accesskey="&charsetMenuAutodet.off.accesskey;"/>
+#ifndef OMIT_ACCESSKEYS
+                  accesskey="&charsetMenuAutodet.off.accesskey;"
+#endif
+                  />
         <menuitem type="radio"
                   name="detectorGroup"
-                  id="chardet.ja_parallel_state_machine"
+#expand           id="__ID_PREFIX__chardet.ja_parallel_state_machine"
                   label="&charsetMenuAutodet.ja.label;"
-                  accesskey="&charsetMenuAutodet.ja.accesskey;"/>
+#ifndef OMIT_ACCESSKEYS
+                  accesskey="&charsetMenuAutodet.ja.accesskey;"
+#endif
+                  />
         <menuitem type="radio"
                   name="detectorGroup"
-                  id="chardet.ruprob"
+#expand           id="__ID_PREFIX__chardet.ruprob"
                   label="&charsetMenuAutodet.ru.label;"
-                  accesskey="&charsetMenuAutodet.ru.accesskey;"/>
+#ifndef OMIT_ACCESSKEYS
+                  accesskey="&charsetMenuAutodet.ru.accesskey;"
+#endif
+                  />
         <menuitem type="radio"
                   name="detectorGroup"
-                  id="chardet.ukprob"
+#expand           id="__ID_PREFIX__chardet.ukprob"
                   label="&charsetMenuAutodet.uk.label;"
-                  accesskey="&charsetMenuAutodet.uk.accesskey;"/>
+#ifndef OMIT_ACCESSKEYS
+                  accesskey="&charsetMenuAutodet.uk.accesskey;"
+#endif
+                  />
       </menupopup>
     </menu>
     <menuseparator/>
   </menupopup>
 </menu>
--- a/browser/modules/CharsetMenu.jsm
+++ b/browser/modules/CharsetMenu.jsm
@@ -77,17 +77,17 @@ const kEncodings = new Set([
 
 // Always at the start of the menu, in this order, followed by a separator.
 const kPinned = [
   "UTF-8",
   "windows-1252"
 ];
 
 this.CharsetMenu = Object.freeze({
-  build: function BuildCharsetMenu(event) {
+  build: function BuildCharsetMenu(event, showAccessKeys) {
     let parent = event.target;
     if (parent.lastChild.localName != "menuseparator") {
       // Detector menu or charset menu already built
       return;
     }
     let doc = parent.ownerDocument;
 
     function createItem(encoding) {
@@ -95,21 +95,23 @@ this.CharsetMenu = Object.freeze({
       menuItem.setAttribute("type", "radio");
       menuItem.setAttribute("name", "charsetGroup");
       try {
         menuItem.setAttribute("label", gBundle.GetStringFromName(encoding));
       } catch (e) {
         // Localization error but put *something* in the menu to recover.
         menuItem.setAttribute("label", encoding);
       }
-      try {
-        menuItem.setAttribute("accesskey",
-                              gBundle.GetStringFromName(encoding + ".key"));
-      } catch (e) {
-        // Some items intentionally don't have an accesskey
+      if (showAccessKeys) {
+        try {
+          menuItem.setAttribute("accesskey",
+                                gBundle.GetStringFromName(encoding + ".key"));
+        } catch (e) {
+          // Some items intentionally don't have an accesskey
+        }
       }
       menuItem.setAttribute("id", "charset." + encoding);
       return menuItem;
     }
 
     // Clone the set in order to be able to remove the pinned encodings from
     // the cloned set.
     let encodings = new Set(kEncodings);