Bug 1429141 - Policy: Don't check if Firefox is the default browser on startup. r=Gijs

MozReview-Commit-ID: DMpGbNkhRN6
This commit is contained in:
Felipe Gomes 2018-01-22 20:32:12 -02:00
Родитель fafa9a9a82
Коммит a72b687b28
5 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -35,6 +35,12 @@ this.Policies = {
}
}
},
"dont_check_default_browser": {
onBeforeUIStartup(manager, param) {
setAndLockPref("browser.shell.checkDefaultBrowser", false);
}
}
};
/*

Просмотреть файл

@ -6,6 +6,14 @@
"description": "Blocks access to the about:config page.",
"first_available": "60.0",
"type": "boolean",
"enum": [true]
},
"dont_check_default_browser": {
"description": "Don't check for the default browser on startup.",
"first_available": "60.0",
"type": "boolean",
"enum": [true]
}

Просмотреть файл

@ -3,6 +3,7 @@ prefs =
browser.policies.enabled=true
support-files =
head.js
config_dont_check_default_browser.json
config_setAndLockPref.json
config_simple_policies.json
config_broken_json.json
@ -11,3 +12,4 @@ support-files =
[browser_policies_setAndLockPref_API.js]
[browser_policies_simple_policies.js]
[browser_policies_validate_and_parse_API.js]
[browser_policy_default_browser_check.js]

Просмотреть файл

@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { ShellService } = Cu.import("resource:///modules/ShellService.jsm", {});
add_task(async function test_default_browser_check() {
ShellService._checkedThisSession = false;
// On a normal profile, the default is true. However, this gets set to false on the
// testing profile. Let's start with true for a sanity check.
ShellService.shouldCheckDefaultBrowser = true;
is(ShellService.shouldCheckDefaultBrowser, true, "Sanity check");
await setupPolicyEngineWithJson("config_dont_check_default_browser.json");
is(ShellService.shouldCheckDefaultBrowser, false, "Policy changed it to not check");
// Try to change it to true and check that it doesn't take effect
ShellService.shouldCheckDefaultBrowser = true;
is(ShellService.shouldCheckDefaultBrowser, false, "Policy is enforced");
});

Просмотреть файл

@ -0,0 +1,5 @@
{
"policies": {
"dont_check_default_browser": true
}
}