Bug 841527 - Update the FX_IDENTITY_POPUP_OPEN_MS telemetry probe to use the TelemetryStopwatch. r=felipe

This commit is contained in:
Cykesiopka 2013-02-22 06:57:31 -05:00
parent 5cfe2d786d
commit a6ac6cd2fc

View File

@ -7102,25 +7102,27 @@ var gIdentityHandler = {
this._identityPopup.hidePopup();
},
_popupOpenTime : null,
/**
* Click handler for the identity-box element in primary chrome.
*/
handleIdentityButtonEvent : function(event) {
this._popupOpenTime = new Date();
TelemetryStopwatch.start("FX_IDENTITY_POPUP_OPEN_MS");
event.stopPropagation();
if ((event.type == "click" && event.button != 0) ||
(event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
event.keyCode != KeyEvent.DOM_VK_RETURN))
event.keyCode != KeyEvent.DOM_VK_RETURN)) {
TelemetryStopwatch.cancel("FX_IDENTITY_POPUP_OPEN_MS");
return; // Left click, space or enter only
}
// Don't allow left click, space or enter if the location
// is chrome UI or the location has been modified.
if (this._mode == this.IDENTITY_MODE_CHROMEUI ||
gURLBar.getAttribute("pageproxystate") != "valid")
gURLBar.getAttribute("pageproxystate") != "valid") {
TelemetryStopwatch.cancel("FX_IDENTITY_POPUP_OPEN_MS");
return;
}
// Make sure that the display:none style we set in xul is removed now that
// the popup is actually needed
@ -7142,13 +7144,7 @@ var gIdentityHandler = {
},
onPopupShown : function(event) {
let openingDuration = new Date() - this._popupOpenTime;
this._popupOpenTime = null;
try {
Services.telemetry.getHistogramById("FX_IDENTITY_POPUP_OPEN_MS").add(openingDuration);
} catch (ex) {
Components.utils.reportError("Unable to report telemetry for FX_IDENTITY_POPUP_OPEN_MS.");
}
TelemetryStopwatch.finish("FX_IDENTITY_POPUP_OPEN_MS");
document.getElementById('identity-popup-more-info-button').focus();
},