author | Michael Ratcliffe <mratcliffe@mozilla.com> |
Thu, 16 Aug 2018 15:05:31 +0000 | |
changeset 490598 | ee51ad97d401d529454fd1fe7dc8b2fc44389afd |
parent 490597 | 32e98ec84de35a219e857c660cf69efcd9ff1b1c |
child 490599 | 21291aa6b4c8b57eac9bfaa79cfdb7c3baabb6e7 |
push id | 1815 |
push user | ffxbld-merge |
push date | Mon, 15 Oct 2018 10:40:45 +0000 |
treeherder | mozilla-release@18d4c09e9378 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gl |
bugs | 1478273 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
devtools/client/framework/toolbox.js | file | annotate | diff | comparison | revisions | |
devtools/client/inspector/toolsidebar.js | file | annotate | diff | comparison | revisions |
--- a/devtools/client/framework/toolbox.js +++ b/devtools/client/framework/toolbox.js @@ -3380,21 +3380,32 @@ Toolbox.prototype = { * to true. * @see browser/components/extensions/ext-devtools.js */ isWebExtensionEnabled: function(extensionUUID) { const extInfo = this._webExtensions.get(extensionUUID); 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(); const definitionIds = definitions.map(definition => definition.id); this._toolNames = new Set(definitionIds); } + if (!this._toolNames.has(id)) { return "other"; } + return id; }, };
--- a/devtools/client/inspector/toolsidebar.js +++ b/devtools/client/inspector/toolsidebar.js @@ -327,31 +327,62 @@ ToolSidebar.prototype = { * id of the previously selected tool. */ updateTelemetryOnChange: function(currentToolId, previousToolId) { if (currentToolId === previousToolId || !this._telemetry) { // Skip telemetry if the tool id did not change or telemetry is unavailable. return; } + currentToolId = this.getTelemetryPanelNameOrOther(currentToolId); + if (previousToolId) { + previousToolId = this.getTelemetryPanelNameOrOther(previousToolId); + this._telemetry.toolClosed(previousToolId); this._telemetry.recordEvent("devtools.main", "sidepanel_changed", "inspector", null, { "oldpanel": previousToolId, "newpanel": currentToolId, "session_id": this._toolPanel._toolbox.sessionId } ); } 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. * * @param {String} id * The sidebar tab id to select. */ show: function(id) { this._tabbox.removeAttribute("hidden");