зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1582740
- Default the 'Always check' checkbox to disabled until we load the default browser state to prevent accidental user changes. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D62479 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a68651c6ab
Коммит
d701c66a79
|
@ -40,6 +40,7 @@
|
|||
#ifdef HAVE_SHELL_SERVICE
|
||||
<vbox id="defaultBrowserBox">
|
||||
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
|
||||
disabled="true"
|
||||
data-l10n-id="always-check-default"/>
|
||||
<deck id="setDefaultPane">
|
||||
<hbox align="center" class="indent">
|
||||
|
|
|
@ -1268,8 +1268,10 @@ var gMainPane = {
|
|||
let isDefault = shellSvc.isDefaultBrowser(false, true);
|
||||
setDefaultPane.selectedIndex = isDefault ? 1 : 0;
|
||||
let alwaysCheck = document.getElementById("alwaysCheckDefault");
|
||||
alwaysCheck.disabled =
|
||||
alwaysCheck.disabled || (isDefault && alwaysCheck.checked);
|
||||
let alwaysCheckPref = Preferences.get(
|
||||
"browser.shell.checkDefaultBrowser"
|
||||
);
|
||||
alwaysCheck.disabled = alwaysCheckPref.locked || isDefault;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -106,6 +106,38 @@ add_task(async function clicking_make_default_checks_alwaysCheck_checkbox() {
|
|||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
add_task(async function make_default_disabled_until_prefs_are_loaded() {
|
||||
// Testcase with Firefox not set as the default browser
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(alwaysCheck.disabled, "'Always Check' is disabled on page load");
|
||||
});
|
||||
await test_with_mock_shellservice({ isDefault: false }, async function() {
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(
|
||||
!alwaysCheck.disabled,
|
||||
"'Always Check' is enabled after default browser updated"
|
||||
);
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
// Testcase with Firefox set as the default browser
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(alwaysCheck.disabled, "'Always Check' is disabled on page load");
|
||||
});
|
||||
await test_with_mock_shellservice({ isDefault: true }, async function() {
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(
|
||||
alwaysCheck.disabled,
|
||||
"'Always Check' is still disabled after default browser updated"
|
||||
);
|
||||
});
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
|
||||
Services.prefs.setBoolPref(
|
||||
|
|
Загрузка…
Ссылка в новой задаче