зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1630884 - Handle locked prefs in page info dialog. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D74477
This commit is contained in:
Родитель
853de17575
Коммит
afd4cf321d
|
@ -87,6 +87,11 @@ function initRow(aPartId) {
|
|||
}
|
||||
|
||||
setRadioState(aPartId, state);
|
||||
|
||||
checkbox.disabled = Services.prefs.prefIsLocked(
|
||||
"network.cookie.cookieBehavior"
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -106,6 +111,28 @@ function initRow(aPartId) {
|
|||
}
|
||||
|
||||
setRadioState(aPartId, state);
|
||||
|
||||
switch (aPartId) {
|
||||
case "install":
|
||||
checkbox.disabled = !Services.policies.isAllowed("xpinstall");
|
||||
break;
|
||||
case "popup":
|
||||
checkbox.disabled = Services.prefs.prefIsLocked(
|
||||
"dom.disable_open_during_load"
|
||||
);
|
||||
break;
|
||||
case "autoplay-media":
|
||||
checkbox.disabled = Services.prefs.prefIsLocked("media.autoplay.default");
|
||||
break;
|
||||
case "geo":
|
||||
case "desktop-notification":
|
||||
case "camera":
|
||||
case "microphone":
|
||||
checkbox.disabled = Services.prefs.prefIsLocked(
|
||||
"permissions.default." + aPartId
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function createRow(aPartId) {
|
||||
|
|
|
@ -44,6 +44,7 @@ skip-if = (verify && debug && (os == 'mac'))
|
|||
[browser_policy_extensionsettings.js]
|
||||
[browser_policy_firefoxhome.js]
|
||||
[browser_policy_override_postupdatepage.js]
|
||||
[browser_policy_pageinfo_permissions.js]
|
||||
[browser_policy_passwordmanager.js]
|
||||
[browser_policy_search_engine.js]
|
||||
[browser_policy_searchbar.js]
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_ORIGIN = "https://example.com";
|
||||
|
||||
/* Verifies that items on the page info page are properly disabled
|
||||
when the corresponding policies are locked */
|
||||
add_task(async function test_pageinfo_permissions() {
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
Permissions: {
|
||||
Camera: {
|
||||
BlockNewRequests: true,
|
||||
Locked: true,
|
||||
},
|
||||
Microphone: {
|
||||
BlockNewRequests: true,
|
||||
Locked: true,
|
||||
},
|
||||
Location: {
|
||||
BlockNewRequests: true,
|
||||
Locked: true,
|
||||
},
|
||||
Notifications: {
|
||||
BlockNewRequests: true,
|
||||
Locked: true,
|
||||
},
|
||||
Autoplay: {
|
||||
Default: "block-audio",
|
||||
Locked: true,
|
||||
},
|
||||
},
|
||||
InstallAddonsPermission: {
|
||||
Default: false,
|
||||
},
|
||||
PopupBlocking: {
|
||||
Locked: true,
|
||||
},
|
||||
Cookies: {
|
||||
Locked: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let permissions = [
|
||||
"geo",
|
||||
"autoplay-media",
|
||||
"install",
|
||||
"popup",
|
||||
"desktop-notification",
|
||||
"cookie",
|
||||
"camera",
|
||||
"microphone",
|
||||
];
|
||||
|
||||
await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function(browser) {
|
||||
let pageInfo = BrowserPageInfo(TEST_ORIGIN, "permTab");
|
||||
await BrowserTestUtils.waitForEvent(pageInfo, "load");
|
||||
|
||||
for (let i = 0; i < permissions.length; i++) {
|
||||
let permission = permissions[i];
|
||||
let checkbox = await TestUtils.waitForCondition(() =>
|
||||
pageInfo.document.getElementById(`${permission}Def`)
|
||||
);
|
||||
|
||||
ok(checkbox.disabled, `${permission} checkbox should be disabled`);
|
||||
}
|
||||
|
||||
pageInfo.close();
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче