Bug 1429164 - Add enterprise policy to prevent showing the profile import wizard r=Felipe,Gijs

MozReview-Commit-ID: Lg7r1NrFbKl

--HG--
extra : rebase_source : d81e065a5e99e15c24dcb4a64dff4b0341f6efc4
This commit is contained in:
Kirk Steuber 2018-04-04 10:56:20 -07:00
parent 7ca074617e
commit 823f7f78af
5 changed files with 57 additions and 0 deletions

View File

@ -291,6 +291,15 @@ var Policies = {
}
},
"DisableProfileImport": {
onBeforeUIStartup(manager, param) {
if (param) {
manager.disallowFeature("profileImport");
setAndLockPref("browser.newtabpage.activity-stream.migrationExpired", true);
}
}
},
"DisableProfileRefresh": {
onBeforeUIStartup(manager, param) {
if (param) {

View File

@ -234,6 +234,13 @@
"type": "boolean"
},
"DisableProfileImport": {
"description": "Disables the Firefox \"Import data from another browser\" button",
"first_available": "60.0",
"type": "boolean"
},
"DisableProfileRefresh": {
"description": "Disables the \"Refresh Firefox\" button in about:support",
"first_available": "60.0",

View File

@ -38,6 +38,7 @@ support-files =
[browser_policy_disable_popup_blocker.js]
[browser_policy_disable_privatebrowsing.js]
[browser_policy_disable_profile_reset.js]
[browser_policy_disable_profile_import.js]
[browser_policy_disable_safemode.js]
[browser_policy_disable_shield.js]
[browser_policy_disable_telemetry.js]

View File

@ -0,0 +1,36 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
async function openLibrary() {
return new Promise(resolve => {
let library = window.openDialog("chrome://browser/content/places/places.xul", "",
"chrome,toolbar=yes,dialog=no,resizable");
waitForFocus(() => resolve(library), library);
});
}
add_task(async function test_disable_profile_import() {
await setupPolicyEngineWithJson({
"policies": {
"DisableProfileImport": true
}
});
let library = await openLibrary();
let menu = library.document.getElementById("maintenanceButtonPopup");
let promisePopupShown = BrowserTestUtils.waitForEvent(menu, "popupshown");
menu.openPopup();
await promisePopupShown;
let profileImportButton = library.document.getElementById("browserImport");
is(profileImportButton.disabled, true, "Profile Import button should be disabled");
let promisePopupHidden = BrowserTestUtils.waitForEvent(menu, "popuphidden");
menu.hidePopup();
await promisePopupHidden;
await BrowserTestUtils.closeWindow(library);
checkLockedPref("browser.newtabpage.activity-stream.migrationExpired", true);
});

View File

@ -189,6 +189,10 @@ var PlacesOrganizer = {
document.getElementById("placesContext")
.removeChild(document.getElementById("placesContext_show:info"));
if (!Services.policies.isAllowed("profileImport")) {
document.getElementById("OrganizerCommand_browserImport").setAttribute("disabled", true);
}
ContentArea.focus();
},