Backed out changeset 82c63072cba7 (bug 1304446) for browser-chrome bustages, e.g. browser_aboutHome.js | histogram with key should be recorded - false == true. r=backout

This commit is contained in:
Sebastian Hengst 2016-10-05 20:24:27 +02:00
parent 846ea19f2f
commit 9bc54244b6
2 changed files with 22 additions and 51 deletions

View File

@ -17,7 +17,6 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["AddonWatcher", "resource://gre/modules/AddonWatcher.jsm"],
["AppConstants", "resource://gre/modules/AppConstants.jsm"],
["BrowserUITelemetry", "resource:///modules/BrowserUITelemetry.jsm"],
["BrowserUsageTelemetry", "resource:///modules/BrowserUsageTelemetry.jsm"],
["BrowserUtils", "resource://gre/modules/BrowserUtils.jsm"],
["CastingApps", "resource:///modules/CastingApps.jsm"],
["CharsetMenu", "resource://gre/modules/CharsetMenu.jsm"],
@ -3774,13 +3773,16 @@ const BrowserSearch = {
openUILinkIn(this.searchEnginesURL, where);
},
get _isExtendedTelemetryEnabled() {
return Services.prefs.getBoolPref("toolkit.telemetry.enabled");
},
_getSearchEngineId: function (engine) {
if (engine && engine.identifier) {
return engine.identifier;
}
if (!engine || (engine.name === undefined) ||
!Services.prefs.getBoolPref("toolkit.telemetry.enabled"))
if (!engine || (engine.name === undefined) || !this._isExtendedTelemetryEnabled)
return "other";
return "other-" + engine.name;
@ -3802,12 +3804,25 @@ const BrowserSearch = {
* item was in the suggestion list and how the user selected it.
*/
recordSearchInTelemetry: function (engine, source, selection) {
const SOURCES = [
"abouthome",
"contextmenu",
"newtab",
"searchbar",
"urlbar",
];
BrowserUITelemetry.countSearchEvent(source, null, selection);
try {
BrowserUsageTelemetry.recordSearch(engine, source);
} catch (ex) {
Cu.reportError(ex);
if (SOURCES.indexOf(source) == -1) {
Cu.reportError("Unknown source for search: " + source);
return;
}
let countId = this._getSearchEngineId(engine) + "." + source;
let count = Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS");
count.add(countId);
},
recordOneoffSearchInTelemetry: function (engine, source, type, where) {

View File

@ -32,15 +32,6 @@ const WINDOW_OPEN_EVENT_COUNT_SCALAR_NAME = "browser.engagement.window_open_even
const UNIQUE_DOMAINS_COUNT_SCALAR_NAME = "browser.engagement.unique_domains_count";
const TOTAL_URI_COUNT_SCALAR_NAME = "browser.engagement.total_uri_count";
// A list of known search origins.
const KNOWN_SEARCH_SOURCES = [
"abouthome",
"contextmenu",
"newtab",
"searchbar",
"urlbar",
];
function getOpenTabsAndWinsCounts() {
let tabCount = 0;
let winCount = 0;
@ -55,18 +46,6 @@ function getOpenTabsAndWinsCounts() {
return { tabCount, winCount };
}
function getSearchEngineId(engine) {
// Due to bug 1222070, we can't directly check Services.telemetry.canRecordExtended
// here.
const extendedTelemetry = Services.prefs.getBoolPref("toolkit.telemetry.enabled");
if (!engine ||
(!engine.identifier && !engine.name) ||
!extendedTelemetry) {
return "other";
}
return engine.identifier || "other-" + engine.name;
}
let URICountListener = {
// A set containing the visited domains, see bug 1271310.
_domainSet: new Set(),
@ -210,29 +189,6 @@ let BrowserUsageTelemetry = {
}
},
/**
* The main entry point for recording search related Telemetry. This includes
* search counts and engagement measurements.
*
* Telemetry records only search counts per engine and action origin, but
* nothing pertaining to the search contents themselves.
*
* @param engine
* (nsISearchEngine) The engine handling the search.
* @param source
* (string) Where the search originated from. See
* KNOWN_SEARCH_SOURCES for allowed values.
* @throws if source is not in the known sources list.
*/
recordSearch(engine, source) {
if (!KNOWN_SEARCH_SOURCES.includes(source)) {
throw new Error("Unknown source for search: " + source);
}
let countId = getSearchEngineId(engine) + "." + source;
Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").add(countId);
},
/**
* This gets called shortly after the SessionStore has finished restoring
* windows and tabs. It counts the open tabs and adds listeners to all the