From 568fb76791ce63704d362e49c18d4cc6c188cb6b Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 14 Sep 2015 18:42:01 -0500 Subject: [PATCH] Bug 1203624 - Measure view source usage. r=mconley p=ally --- toolkit/components/telemetry/Histograms.json | 18 ++++++++++++++++++ .../viewsource/content/viewSourceUtils.js | 11 ++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 01a5f0a7304..7b18b13cf7d 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -7352,6 +7352,24 @@ "n_buckets": 20, "description": "The amount of time spent in a specific performance tool view, keyed by view name (waterfall, js-calltree, js-flamegraph, etc)." }, + "VIEW_SOURCE_IN_BROWSER_OPENED_BOOLEAN": { + "alert_emails": ["mozilla-dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"], + "expires_in_version": "53", + "kind": "boolean", + "description": "How many times has view source in browser / tab been opened?" + }, + "VIEW_SOURCE_IN_WINDOW_OPENED_BOOLEAN": { + "alert_emails": ["mozilla-dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"], + "expires_in_version": "53", + "kind": "boolean", + "description": "How many times has view source in a new window been opened?" + }, + "VIEW_SOURCE_EXTERNAL_RESULT_BOOLEAN": { + "alert_emails": ["mozilla-dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"], + "expires_in_version": "53", + "kind": "boolean", + "description": "How many times has view source in an external editor been opened, and did it succeed?" + }, "BROWSER_IS_USER_DEFAULT": { "expires_in_version": "never", "kind": "boolean", diff --git a/toolkit/components/viewsource/content/viewSourceUtils.js b/toolkit/components/viewsource/content/viewSourceUtils.js index 2a4a9897129..3e1c45c1e5a 100644 --- a/toolkit/components/viewsource/content/viewSourceUtils.js +++ b/toolkit/components/viewsource/content/viewSourceUtils.js @@ -88,6 +88,9 @@ var gViewSourceUtils = { * The line number to focus on once the source is loaded. */ viewSourceInBrowser: function(aArgs) { + Services.telemetry + .getHistogramById("VIEW_SOURCE_IN_BROWSER_OPENED_BOOLEAN") + .add(true); let viewSourceBrowser = new ViewSourceBrowser(aArgs.viewSourceBrowser); viewSourceBrowser.loadViewSource(aArgs); }, @@ -156,6 +159,9 @@ var gViewSourceUtils = { } catch (ex) { } } + Services.telemetry + .getHistogramById("VIEW_SOURCE_IN_WINDOW_OPENED_BOOLEAN") + .add(true); openDialog("chrome://global/content/viewSource.xul", "_blank", "all,dialog=no", @@ -340,7 +346,10 @@ var gViewSourceUtils = { // Calls the callback, keeping in mind undefined or null values. handleCallBack: function(aCallBack, result, data) { - // ifcallback is undefined, default to the internal viewer + Services.telemetry + .getHistogramById("VIEW_SOURCE_EXTERNAL_RESULT_BOOLEAN") + .add(result); + // if callback is undefined, default to the internal viewer if (aCallBack === undefined) { this.internalViewerFallback(result, data); } else if (aCallBack) {