зеркало из 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,preferences-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D62479
This commit is contained in:
Родитель
96b9ff8d37
Коммит
7930a92a34
|
@ -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">
|
||||
|
|
|
@ -1272,8 +1272,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,30 @@ 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 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 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(
|
||||
|
|
Загрузка…
Ссылка в новой задаче