From c0472057e476f89fd06ab41f5fedf60a57e56bb0 Mon Sep 17 00:00:00 2001 From: "Fischer.json" Date: Tue, 9 May 2017 10:43:48 -0400 Subject: [PATCH] Bug 1330315 - Add a telemetry probe to track how the Preferences are opened, r=mconley MozReview-Commit-ID: GfuGF4v30pI --HG-- extra : rebase_source : e8b4399bd1e3fc5e5b220e80d6694c00a4b7e482 --- browser/base/content/baseMenuOverlay.xul | 2 +- .../base/content/browser-data-submission-info-bar.js | 4 ++-- browser/base/content/browser-media.js | 2 +- browser/base/content/browser-menubar.inc | 4 ++-- browser/base/content/browser-sets.inc | 2 +- browser/base/content/browser-sync.js | 10 +++++----- browser/base/content/browser.js | 8 ++++---- browser/base/content/utilityOverlay.js | 10 ++++++++-- .../components/customizableui/CustomizableWidgets.jsm | 2 +- browser/components/newtab/NewTabSearchProvider.jsm | 2 +- browser/components/nsBrowserContentHandler.js | 11 ++++++++--- browser/components/nsBrowserGlue.js | 6 +++--- browser/components/search/content/search.xml | 2 +- .../components/translation/translation-infobar.xml | 2 +- browser/components/uitour/UITour.jsm | 2 +- browser/modules/AboutHome.jsm | 4 ++-- browser/modules/ContentSearch.jsm | 2 +- toolkit/components/telemetry/Histograms.json | 10 ++++++++++ toolkit/content/aboutTelemetry.js | 4 ++-- toolkit/mozapps/extensions/content/extensions.js | 4 ++-- 20 files changed, 57 insertions(+), 36 deletions(-) diff --git a/browser/base/content/baseMenuOverlay.xul b/browser/base/content/baseMenuOverlay.xul index da74ca077c0c..1befa2bb66cc 100644 --- a/browser/base/content/baseMenuOverlay.xul +++ b/browser/base/content/baseMenuOverlay.xul @@ -22,7 +22,7 @@ used as they only apply to Cocoa widget builds. All version of Firefox through Firefox 2 will use Carbon widgets. --> - + diff --git a/browser/base/content/browser-data-submission-info-bar.js b/browser/base/content/browser-data-submission-info-bar.js index c499300a9d9e..e9cbd54ab355 100644 --- a/browser/base/content/browser-data-submission-info-bar.js +++ b/browser/base/content/browser-data-submission-info-bar.js @@ -69,9 +69,9 @@ var gDataNotificationInfoBar = { // The advanced subpanes are only supported in the old organization, which will // be removed by bug 1349689. if (Preferences.get("browser.preferences.useOldOrganization", false)) { - window.openAdvancedPreferences("dataChoicesTab"); + window.openAdvancedPreferences("dataChoicesTab", {origin: "dataReporting"}); } else { - window.openPreferences("privacy-reports"); + window.openPreferences("privacy-reports", {origin: "dataReporting"}); } }, }]; diff --git a/browser/base/content/browser-media.js b/browser/base/content/browser-media.js index b8ef627afc6b..ba6d93d54a02 100644 --- a/browser/base/content/browser-media.js +++ b/browser/base/content/browser-media.js @@ -167,7 +167,7 @@ var gEMEHandler = { let mainAction = { label: gNavigatorBundle.getString(btnLabelId), accessKey: gNavigatorBundle.getString(btnAccessKeyId), - callback() { openPreferences("panePrivacy"); }, + callback() { openPreferences("panePrivacy", {origin: "browserMedia"}); }, dismiss: true }; let options = { diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index 18737b42b36a..db88fa385cb7 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -185,7 +185,7 @@ + oncommand="openPreferences(undefined, {origin: 'menubar'});"/> #endif #endif @@ -532,7 +532,7 @@ + oncommand="openPreferences(undefined, {origin: 'menubar'});"/> #endif diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc index 01b5bdae2c14..2a7c63c405f6 100644 --- a/browser/base/content/browser-sets.inc +++ b/browser/base/content/browser-sets.inc @@ -93,7 +93,7 @@ - + diff --git a/browser/base/content/browser-sync.js b/browser/base/content/browser-sync.js index d08e10ba3505..c78e7dc1cc12 100644 --- a/browser/base/content/browser-sync.js +++ b/browser/base/content/browser-sync.js @@ -241,17 +241,17 @@ var gSync = { onMenuPanelCommand() { switch (this.panelUIFooter.getAttribute("fxastatus")) { case "signedin": - this.openPrefs("menupanel"); + this.openPrefs("menupanel", "fxaSignedin"); break; case "error": if (this.panelUIFooter.getAttribute("fxastatus") == "unverified") { - this.openPrefs("menupanel"); + this.openPrefs("menupanel", "fxaError"); } else { this.openSignInAgainPage("menupanel"); } break; default: - this.openPrefs("menupanel"); + this.openPrefs("menupanel", "fxa"); break; } @@ -439,8 +439,8 @@ var gSync = { Services.obs.notifyObservers(null, "cloudsync:user-sync"); }, - openPrefs(entryPoint = "syncbutton") { - window.openPreferences("paneSync", { urlParams: { entrypoint: entryPoint } }); + openPrefs(entryPoint = "syncbutton", origin = undefined) { + window.openPreferences("paneSync", { origin, urlParams: { entrypoint: entryPoint } }); }, openSyncedTabsPanel() { diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 6c5f3718f076..e791cbb1c847 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -527,9 +527,9 @@ const gStoragePressureObserver = { // be removed by bug 1349689. let win = gBrowser.ownerGlobal; if (Preferences.get("browser.preferences.useOldOrganization", false)) { - win.openAdvancedPreferences("networkTab"); + win.openAdvancedPreferences("networkTab", {origin: "storagePressure"}); } else { - win.openPreferences("panePrivacy"); + win.openPreferences("panePrivacy", {origin: "storagePressure"}); } } }); @@ -6363,9 +6363,9 @@ var OfflineApps = { // The advanced subpanes are only supported in the old organization, which will // be removed by bug 1349689. if (Preferences.get("browser.preferences.useOldOrganization", false)) { - openAdvancedPreferences("networkTab"); + openAdvancedPreferences("networkTab", {origin: "offlineApps"}); } else { - openPreferences("panePrivacy"); + openPreferences("panePrivacy", {origin: "offlineApps"}); } }, diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 4e014bb71557..a05ebbf32b9b 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -715,6 +715,12 @@ function openAboutDialog() { } function openPreferences(paneID, extraArgs) { + let histogram = Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA"); + if (extraArgs && extraArgs.origin) { + histogram.add(extraArgs.origin); + } else { + histogram.add("other"); + } function switchToAdvancedSubPane(doc) { if (extraArgs && extraArgs["advancedTab"]) { let advancedPaneTabs = doc.getElementById("advancedPrefs"); @@ -780,8 +786,8 @@ function openPreferences(paneID, extraArgs) { } } -function openAdvancedPreferences(tabID) { - openPreferences("paneAdvanced", { "advancedTab": tabID }); +function openAdvancedPreferences(tabID, origin) { + openPreferences("paneAdvanced", { "advancedTab": tabID, origin }); } /** diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index fabcb08ef12a..6fe99fafa285 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -1184,7 +1184,7 @@ let preferencesButton = { defaultArea: CustomizableUI.AREA_PANEL, onCommand(aEvent) { let win = aEvent.target.ownerGlobal; - win.openPreferences(); + win.openPreferences(undefined, {origin: "preferencesButton"}); } }; if (AppConstants.platform == "win") { diff --git a/browser/components/newtab/NewTabSearchProvider.jsm b/browser/components/newtab/NewTabSearchProvider.jsm index 84d42d16d849..513092c2a3c6 100644 --- a/browser/components/newtab/NewTabSearchProvider.jsm +++ b/browser/components/newtab/NewTabSearchProvider.jsm @@ -71,7 +71,7 @@ SearchProvider.prototype = { manageEngines(browser) { const browserWin = browser.ownerGlobal; - browserWin.openPreferences("paneGeneral"); + browserWin.openPreferences("paneGeneral", { origin: "contentSearch" }); }, async asyncGetState() { diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index 0d4563ddfda8..5032919526a4 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -215,7 +215,12 @@ function openWindow(parent, url, target, features, args, noExternalArgs) { return Services.ww.openWindow(parent, url, target, features, argArray); } -function openPreferences() { +function openPreferences(extraArgs) { + if (extraArgs && extraArgs.origin) { + Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add(extraArgs.origin); + } else { + Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add("other"); + } var args = Components.classes["@mozilla.org/array;1"] .createInstance(Components.interfaces.nsIMutableArray); @@ -351,7 +356,7 @@ nsBrowserContentHandler.prototype = { // Handle old preference dialog URLs. if (chromeParam == "chrome://browser/content/pref/pref.xul" || chromeParam == "chrome://browser/content/preferences/preferences.xul") { - openPreferences(); + openPreferences({origin: "commandLineLegacy"}); cmdLine.preventDefault = true; } else try { let resolvedURI = resolveURIInternal(cmdLine, chromeParam); @@ -376,7 +381,7 @@ nsBrowserContentHandler.prototype = { } } if (cmdLine.handleFlag("preferences", false)) { - openPreferences(); + openPreferences({origin: "commandLineLegacy"}); cmdLine.preventDefault = true; } if (cmdLine.handleFlag("silent", false)) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 0a3cf4463132..39aa9727278b 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -308,7 +308,7 @@ BrowserGlue.prototype = { observe: function BG_observe(subject, topic, data) { switch (topic) { case "notifications-open-settings": - this._openPreferences("privacy"); + this._openPreferences("privacy", { origin: "notifOpenSettings" }); break; case "prefservice:after-app-defaults": this._onAppDefaults(); @@ -1710,7 +1710,7 @@ BrowserGlue.prototype = { let clickCallback = (subject, topic, data) => { if (topic != "alertclickcallback") return; - this._openPreferences("sync"); + this._openPreferences("sync", { origin: "doorhanger" }); } AlertsService.showAlertNotification(null, title, body, true, null, clickCallback); }, @@ -2293,7 +2293,7 @@ BrowserGlue.prototype = { let clickCallback = (subject, topic, data) => { if (topic != "alertclickcallback") return; - this._openPreferences("sync"); + this._openPreferences("sync", { origin: "devDisconnectedAlert"}); } AlertsService.showAlertNotification(null, title, body, true, null, clickCallback); }, diff --git a/browser/components/search/content/search.xml b/browser/components/search/content/search.xml index 419a7810c9d2..c236796c53eb 100644 --- a/browser/components/search/content/search.xml +++ b/browser/components/search/content/search.xml @@ -1460,7 +1460,7 @@ -