diff options
Diffstat (limited to '')
-rw-r--r-- | comm/mail/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/comm/mail/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js b/comm/mail/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js new file mode 100644 index 0000000000..35ad87ab4d --- /dev/null +++ b/comm/mail/components/enterprisepolicies/tests/browser/disable_developer_tools/browser_policy_disable_developer_tools.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_updates_post_policy() { + is( + Services.policies.isAllowed("devtools"), + false, + "devtools should be disabled by policy." + ); + + is( + Services.prefs.getBoolPref("devtools.policy.disabled"), + true, + "devtools dedicated disabled pref is set to true" + ); + + Services.prefs.setBoolPref("devtools.policy.disabled", false); + + is( + Services.prefs.getBoolPref("devtools.policy.disabled"), + true, + "devtools dedicated disabled pref can not be updated" + ); + + await expectErrorPage("about:devtools-toolbox"); + await expectErrorPage("about:debugging"); + + info("Check that devtools menu items are hidden"); + let devtoolsMenu = window.document.getElementById("devtoolsMenu"); + ok(devtoolsMenu.hidden, "The Web Developer item of the tools menu is hidden"); +}); + +const expectErrorPage = async function (url) { + let tabmail = document.getElementById("tabmail"); + let index = tabmail.tabInfo.length; + window.openContentTab("about:blank"); + let tab = tabmail.tabInfo[index]; + let browser = tab.browser; + + BrowserTestUtils.loadURIString(browser, url); + await BrowserTestUtils.browserLoaded(browser, false, url, true); + await SpecialPowers.spawn(browser, [url], async function () { + ok( + content.document.documentURI.startsWith( + "about:neterror?e=blockedByPolicy" + ), + content.document.documentURI + + " should start with about:neterror?e=blockedByPolicy" + ); + }); + + tabmail.closeTab(tab); +}; |