Bug 1330315 - Add a telemetry probe to track how the Preferences are opened, r=mconley

MozReview-Commit-ID: GfuGF4v30pI

--HG--
extra : rebase_source : e8b4399bd1e3fc5e5b220e80d6694c00a4b7e482
This commit is contained in:
Fischer.json 2017-05-09 10:43:48 -04:00
Родитель f8427acdf3
Коммит c0472057e4
20 изменённых файлов: 57 добавлений и 36 удалений

Просмотреть файл

@ -22,7 +22,7 @@
used as they only apply to Cocoa widget builds. All version of Firefox
through Firefox 2 will use Carbon widgets. -->
<menupopup id="menu_ToolsPopup">
<menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="key_preferencesCmdMac" oncommand="openPreferences();"/>
<menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="key_preferencesCmdMac" oncommand="openPreferences(undefined, {origin: 'commandLineLegacy'});"/>
<menuitem id="menu_mac_services" label="&servicesMenuMac.label;"/>
<menuitem id="menu_mac_hide_app" label="&hideThisAppCmdMac2.label;" key="key_hideThisAppCmdMac"/>
<menuitem id="menu_mac_hide_others" label="&hideOtherAppsCmdMac.label;" key="key_hideOtherAppsCmdMac"/>

Просмотреть файл

@ -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"});
}
},
}];

Просмотреть файл

@ -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 = {

Просмотреть файл

@ -185,7 +185,7 @@
<menuitem id="menu_preferences"
label="&preferencesCmdUnix.label;"
accesskey="&preferencesCmdUnix.accesskey;"
oncommand="openPreferences();"/>
oncommand="openPreferences(undefined, {origin: 'menubar'});"/>
#endif
#endif
</menupopup>
@ -532,7 +532,7 @@
<menuitem id="menu_preferences"
label="&preferencesCmd2.label;"
accesskey="&preferencesCmd2.accesskey;"
oncommand="openPreferences();"/>
oncommand="openPreferences(undefined, {origin: 'menubar'});"/>
#endif
</menupopup>
</menu>

Просмотреть файл

@ -93,7 +93,7 @@
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
<command id="Browser:RestoreLastSession" oncommand="restoreLastSession();" disabled="true"/>
<command id="Browser:NewUserContextTab" oncommand="openNewUserContextTab(event.sourceEvent);"/>
<command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers');"/>
<command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers', {origin: 'ContainersCommand'});"/>
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>

Просмотреть файл

@ -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() {

Просмотреть файл

@ -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"});
}
},

Просмотреть файл

@ -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 });
}
/**

Просмотреть файл

@ -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") {

Просмотреть файл

@ -71,7 +71,7 @@ SearchProvider.prototype = {
manageEngines(browser) {
const browserWin = browser.ownerGlobal;
browserWin.openPreferences("paneGeneral");
browserWin.openPreferences("paneGeneral", { origin: "contentSearch" });
},
async asyncGetState() {

Просмотреть файл

@ -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))

Просмотреть файл

@ -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);
},

Просмотреть файл

@ -1460,7 +1460,7 @@
<method name="showSettings">
<body><![CDATA[
BrowserUITelemetry.countSearchSettingsEvent(this.telemetryOrigin);
openPreferences("general-search");
openPreferences("general-search", {origin: "contentSearch"});
// If the preference tab was already selected, the panel doesn't
// close itself automatically.
this.popup.hidePopup();

Просмотреть файл

@ -126,7 +126,7 @@
label="&translation.options.neverForSite.label;"
accesskey="&translation.options.neverForSite.accesskey;"/>
<xul:menuseparator/>
<xul:menuitem oncommand="openPreferences('paneGeneral');"
<xul:menuitem oncommand="openPreferences('paneGeneral', {origin:'translationInfobar'});"
label="&translation.options.preferences.label;"
accesskey="&translation.options.preferences.accesskey;"/>
<xul:menuitem class="subviewbutton panel-subview-footer"

Просмотреть файл

@ -536,7 +536,7 @@ this.UITour = {
return false;
}
window.openPreferences(data.pane);
window.openPreferences(data.pane, { origin: "UITour" });
break;
}

Просмотреть файл

@ -138,11 +138,11 @@ var AboutHome = {
break;
case "AboutHome:Sync":
window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" } });
window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" }, origin: "aboutHome" });
break;
case "AboutHome:Settings":
window.openPreferences();
window.openPreferences(undefined, {origin: "aboutHome"} );
break;
case "AboutHome:RequestUpdate":

Просмотреть файл

@ -414,7 +414,7 @@ this.ContentSearch = {
_onMessageManageEngines(msg, data) {
let browserWin = msg.target.ownerGlobal;
browserWin.openPreferences("paneGeneral");
browserWin.openPreferences("paneGeneral", {origin: "contentSearch"});
},
async _onMessageGetSuggestions(msg, data) {

Просмотреть файл

@ -6389,6 +6389,16 @@
"releaseChannelCollection": "opt-out",
"description": "Count how often each preference category is opened."
},
"FX_PREFERENCES_OPENED_VIA": {
"record_in_processes": ["main", "content"],
"bug_numbers": [1330315],
"alert_emails": ["jaws@mozilla.com"],
"expires_in_version": "59",
"kind": "categorical",
"labels": ["aboutHome", "aboutTelemetry", "browserMedia", "commandLine", "commandLineLegacy", "ContainersCommand", "contentSearch", "dataReporting", "doorhanger", "devDisconnectedAlert", "experimentsOpenPref", "fxa", "fxaSignedin", "fxaError", "offlineApps", "prefserviceDefaults", "preferencesButton", "paneSync", "storagePressure", "translationInfobar", "UITour", "menubar", "notifOpenSettings", "other"],
"releaseChannelCollection": "opt-out",
"description":"Count how the Preferences are opened."
},
"INPUT_EVENT_RESPONSE_MS": {
"record_in_processes": ["main", "content"],
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],

Просмотреть файл

@ -245,9 +245,9 @@ var Settings = {
// The advanced subpanes are only supported in the old organization, which will
// be removed by bug 1349689.
if (Preferences.get("browser.preferences.useOldOrganization", false)) {
mainWindow.openAdvancedPreferences("dataChoicesTab");
mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "aboutTelemetry"});
} else {
mainWindow.openPreferences("paneAdvanced");
mainWindow.openPreferences("paneAdvanced", {origin: "aboutTelemetry"});
}
}
});

Просмотреть файл

@ -1552,9 +1552,9 @@ var gViewController = {
// The advanced subpanes are only supported in the old organization, which will
// be removed by bug 1349689.
if (Preferences.get("browser.preferences.useOldOrganization", false)) {
mainWindow.openAdvancedPreferences("dataChoicesTab");
mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "experimentsOpenPref"});
} else {
mainWindow.openPreferences("paneAdvanced");
mainWindow.openPreferences("paneAdvanced", {origin: "experimentsOpenPref"});
}
},
},