зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1101491 - Properly record SEARCH_DEFAULT_ENGINE on search service init and change events. r=mconley
This commit is contained in:
Родитель
f18311f96b
Коммит
3e7955b253
|
@ -403,33 +403,6 @@ const gSessionHistoryObserver = {
|
|||
}
|
||||
};
|
||||
|
||||
const gGatherTelemetryObserver = {
|
||||
observe: function(subject, topic, data) {
|
||||
if (topic != "gather-telemetry") {
|
||||
return;
|
||||
}
|
||||
|
||||
let engine;
|
||||
try {
|
||||
engine = Services.search.defaultEngine;
|
||||
} catch (e) {}
|
||||
let name;
|
||||
|
||||
if (!engine) {
|
||||
name = "NONE";
|
||||
} else if (engine.identifier) {
|
||||
name = engine.identifier;
|
||||
} else if (engine.name) {
|
||||
name = "other-" + engine.name;
|
||||
} else {
|
||||
name = "UNDEFINED";
|
||||
}
|
||||
|
||||
let engines = Services.telemetry.getKeyedHistogramById("SEARCH_DEFAULT_ENGINE");
|
||||
engines.add(name, true)
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Given a starting docshell and a URI to look up, find the docshell the URI
|
||||
* is loaded in.
|
||||
|
@ -1213,7 +1186,6 @@ var gBrowserInit = {
|
|||
Services.obs.addObserver(gXPInstallObserver, "addon-install-blocked", false);
|
||||
Services.obs.addObserver(gXPInstallObserver, "addon-install-failed", false);
|
||||
Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false);
|
||||
Services.obs.addObserver(gGatherTelemetryObserver, "gather-telemetry", false);
|
||||
window.messageManager.addMessageListener("Browser:URIFixup", gKeywordURIFixup);
|
||||
window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad);
|
||||
|
||||
|
@ -1534,7 +1506,6 @@ var gBrowserInit = {
|
|||
Services.obs.removeObserver(gXPInstallObserver, "addon-install-blocked");
|
||||
Services.obs.removeObserver(gXPInstallObserver, "addon-install-failed");
|
||||
Services.obs.removeObserver(gXPInstallObserver, "addon-install-complete");
|
||||
Services.obs.removeObserver(gGatherTelemetryObserver, "gather-telemetry");
|
||||
window.messageManager.removeMessageListener("Browser:URIFixup", gKeywordURIFixup);
|
||||
window.messageManager.removeMessageListener("Browser:LoadURI", RedirectLoad);
|
||||
|
||||
|
|
|
@ -144,6 +144,28 @@ const BOOKMARKS_BACKUP_MIN_INTERVAL_DAYS = 1;
|
|||
// days we will try to create a new one more aggressively.
|
||||
const BOOKMARKS_BACKUP_MAX_INTERVAL_DAYS = 3;
|
||||
|
||||
// Record the current default search engine in Telemetry.
|
||||
function recordDefaultSearchEngine() {
|
||||
let engine;
|
||||
try {
|
||||
engine = Services.search.defaultEngine;
|
||||
} catch (e) {}
|
||||
let name;
|
||||
|
||||
if (!engine) {
|
||||
name = "NONE";
|
||||
} else if (engine.identifier) {
|
||||
name = engine.identifier;
|
||||
} else if (engine.name) {
|
||||
name = "other-" + engine.name;
|
||||
} else {
|
||||
name = "UNDEFINED";
|
||||
}
|
||||
|
||||
let engines = Services.telemetry.getKeyedHistogramById("SEARCH_DEFAULT_ENGINE");
|
||||
engines.add(name, true)
|
||||
}
|
||||
|
||||
// Factory object
|
||||
const BrowserGlueServiceFactory = {
|
||||
_instance: null,
|
||||
|
@ -402,12 +424,14 @@ BrowserGlue.prototype = {
|
|||
ss.defaultEngine = ss.currentEngine;
|
||||
else
|
||||
ss.currentEngine = ss.defaultEngine;
|
||||
recordDefaultSearchEngine();
|
||||
break;
|
||||
case "browser-search-service":
|
||||
if (data != "init-complete")
|
||||
return;
|
||||
Services.obs.removeObserver(this, "browser-search-service");
|
||||
this._syncSearchEngines();
|
||||
recordDefaultSearchEngine();
|
||||
break;
|
||||
#ifdef NIGHTLY_BUILD
|
||||
case "nsPref:changed":
|
||||
|
|
Загрузка…
Ссылка в новой задаче