зеркало из https://github.com/mozilla/gecko-dev.git
Bug 961034 - [Australis] Collect UITelemetry on how many times the Australis menu button is clicked. r=Gijs.
This commit is contained in:
Родитель
8d3046b734
Коммит
ab696390c1
|
@ -135,6 +135,13 @@ const OTHER_MOUSEUP_MONITORED_ITEMS = [
|
|||
"menubar-items",
|
||||
];
|
||||
|
||||
// Items that open arrow panels will often be overlapped by
|
||||
// the panel that they're opening by the time the mouseup
|
||||
// event is fired, so for these items, we monitor mousedown.
|
||||
const MOUSEDOWN_MONITORED_ITEMS = [
|
||||
"PanelUI-menu-button",
|
||||
];
|
||||
|
||||
// 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
|
||||
|
@ -261,6 +268,13 @@ this.BrowserUITelemetry = {
|
|||
}
|
||||
}
|
||||
|
||||
for (let itemID of MOUSEDOWN_MONITORED_ITEMS) {
|
||||
let item = document.getElementById(itemID);
|
||||
if (item) {
|
||||
item.addEventListener("mousedown", this);
|
||||
}
|
||||
}
|
||||
|
||||
WINDOW_DURATION_MAP.set(aWindow, {});
|
||||
},
|
||||
|
||||
|
@ -281,6 +295,13 @@ this.BrowserUITelemetry = {
|
|||
item.removeEventListener("mouseup", this);
|
||||
}
|
||||
}
|
||||
|
||||
for (let itemID of MOUSEDOWN_MONITORED_ITEMS) {
|
||||
let item = document.getElementById(itemID);
|
||||
if (item) {
|
||||
item.removeEventListener("mousedown", this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function(aEvent) {
|
||||
|
@ -291,6 +312,9 @@ this.BrowserUITelemetry = {
|
|||
case "mouseup":
|
||||
this._handleMouseUp(aEvent);
|
||||
break;
|
||||
case "mousedown":
|
||||
this._handleMouseDown(aEvent);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -312,6 +336,16 @@ this.BrowserUITelemetry = {
|
|||
}
|
||||
},
|
||||
|
||||
_handleMouseDown: function(aEvent) {
|
||||
if (aEvent.currentTarget.id == "PanelUI-menu-button") {
|
||||
// _countMouseUpEvent expects a detail for the second argument,
|
||||
// but we don't really have any details to give. Just passing in
|
||||
// "button" is probably simpler than trying to modify
|
||||
// _countMouseUpEvent for this particular case.
|
||||
this._countMouseUpEvent("click-menu-button", "button", aEvent.button);
|
||||
}
|
||||
},
|
||||
|
||||
_PlacesChevronMouseUp: function(aEvent) {
|
||||
let target = aEvent.originalTarget;
|
||||
let result = target.id == "PlacesChevron" ? "chevron" : "overflowed-item";
|
||||
|
|
Загрузка…
Ссылка в новой задаче