Bug 944453 - Collect UITelemetry on if the menubar is displayed, and how many times menuitems are clicked. r=Gijs, a=bbajaj.
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -218,16 +218,17 @@ XPCOMUtils.defineLazyGetter(this, "ALL_B
.concat(SPECIAL_CASES);
});
const OTHER_MOUSEUP_MONITORED_ITEMS = [
"appmenu-button",
"PlacesChevron",
"PlacesToolbarItems",
"star-button",
+ "menubar-items",
];
// Weakly maps browser windows to objects whose keys are relative
// timestamps for when some kind of session started. For example,
// when a customization session started. That way, when the window
// exits customization mode, we can determine how long the session
// lasted.
const WINDOW_DURATION_MAP = new WeakMap();
@@ -391,16 +392,19 @@ this.BrowserUITelemetry = {
this._PlacesToolbarItemsMouseUp(aEvent);
break;
case "PlacesChevron":
this._PlacesChevronMouseUp(aEvent);
break;
case "star-button":
this._starButtonMouseUp(aEvent);
break;
+ case "menubar-items":
+ this._menubarMouseUp(aEvent);
+ break;
default:
this._checkForBuiltinItem(aEvent);
}
},
_appmenuMouseUp: function(aEvent) {
let itemId;
@@ -468,16 +472,23 @@ this.BrowserUITelemetry = {
},
_starButtonMouseUp: function(aEvent) {
let starButton = aEvent.originalTarget;
let action = starButton.hasAttribute("starred") ? "edit" : "add";
this._countMouseUpEvent("click-star-button", action, aEvent.button);
},
+ _menubarMouseUp: function(aEvent) {
+ let target = aEvent.originalTarget;
+ let tag = target.localName;
+ let result = (tag == "menu" || tag == "menuitem") ? tag : "other";
+ this._countMouseUpEvent("click-menubar", result, aEvent.button);
+ },
+
countCustomizationEvent: function(aCustomizationEvent) {
this._countEvent("customize", aCustomizationEvent);
},
startCustomizing: function(aWindow) {
this.countCustomizationEvent("start");
let durationMap = WINDOW_DURATION_MAP.get(aWindow);
durationMap.customization = aWindow.performance.now();
@@ -507,16 +518,23 @@ this.BrowserUITelemetry = {
// Determine if the add-on bar is currently visible
let addonBar = document.getElementById("addon-bar");
result.addonBarEnabled = addonBar && !addonBar.collapsed;
// Determine if the Bookmarks bar is currently visible
let bookmarksBar = document.getElementById("PersonalToolbar");
result.bookmarksBarEnabled = bookmarksBar && !bookmarksBar.collapsed;
+ // Determine if the menubar is currently visible. On OS X, the menubar
+ // is never shown, despite not having the collapsed attribute set.
+ let menuBar = document.getElementById("toolbar-menubar");
+ result.menuBarEnabled =
+ menuBar && Services.appinfo.OS != "Darwin"
+ && menuBar.getAttribute("autohide") != "true";
+
// Examine the default toolbars and see what default items
// are present and missing.
let defaultKept = [];
let defaultMoved = [];
let nondefaultAdded = [];
let customToolbars = 0;
let addonBarItems = 0;