Bug 1330315 - Add a telemetry probe to track how the Preferences are opened. r?jaws
MozReview-Commit-ID: KpqCkoyxTaD
--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -59,18 +59,17 @@ var gDataNotificationInfoBar = {
this._actionTaken = false;
let buttons = [{
label: gNavigatorBundle.getString("dataReportingNotification.button.label"),
accessKey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"),
popup: null,
callback: () => {
this._actionTaken = true;
- var extra = {origin: "dataReporting"};
- window.openAdvancedPreferences("dataChoicesTab", extra);
+ window.openAdvancedPreferences("dataChoicesTab", {origin: "dataReporting"});
},
}];
this._log.info("Creating data reporting policy notification.");
this._notificationBox.appendNotification(
message,
this._DATA_REPORTING_NOTIFICATION,
null,
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -275,30 +275,27 @@ var gFxAccounts = {
updateWithUserData(null);
});
},
onMenuPanelCommand() {
switch (this.panelUIFooter.getAttribute("fxastatus")) {
case "signedin":
- var extra = {origin: "fxaSignedin"};
- this.openPreferences(undefined, extra);
+ this.openPreferences(undefined, {origin: "fxaSignedin"});
break;
case "error":
if (this.panelUIFooter.getAttribute("unverified")) {
- var extra = {origin: "fxaError"};
- this.openPreferences(undefined, extra);
+ this.openPreferences(undefined, {origin: "fxaError"});
} else {
this.openSignInAgainPage("menupanel");
}
break;
default:
- var extra = {origin: "fxa"};
- this.openPreferences(undefined, extra);
+ this.openPreferences(undefined, {origin: "fxa"});
break;
}
PanelUI.hide();
},
openPreferences() {
openPreferences("paneSync", { urlParams: { entrypoint: "menupanel" } });
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -162,17 +162,17 @@ var gEMEHandler = {
Services.prefs.setBoolPref(firstPlayPref, true);
} else {
document.getElementById(anchorId).removeAttribute("firstplay");
}
let mainAction = {
label: gNavigatorBundle.getString(btnLabelId),
accessKey: gNavigatorBundle.getString(btnAccessKeyId),
- callback() {openPreferences("paneContent", var extra = {origin: "browserMedia"); },
+ callback() { openPreferences("paneContent", {origin: "browserMedia"}) },
dismiss: true
};
let options = {
dismissed: true,
eventCallback: aTopic => aTopic == "swapping",
learnMoreURL: Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content",
};
PopupNotifications.show(browser, "drmContentPlaying", message, anchorId, mainAction, null, options);
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -180,17 +180,17 @@
accesskey="&bidiSwitchTextDirectionItem.accesskey;"
hidden="true"/>
#ifdef XP_UNIX
#ifndef XP_MACOSX
<menuseparator/>
<menuitem id="menu_preferences"
label="&preferencesCmdUnix.label;"
accesskey="&preferencesCmdUnix.accesskey;"
- oncommand="openPreferences();"/>
+ oncommand="openPreferences(undefined, {origin: "preferencesButton"});"/>
#endif
#endif
</menupopup>
</menu>
<menu id="view-menu" label="&viewMenu.label;"
accesskey="&viewMenu.accesskey;">
<menupopup id="menu_viewPopup"
@@ -531,17 +531,17 @@
<menupopup id="menu_mirrorTab-popup"
onpopupshowing="populateMirrorTabMenu(this)"/>
</menu>
#ifndef XP_UNIX
<menuseparator id="prefSep"/>
<menuitem id="menu_preferences"
label="&preferencesCmd2.label;"
accesskey="&preferencesCmd2.accesskey;"
- oncommand="openPreferences();"/>
+ oncommand="openPreferences(undefined, {origin: "preferencesButton"});"/>
#endif
</menupopup>
</menu>
#ifdef XP_MACOSX
<menu id="windowMenu" />
#endif
<menu id="helpMenu" />
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -88,17 +88,17 @@
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
<command id="cmd_gestureRotateLeft" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
<command id="cmd_gestureRotateRight" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
<command id="cmd_gestureRotateEnd" oncommand="gGestureSupport.rotateEnd()"/>
<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','FX_PREFERENCES_OPENED_VIA');"/>
+ <command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers', {origin: 'paneContainers'});"/>
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing"
oncommand="OpenBrowserWindow({private: true});"/>
#ifdef E10S_TESTING_ONLY
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6151,18 +6151,17 @@ var OfflineApps = {
if (browser && browser.messageManager) {
browser.messageManager.sendAsyncMessage("OfflineApps:StartFetching", {
docId,
});
}
},
manage() {
- var extra = {origin: "offlineApps"};
- openAdvancedPreferences("networkTab", extra);
+ openAdvancedPreferences("networkTab", {origin: "offlineApps"});
},
receiveMessage(msg) {
switch (msg.name) {
case "OfflineApps:CheckUsage":
let uri = makeURI(msg.data.uri);
if (this._usedMoreThanWarnQuota(uri)) {
this.warnUsage(msg.target, uri);
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -668,18 +668,17 @@ function openAboutDialog() {
} else {
features += "centerscreen,dependent,dialog=no";
}
window.openDialog("chrome://browser/content/aboutDialog.xul", "", features);
}
function openPreferences(paneID, extraArgs) {
- if (extraArgs.origin) {
- Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add(extraArgs.origin); }
+ if (extraArgs.origin) { Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add(extraArgs.origin); }
function switchToAdvancedSubPane(doc) {
if (extraArgs && extraArgs["advancedTab"]) {
let advancedPaneTabs = doc.getElementById("advancedPrefs");
advancedPaneTabs.selectedTab = doc.getElementById(extraArgs["advancedTab"]);
}
}
// This function is duplicated from preferences.js.
@@ -735,18 +734,19 @@ function openPreferences(paneID, extraAr
} else {
if (paneID) {
browser.contentWindow.gotoPref(paneID);
}
switchToAdvancedSubPane(browser.contentDocument);
}
}
-function openAdvancedPreferences(tabID) {
+function openAdvancedPreferences(tabID, extraArgs) {
openPreferences("paneAdvanced", { "advancedTab" : tabID });
+ if (extraArgs.origin) { Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add(extraArgs.origin); }
}
/**
* Opens the troubleshooting information (about:support) page for this version
* of the application.
*/
function openTroubleshootingPage() {
openUILinkIn("about:support", "tab");
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -1183,18 +1183,17 @@ const CustomizableWidgets = [
]),
}];
let preferencesButton = {
id: "preferences-button",
defaultArea: CustomizableUI.AREA_PANEL,
onCommand(aEvent) {
let win = aEvent.target.ownerGlobal;
- var extra = {origin: "preferencesButton"};
- win.openPreferences(undefined, extra);
+ win.openPreferences(undefined, {origin: "preferencesButton"});
}
};
if (AppConstants.platform == "win") {
preferencesButton.label = "preferences-button.labelWin";
preferencesButton.tooltiptext = "preferences-button.tooltipWin2";
} else if (AppConstants.platform == "macosx") {
preferencesButton.tooltiptext = "preferences-button.tooltiptext.withshortcut";
preferencesButton.shortcutId = "key_preferencesCmdMac";
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -354,18 +354,17 @@ nsBrowserContentHandler.prototype = {
}
var chromeParam = cmdLine.handleFlagWithParam("chrome", false);
if (chromeParam) {
// Handle old preference dialog URLs.
if (chromeParam == "chrome://browser/content/pref/pref.xul" ||
chromeParam == "chrome://browser/content/preferences/preferences.xul") {
- var extra = {origin: "commandLineLegacy"};
- openPreferences(undefined, extra);
+ openPreferences(undefined, {origin: "commandLineLegacy"});
cmdLine.preventDefault = true;
} else try {
let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
let isLocal = uri => {
let localSchemes = new Set(["chrome", "file", "resource"]);
if (uri instanceof Components.interfaces.nsINestedURI) {
uri = uri.QueryInterface(Components.interfaces.nsINestedURI).innerMostURI;
}
@@ -380,18 +379,17 @@ nsBrowserContentHandler.prototype = {
dump("*** Preventing load of web URI as chrome\n");
dump(" If you're trying to load a webpage, do not pass --chrome.\n");
}
} catch (e) {
Components.utils.reportError(e);
}
}
if (cmdLine.handleFlag("preferences", false)) {
- var extra = {origin: "commandLine"};
- openPreferences(undefined, extra);
+ openPreferences(undefined, {origin: "commandLine"});
cmdLine.preventDefault = true;
}
if (cmdLine.handleFlag("silent", false))
cmdLine.preventDefault = true;
try {
var privateWindowParam = cmdLine.handleFlagWithParam("private-window", false);
if (privateWindowParam) {
--- a/browser/modules/AboutHome.jsm
+++ b/browser/modules/AboutHome.jsm
@@ -140,18 +140,17 @@ var AboutHome = {
window.BrowserOpenAddonsMgr();
break;
case "AboutHome:Sync":
window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" } });
break;
case "AboutHome:Settings":
- var extra = {origin: "aboutHome"}
- window.openPreferences(undefined, extra);
+ window.openPreferences(undefined, {origin: "aboutHome"});
break;
case "AboutHome:RequestUpdate":
this.sendAboutHomeData(aMessage.target);
break;
case "AboutHome:MaybeShowAutoMigrationUndoNotification":
AutoMigrate.maybeShowUndoNotification(aMessage.target);
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5202,17 +5202,17 @@
"releaseChannelCollection": "opt-out",
"description": "Count how often each preference category is opened."
},
"FX_PREFERENCES_OPENED_VIA": {
"bug_numbers": [11330315],
"alert_emails": ["jaws@mozilla.com"],
"expires_in_version": "57",
"kind": "categorical",
- "labels": ["preferencesButton", "fxaSignedin", "fxaError", "aboutHome", "dataReporting", "offlineApps", "aboutTelemetry", "commandLine", "commandLineLegacy", "fxa", "browserMedia"],
+ "labels": ["preferencesButton", "fxaSignedin", "fxaError", "aboutHome", "dataReporting", "offlineApps", "aboutTelemetry", "commandLine", "commandLineLegacy", "fxa", "browserMedia", "paneSearch"],
"releaseChannelCollection": "opt-out",
"description":"Count how the Preferences are opened."
},
"INPUT_EVENT_RESPONSE_MS": {
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
"bug_numbers": [1235908],
"expires_in_version": "never",
"kind": "exponential",
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -236,18 +236,17 @@ var Settings = {
Cu.import("resource://gre/modules/Messaging.jsm");
EventDispatcher.instance.sendRequest({
type: "Settings:Show",
resource: "preferences_privacy",
});
} else {
// Show the data choices preferences on desktop.
let mainWindow = getMainWindowWithPreferencesPane();
- var extra = {origin: "aboutTelemetry"};
- mainWindow.openAdvancedPreferences("dataChoicesTab", extra);
+ mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "aboutTelemetry"});
}
});
}
},
detachObservers() {
for (let setting of this.SETTINGS) {
Preferences.ignore(setting.pref, this.render, this);
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1,9 +1,9 @@
-1;4601;0c/* This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* import-globals-from ../../../content/contentAreaUtils.js */
/* globals XMLStylesheetProcessingInstruction */
/* exported UPDATES_RELEASENOTES_TRANSFORMFILE, XMLURI_PARSE_ERROR, loadView */
@@ -1450,20 +1450,17 @@ var gViewController = {
},
cmd_experimentsOpenTelemetryPreferences: {
isEnabled() {
return !!getMainWindowWithPreferencesPane();
},
doCommand() {
let mainWindow = getMainWindowWithPreferencesPane();
- mainWindow.openAdvancedPreferences("dataChoicesTab");
- Services.telemetry
- .getHistogramById("FX_PREFERENCES_OPENED_VIA")
- .add("aboutTelemetry");
+ mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "aboutTelemetry"});
},
},
cmd_showUnsignedExtensions: {
isEnabled() {
return true;
},
doCommand() {