mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1275114 - add telemetry to determine how to make browser choices when automatically migrating on first profile startup, r=bsmedberg,Dolske
MozReview-Commit-ID: zVmKTBzAS9 --HG-- extra : rebase_source : 3a311a15534ffe769df550ca4fac320c6f6131f2
This commit is contained in:
parent
538483cae7
commit
b46aa62ca8
@ -50,40 +50,6 @@ function getMigrationBundle() {
|
||||
return gMigrationBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out what is the default browser, and if there is a migrator
|
||||
* for it, return that migrator's internal name.
|
||||
* For the time being, the "internal name" of a migrator is its contract-id
|
||||
* trailer (e.g. ie for @mozilla.org/profile/migrator;1?app=browser&type=ie),
|
||||
* but it will soon be exposed properly.
|
||||
*/
|
||||
function getMigratorKeyForDefaultBrowser() {
|
||||
// Canary uses the same description as Chrome so we can't distinguish them.
|
||||
const APP_DESC_TO_KEY = {
|
||||
"Internet Explorer": "ie",
|
||||
"Safari": "safari",
|
||||
"Firefox": "firefox",
|
||||
"Google Chrome": "chrome", // Windows, Linux
|
||||
"Chrome": "chrome", // OS X
|
||||
"Chromium": "chromium", // Windows, OS X
|
||||
"Chromium Web Browser": "chromium", // Linux
|
||||
"360\u5b89\u5168\u6d4f\u89c8\u5668": "360se",
|
||||
};
|
||||
|
||||
let browserDesc = "";
|
||||
try {
|
||||
let browserDesc =
|
||||
Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||
getService(Ci.nsIExternalProtocolService).
|
||||
getApplicationDescription("http");
|
||||
return APP_DESC_TO_KEY[browserDesc] || "";
|
||||
}
|
||||
catch(ex) {
|
||||
Cu.reportError("Could not detect default browser: " + ex);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared prototype for migrators, implementing nsIBrowserProfileMigrator.
|
||||
*
|
||||
@ -536,6 +502,40 @@ this.MigrationUtils = Object.freeze({
|
||||
} catch (ex) { Cu.reportError(ex); return null }
|
||||
},
|
||||
|
||||
/**
|
||||
* Figure out what is the default browser, and if there is a migrator
|
||||
* for it, return that migrator's internal name.
|
||||
* For the time being, the "internal name" of a migrator is its contract-id
|
||||
* trailer (e.g. ie for @mozilla.org/profile/migrator;1?app=browser&type=ie),
|
||||
* but it will soon be exposed properly.
|
||||
*/
|
||||
getMigratorKeyForDefaultBrowser() {
|
||||
// Canary uses the same description as Chrome so we can't distinguish them.
|
||||
const APP_DESC_TO_KEY = {
|
||||
"Internet Explorer": "ie",
|
||||
"Safari": "safari",
|
||||
"Firefox": "firefox",
|
||||
"Google Chrome": "chrome", // Windows, Linux
|
||||
"Chrome": "chrome", // OS X
|
||||
"Chromium": "chromium", // Windows, OS X
|
||||
"Chromium Web Browser": "chromium", // Linux
|
||||
"360\u5b89\u5168\u6d4f\u89c8\u5668": "360se",
|
||||
};
|
||||
|
||||
let browserDesc = "";
|
||||
try {
|
||||
let browserDesc =
|
||||
Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||
getService(Ci.nsIExternalProtocolService).
|
||||
getApplicationDescription("http");
|
||||
return APP_DESC_TO_KEY[browserDesc] || "";
|
||||
}
|
||||
catch(ex) {
|
||||
Cu.reportError("Could not detect default browser: " + ex);
|
||||
}
|
||||
return "";
|
||||
},
|
||||
|
||||
// Whether or not we're in the process of startup migration
|
||||
get isStartupMigration() {
|
||||
return gProfileStartup != null;
|
||||
@ -676,7 +676,7 @@ this.MigrationUtils = Object.freeze({
|
||||
skipSourcePage = true;
|
||||
}
|
||||
else {
|
||||
let defaultBrowserKey = getMigratorKeyForDefaultBrowser();
|
||||
let defaultBrowserKey = this.getMigratorKeyForDefaultBrowser();
|
||||
if (defaultBrowserKey) {
|
||||
migrator = this.getMigrator(defaultBrowserKey);
|
||||
if (migrator)
|
||||
|
@ -34,6 +34,7 @@ var MigrationWizard = {
|
||||
let args = window.arguments;
|
||||
let entryPointId = args[0] || MigrationUtils.MIGRATION_ENTRYPOINT_UNKNOWN;
|
||||
Services.telemetry.getHistogramById("FX_MIGRATION_ENTRY_POINT").add(entryPointId);
|
||||
this.isInitialMigration = entryPointId == MigrationUtils.MIGRATION_ENTRYPOINT_FIRSTRUN;
|
||||
|
||||
if (args.length > 1) {
|
||||
this._source = args[1];
|
||||
@ -85,6 +86,7 @@ var MigrationWizard = {
|
||||
|
||||
// Figure out what source apps are are available to import from:
|
||||
var group = document.getElementById("importSourceGroup");
|
||||
var availableMigratorCount = 0;
|
||||
for (var i = 0; i < group.childNodes.length; ++i) {
|
||||
var migratorKey = group.childNodes[i].id;
|
||||
if (migratorKey != "nothing") {
|
||||
@ -94,12 +96,22 @@ var MigrationWizard = {
|
||||
// one, or if it is the migrator that was passed to us.
|
||||
if (!selectedMigrator || this._source == migratorKey)
|
||||
selectedMigrator = group.childNodes[i];
|
||||
availableMigratorCount++;
|
||||
} else {
|
||||
// Hide this option
|
||||
group.childNodes[i].hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.isInitialMigration) {
|
||||
Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_BROWSER_COUNT")
|
||||
.add(availableMigratorCount);
|
||||
let defaultBrowser = MigrationUtils.getMigratorKeyForDefaultBrowser();
|
||||
// This will record 0 for unknown default browser IDs.
|
||||
defaultBrowser = MigrationUtils.getSourceIdForTelemetry(defaultBrowser);
|
||||
Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_EXISTING_DEFAULT_BROWSER")
|
||||
.add(defaultBrowser);
|
||||
}
|
||||
|
||||
group.addEventListener("command", toggleCloseBrowserWarning);
|
||||
|
||||
|
@ -4426,6 +4426,24 @@
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Whether the homepage was imported during browser migration. Only available on release builds during firstrun."
|
||||
},
|
||||
"FX_STARTUP_MIGRATION_BROWSER_COUNT": {
|
||||
"bug_numbers": [1275114],
|
||||
"alert_emails": ["gijs@mozilla.com"],
|
||||
"expires_in_version": "53",
|
||||
"kind": "enumerated",
|
||||
"n_values": 15,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Number of browsers from which the user could migrate on initial profile migration. Only available on release builds during firstrun."
|
||||
},
|
||||
"FX_STARTUP_MIGRATION_EXISTING_DEFAULT_BROWSER": {
|
||||
"bug_numbers": [1275114],
|
||||
"alert_emails": ["gijs@mozilla.com"],
|
||||
"expires_in_version": "53",
|
||||
"kind": "enumerated",
|
||||
"n_values": 15,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The browser that was the default on the initial profile migration. The values correspond to the internal browser ID (see MigrationUtils.jsm)"
|
||||
},
|
||||
"INPUT_EVENT_RESPONSE_MS": {
|
||||
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
|
||||
"bug_numbers": [1235908],
|
||||
|
Loading…
Reference in New Issue
Block a user