Bug 1176112 - A/B test for default browser setting UI on Windows 10. r=Gijs

This commit is contained in:
Jared Wein 2015-06-20 01:16:05 -04:00
parent 159602248b
commit 75ade8b298
5 changed files with 43 additions and 5 deletions

View File

@ -271,6 +271,7 @@ pref("general.autoScroll", true);
pref("browser.shell.checkDefaultBrowser", true);
pref("browser.shell.shortcutFavicons",true);
pref("browser.shell.mostRecentDateSetAsDefault", "");
pref("browser.shell.windows10DefaultBrowserABTest", -1);
// 0 = blank, 1 = home (browser.startup.homepage), 2 = last visited page, 3 = resume previous browser session
// The behavior of option 3 is detailed at: http://wiki.mozilla.org/Session_Restore

View File

@ -166,6 +166,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher",
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@ -1125,6 +1128,17 @@ BrowserGlue.prototype = {
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
}
if (Services.prefs.getIntPref("browser.shell.windows10DefaultBrowserABTest") == -1) {
let abTest = Math.round(Math.random());
Services.prefs.setIntPref("browser.shell.windows10DefaultBrowserABTest", abTest);
}
if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
let abTest = Services.prefs.getIntPref("browser.shell.windows10DefaultBrowserABTest");
let result = abTest * 2 + Number(isDefault);
Services.telemetry.getHistogramById("WIN_10_DEFAULT_BROWSER_AB_TEST").add(result);
}
if (shouldCheck && !isDefault && !willRecoverSession) {
Services.tm.mainThread.dispatch(function() {
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());

View File

@ -744,6 +744,7 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
}
nsresult rv = LaunchHelper(appHelperPath);
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (NS_SUCCEEDED(rv) && IsWin8OrLater()) {
if (aClaimAllTypes) {
if (IsWin10OrLater()) {
@ -761,11 +762,18 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
}
}
} else {
// Windows 10 blocks attempts to load the HTTP Handler
// association dialog, so the modern Settings dialog
// is opened with the Default Apps view loaded.
// Windows 10 blocks attempts to load the
// HTTP Handler association dialog.
if (IsWin10OrLater()) {
rv = InvokeHTTPOpenAsVerb();
if (prefs) {
int32_t abTest;
rv = prefs->GetIntPref("browser.shell.windows10DefaultBrowserABTest", &abTest);
if (NS_SUCCEEDED(rv) && abTest == 0) {
rv = InvokeHTTPOpenAsVerb();
} else {
rv = LaunchModernSettingsDialogDefaultApps();
}
}
} else {
rv = LaunchHTTPHandlerPane();
}
@ -782,7 +790,6 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
}
}
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
(void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true);
}

View File

@ -6880,6 +6880,13 @@
"kind": "boolean",
"description": "The result of the startup default desktop browser check."
},
"WIN_10_DEFAULT_BROWSER_AB_TEST": {
"alert_emails": ["jwein@mozilla.com"],
"expires_in_version": "45",
"kind": "enumerated",
"n_values": 4,
"description": "A/B test of different default browser dialogs on Windows 10 (0=openas-notdefault, 1=openas-default, 2=modernsettings-notdefault, 3=modernsettings-default)."
},
"BROWSER_IS_ASSIST_DEFAULT": {
"expires_in_version": "never",
"kind": "boolean",

View File

@ -5,6 +5,9 @@
"use strict";
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
this.EXPORTED_SYMBOLS = ["AppConstants"];
// Immutable for export.
@ -130,6 +133,12 @@ this.AppConstants = Object.freeze({
"other",
#endif
isPlatformAndVersionAtLeast(platform, version) {
let platformVersion = Services.sysinfo.getProperty("version");
return platform == this.platform &&
Services.vc.compare(platformVersion, version) >= 0;
},
MOZ_CRASHREPORTER:
#ifdef MOZ_CRASHREPORTER
true,