Bug 1478273 - When clicked on the side bar pane, it disappears r=gl

Differential Revision: https://phabricator.services.mozilla.com/D3505

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Ratcliffe 2018-08-16 15:05:31 +00:00
parent cbdc91569d
commit 892766091a
2 changed files with 42 additions and 0 deletions

View File

@ -3385,6 +3385,15 @@ Toolbox.prototype = {
return extInfo && Services.prefs.getBoolPref(extInfo.pref, false);
},
/**
* Returns a panel id in the case of built in panels or "other" in the case of
* third party panels. This is necessary due to limitations in addon id strings,
* the permitted length of event telemetry property values and what we actually
* want to see in our telemetry.
*
* @param {String} id
* The panel id we would like to process.
*/
getTelemetryPanelNameOrOther: function(id) {
if (!this._toolNames) {
const definitions = gDevTools.getToolDefinitionArray();
@ -3392,9 +3401,11 @@ Toolbox.prototype = {
this._toolNames = new Set(definitionIds);
}
if (!this._toolNames.has(id)) {
return "other";
}
return id;
},
};

View File

@ -332,7 +332,11 @@ ToolSidebar.prototype = {
return;
}
currentToolId = this.getTelemetryPanelNameOrOther(currentToolId);
if (previousToolId) {
previousToolId = this.getTelemetryPanelNameOrOther(previousToolId);
this._telemetry.toolClosed(previousToolId);
this._telemetry.recordEvent("devtools.main", "sidepanel_changed", "inspector", null,
@ -346,6 +350,33 @@ ToolSidebar.prototype = {
this._telemetry.toolOpened(currentToolId);
},
/**
* Returns a panel id in the case of built in panels or "other" in the case of
* third party panels. This is necessary due to limitations in addon id strings,
* the permitted length of event telemetry property values and what we actually
* want to see in our telemetry.
*
* @param {String} id
* The panel id we would like to process.
*/
getTelemetryPanelNameOrOther: function(id) {
if (!this._toolNames) {
// Get all built in tool ids. We identify third party tool ids by checking
// for a "-", which shows it originates from an addon.
const ids = this._tabbar.state.tabs.map(({ id: toolId }) => {
return toolId.includes("-") ? "other" : toolId;
});
this._toolNames = new Set(ids);
}
if (!this._toolNames.has(id)) {
return "other";
}
return id;
},
/**
* Show the sidebar.
*