mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1191242 - Instrument the default browser prompt. r=dolske p=bsmedberg
This commit is contained in:
parent
65057a2bd1
commit
1860f8232c
@ -1247,21 +1247,43 @@ BrowserGlue.prototype = {
|
||||
catch (ex) { /* never mind; suppose SessionStore is broken */ }
|
||||
|
||||
// startup check, check all assoc
|
||||
let isDefault = ShellService.isDefaultBrowser(true, false);
|
||||
let isDefault = false;
|
||||
let isDefaultError = false;
|
||||
try {
|
||||
isDefault = ShellService.isDefaultBrowser(true, false);
|
||||
} catch (ex) {
|
||||
isDefaultError = true;
|
||||
}
|
||||
|
||||
if (isDefault) {
|
||||
let now = (Math.floor(Date.now() / 1000)).toString();
|
||||
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
||||
}
|
||||
|
||||
let willPrompt = shouldCheck && !isDefault && !willRecoverSession;
|
||||
|
||||
try {
|
||||
// Report default browser status on startup to telemetry
|
||||
// so we can track whether we are the default.
|
||||
Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT")
|
||||
.add(isDefault);
|
||||
Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT_ERROR")
|
||||
.add(isDefaultError);
|
||||
Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_ALWAYS_CHECK")
|
||||
.add(shouldCheck);
|
||||
let promptCount =
|
||||
Services.prefs.getIntPref("browser.shell.defaultBrowserCheckCount");
|
||||
if (willPrompt) {
|
||||
promptCount++;
|
||||
}
|
||||
Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_DIALOG_PROMPT_RAWCOUNT")
|
||||
.add(promptCount);
|
||||
Services.prefs.setIntPref("browser.shell.defaultBrowserCheckCount",
|
||||
promptCount)
|
||||
}
|
||||
catch (ex) { /* Don't break the default prompt if telemetry is broken. */ }
|
||||
|
||||
if (isDefault) {
|
||||
let now = Date.now().toString().slice(0, -3);
|
||||
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
||||
}
|
||||
|
||||
if (shouldCheck && !isDefault && !willRecoverSession) {
|
||||
if (willPrompt) {
|
||||
Services.tm.mainThread.dispatch(function() {
|
||||
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||
@ -2732,6 +2754,8 @@ ContentPermissionPrompt.prototype = {
|
||||
|
||||
let DefaultBrowserCheck = {
|
||||
get OPTIONPOPUP() { return "defaultBrowserNotificationPopup" },
|
||||
_setAsDefaultTimer: null,
|
||||
_setAsDefaultButtonClickStartTime: 0,
|
||||
|
||||
closePrompt: function(aNode) {
|
||||
if (this._notification) {
|
||||
@ -2741,6 +2765,7 @@ let DefaultBrowserCheck = {
|
||||
|
||||
setAsDefault: function() {
|
||||
let claimAllTypes = true;
|
||||
let setAsDefaultError = false;
|
||||
#ifdef XP_WIN
|
||||
try {
|
||||
// In Windows 8+, the UI for selecting default protocol is much
|
||||
@ -2753,9 +2778,45 @@ let DefaultBrowserCheck = {
|
||||
#endif
|
||||
try {
|
||||
ShellService.setDefaultBrowser(claimAllTypes, false);
|
||||
|
||||
if (this._setAsDefaultTimer) {
|
||||
this._setAsDefaultTimer.cancel();
|
||||
}
|
||||
|
||||
this._setAsDefaultButtonClickStartTime = Math.floor(Date.now() / 1000);
|
||||
this._setAsDefaultTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this._setAsDefaultTimer.init(function() {
|
||||
let isDefault = false;
|
||||
let isDefaultError = false;
|
||||
try {
|
||||
isDefault = ShellService.isDefaultBrowser(true, false);
|
||||
} catch (ex) {
|
||||
isDefaultError = true;
|
||||
}
|
||||
|
||||
let now = Math.floor(Date.now() / 1000);
|
||||
let runTime = now - this._setAsDefaultButtonClickStartTime;
|
||||
if (isDefault || runTime > 600) {
|
||||
this._setAsDefaultTimer.cancel();
|
||||
this._setAsDefaultTimer = null;
|
||||
Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_TIME_TO_COMPLETION_SECONDS")
|
||||
.add(runTime);
|
||||
}
|
||||
Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT_ERROR")
|
||||
.add(isDefaultError);
|
||||
}, 1000, Ci.nsITimer.TYPE_REPEATING_SLACK);
|
||||
} catch (ex) {
|
||||
setAsDefaultError = true;
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
// Here BROWSER_IS_USER_DEFAULT and BROWSER_SET_USER_DEFAULT_ERROR appear
|
||||
// to be inverse of each other, but that is only because this function is
|
||||
// called when the browser is set as the default. During startup we record
|
||||
// the BROWSER_IS_USER_DEFAULT value without recording BROWSER_SET_USER_DEFAULT_ERROR.
|
||||
Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT")
|
||||
.add(!setAsDefaultError);
|
||||
Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_ERROR")
|
||||
.add(setAsDefaultError);
|
||||
},
|
||||
|
||||
_createPopup: function(win, notNowStrings, neverStrings) {
|
||||
@ -2867,6 +2928,12 @@ let DefaultBrowserCheck = {
|
||||
} else if (!shouldAsk.value) {
|
||||
ShellService.shouldCheckDefaultBrowser = false;
|
||||
}
|
||||
|
||||
try {
|
||||
let resultEnum = rv * 2 + shouldAsk.value;
|
||||
Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_RESULT")
|
||||
.add(resultEnum);
|
||||
} catch (ex) { /* Don't break if Telemetry is acting up. */ }
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -7264,8 +7264,44 @@
|
||||
"BROWSER_IS_USER_DEFAULT": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The result of the startup default desktop browser check."
|
||||
},
|
||||
"BROWSER_IS_USER_DEFAULT_ERROR": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "True if the browser was unable to determine if the browser was set as default."
|
||||
},
|
||||
"BROWSER_SET_DEFAULT_DIALOG_PROMPT_RAWCOUNT": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": "250",
|
||||
"n_buckets": "15",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The number of times that a profile has seen the 'Set Default Browser' dialog."
|
||||
},
|
||||
"BROWSER_SET_DEFAULT_RESULT": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"n_values": "4",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Result of the Set Default Browser dialog (0=Use Firefox + 'Always perform check' unchecked, 1=Use Firefox + 'Always perform check' checked, 2=Not Now + 'Always perform check' unchecked, 3=Not Now + 'Always perform check' checked)"
|
||||
},
|
||||
"BROWSER_SET_DEFAULT_ERROR": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "True if the browser was unable to set Firefox as the default browser"
|
||||
},
|
||||
"BROWSER_SET_DEFAULT_TIME_TO_COMPLETION_SECONDS": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": "500",
|
||||
"n_buckets": "15",
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Time to successfully set Firefox as the default browser after clicking 'Set Firefox as Default'. Should be near-instant in some environments, others require user interaction. Measured in seconds."
|
||||
},
|
||||
"BROWSER_IS_ASSIST_DEFAULT": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "boolean",
|
||||
|
Loading…
Reference in New Issue
Block a user