Bug 1088710 - part 1: fix some leftover gunk from pre-australis menubutton, r?mconley
MozReview-Commit-ID: C4fA6cboVZY
--- a/browser/base/content/browser-charsetmenu.inc
+++ b/browser/base/content/browser-charsetmenu.inc
@@ -1,19 +1,13 @@
# 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/.
<menu id="charsetMenu"
label="&charsetMenu2.label;"
-#ifndef OMIT_ACCESSKEYS
accesskey="&charsetMenu2.accesskey;"
-#endif
oncommand="BrowserSetForcedCharacterSet(event.target.getAttribute('charset'));"
-#ifdef OMIT_ACCESSKEYS
- onpopupshowing="CharsetMenu.build(event.target, false);"
-#else
onpopupshowing="CharsetMenu.build(event.target);"
-#endif
onpopupshown="UpdateCurrentCharset(this);">
<menupopup>
</menupopup>
</menu>
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5487,19 +5487,19 @@ function BrowserSetForcedCharacterSet(aC
}
function BrowserCharsetReload()
{
BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
function UpdateCurrentCharset(target) {
+ let selectedCharset = CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet);
for (let menuItem of target.getElementsByTagName("menuitem")) {
- let isSelected = menuItem.getAttribute("charset") ===
- CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet);
+ let isSelected = menuItem.getAttribute("charset") === selectedCharset;
menuItem.setAttribute("checked", isSelected);
}
}
var gPageStyleMenu = {
// This maps from a <browser> element (or, more specifically, a
// browser's permanentKey) to an Object that contains the most recent
// information about the browser content's stylesheets. That Object
--- a/toolkit/modules/CharsetMenu.jsm
+++ b/toolkit/modules/CharsetMenu.jsm
@@ -8,16 +8,19 @@ const { classes: Cc, interfaces: Ci, uti
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "gBundle", function() {
const kUrl = "chrome://global/locale/charsetMenu.properties";
return Services.strings.createBundle(kUrl);
});
+XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
+ "resource://gre/modules/Deprecated.jsm");
+
const kAutoDetectors = [
["off", ""],
["ja", "ja_parallel_state_machine"],
["ru", "ruprob"],
["uk", "ukprob"]
];
/**
@@ -112,42 +115,44 @@ function UpdateDetectorMenu(event) {
if (menuitem) {
menuitem.setAttribute("checked", "true");
}
}
var gDetectorInfoCache, gCharsetInfoCache, gPinnedInfoCache;
var CharsetMenu = {
- build: function(parent, showAccessKeys=true, showDetector=true) {
+ build: function(parent, deprecatedShowAccessKeys=true, showDetector=true) {
+ if (!deprecatedShowAccessKeys) {
+ Deprecated.warning("CharsetMenu no longer supports building a menu with no access keys.",
+ "https://bugzilla.mozilla.org/show_bug.cgi?id=1088710");
+ }
function createDOMNode(doc, nodeInfo) {
let node = doc.createElement("menuitem");
node.setAttribute("type", "radio");
node.setAttribute("name", nodeInfo.name + "Group");
node.setAttribute(nodeInfo.name, nodeInfo.value);
node.setAttribute("label", nodeInfo.label);
- if (showAccessKeys && nodeInfo.accesskey) {
+ if (nodeInfo.accesskey) {
node.setAttribute("accesskey", nodeInfo.accesskey);
}
return node;
}
if (parent.hasChildNodes()) {
// Detector menu or charset menu already built
return;
}
this._ensureDataReady();
let doc = parent.ownerDocument;
if (showDetector) {
let menuNode = doc.createElement("menu");
menuNode.setAttribute("label", gBundle.GetStringFromName("charsetMenuAutodet"));
- if (showAccessKeys) {
- menuNode.setAttribute("accesskey", gBundle.GetStringFromName("charsetMenuAutodet.key"));
- }
+ menuNode.setAttribute("accesskey", gBundle.GetStringFromName("charsetMenuAutodet.key"));
parent.appendChild(menuNode);
let menuPopupNode = doc.createElement("menupopup");
menuNode.appendChild(menuPopupNode);
menuPopupNode.addEventListener("command", SetDetector);
menuPopupNode.addEventListener("popupshown", UpdateDetectorMenu);
gDetectorInfoCache.forEach(detectorInfo => menuPopupNode.appendChild(createDOMNode(doc, detectorInfo)));