Bug 1176112 - A/B test for default browser setting UI on Windows 10. r=Gijs
This commit is contained in:
@@ -271,6 +271,7 @@ pref("general.autoScroll", true);
|
|||||||
pref("browser.shell.checkDefaultBrowser", true);
|
pref("browser.shell.checkDefaultBrowser", true);
|
||||||
pref("browser.shell.shortcutFavicons",true);
|
pref("browser.shell.shortcutFavicons",true);
|
||||||
pref("browser.shell.mostRecentDateSetAsDefault", "");
|
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
|
// 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
|
// The behavior of option 3 is detailed at: http://wiki.mozilla.org/Session_Restore
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher",
|
|||||||
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
||||||
"resource://gre/modules/LightweightThemeManager.jsm");
|
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
||||||
|
"resource://gre/modules/AppConstants.jsm");
|
||||||
|
|
||||||
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
|
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
|
||||||
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
|
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
|
||||||
|
|
||||||
@@ -1125,6 +1128,17 @@ BrowserGlue.prototype = {
|
|||||||
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
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) {
|
if (shouldCheck && !isDefault && !willRecoverSession) {
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.mainThread.dispatch(function() {
|
||||||
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
||||||
|
|||||||
@@ -744,6 +744,7 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = LaunchHelper(appHelperPath);
|
nsresult rv = LaunchHelper(appHelperPath);
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
if (NS_SUCCEEDED(rv) && IsWin8OrLater()) {
|
if (NS_SUCCEEDED(rv) && IsWin8OrLater()) {
|
||||||
if (aClaimAllTypes) {
|
if (aClaimAllTypes) {
|
||||||
if (IsWin10OrLater()) {
|
if (IsWin10OrLater()) {
|
||||||
@@ -761,11 +762,18 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Windows 10 blocks attempts to load the HTTP Handler
|
// Windows 10 blocks attempts to load the
|
||||||
// association dialog, so the modern Settings dialog
|
// HTTP Handler association dialog.
|
||||||
// is opened with the Default Apps view loaded.
|
|
||||||
if (IsWin10OrLater()) {
|
if (IsWin10OrLater()) {
|
||||||
|
if (prefs) {
|
||||||
|
int32_t abTest;
|
||||||
|
rv = prefs->GetIntPref("browser.shell.windows10DefaultBrowserABTest", &abTest);
|
||||||
|
if (NS_SUCCEEDED(rv) && abTest == 0) {
|
||||||
rv = InvokeHTTPOpenAsVerb();
|
rv = InvokeHTTPOpenAsVerb();
|
||||||
|
} else {
|
||||||
|
rv = LaunchModernSettingsDialogDefaultApps();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rv = LaunchHTTPHandlerPane();
|
rv = LaunchHTTPHandlerPane();
|
||||||
}
|
}
|
||||||
@@ -782,7 +790,6 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
||||||
if (prefs) {
|
if (prefs) {
|
||||||
(void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true);
|
(void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6880,6 +6880,13 @@
|
|||||||
"kind": "boolean",
|
"kind": "boolean",
|
||||||
"description": "The result of the startup default desktop browser check."
|
"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": {
|
"BROWSER_IS_ASSIST_DEFAULT": {
|
||||||
"expires_in_version": "never",
|
"expires_in_version": "never",
|
||||||
"kind": "boolean",
|
"kind": "boolean",
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
this.EXPORTED_SYMBOLS = ["AppConstants"];
|
this.EXPORTED_SYMBOLS = ["AppConstants"];
|
||||||
|
|
||||||
// Immutable for export.
|
// Immutable for export.
|
||||||
@@ -130,6 +133,12 @@ this.AppConstants = Object.freeze({
|
|||||||
"other",
|
"other",
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
isPlatformAndVersionAtLeast(platform, version) {
|
||||||
|
let platformVersion = Services.sysinfo.getProperty("version");
|
||||||
|
return platform == this.platform &&
|
||||||
|
Services.vc.compare(platformVersion, version) >= 0;
|
||||||
|
},
|
||||||
|
|
||||||
MOZ_CRASHREPORTER:
|
MOZ_CRASHREPORTER:
|
||||||
#ifdef MOZ_CRASHREPORTER
|
#ifdef MOZ_CRASHREPORTER
|
||||||
true,
|
true,
|
||||||
|
|||||||
Reference in New Issue
Block a user