This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch base-browser-102.5.0esr-12.0-1 in repository tor-browser.
commit 3ac80b5711a31247078a3c1bb289e1dcbd5dbf9d Author: Gregory Pappas gp3033@protonmail.com AuthorDate: Fri Oct 7 18:12:28 2022 +0000
Bug 1792205 - Disable 'More troubleshooting information...' when BlockAboutSupport is active r=mkaply,mconley, a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D158071 --- browser/base/content/utilityOverlay.js | 4 +++ browser/components/enterprisepolicies/Policies.jsm | 1 + .../enterprisepolicies/tests/browser/browser.ini | 1 + .../browser/browser_policy_block_about_support.js | 41 ++++++++++++++++++++++ .../components/aboutmemory/content/aboutMemory.js | 16 +++++---- 5 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 40a1fa59d0e2..4ee4ec25452f 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -1057,6 +1057,10 @@ function buildHelpMenu() { "helpSafeMode" ).disabled = !Services.policies.isAllowed("safeMode");
+ document.getElementById( + "troubleShooting" + ).disabled = !Services.policies.isAllowed("aboutSupport"); + let supportMenu = Services.policies.getSupportMenu(); if (supportMenu) { let menuitem = document.getElementById("helpPolicySupport"); diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index 23bc30010273..937b2a092b6a 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -365,6 +365,7 @@ var Policies = { onBeforeUIStartup(manager, param) { if (param) { blockAboutPage(manager, "about:support"); + manager.disallowFeature("aboutSupport"); } }, }, diff --git a/browser/components/enterprisepolicies/tests/browser/browser.ini b/browser/components/enterprisepolicies/tests/browser/browser.ini index df70352a2544..bc8baff3c06f 100644 --- a/browser/components/enterprisepolicies/tests/browser/browser.ini +++ b/browser/components/enterprisepolicies/tests/browser/browser.ini @@ -22,6 +22,7 @@ skip-if = os != 'mac' [browser_policy_app_auto_update.js] [browser_policy_app_update.js] [browser_policy_block_about.js] +[browser_policy_block_about_support.js] [browser_policy_block_set_desktop_background.js] [browser_policy_bookmarks.js] [browser_policy_cookie_settings.js] diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_block_about_support.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_block_about_support.js new file mode 100644 index 000000000000..b3c9ca432c74 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_block_about_support.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +add_setup(async function() { + await setupPolicyEngineWithJson({ + policies: { + BlockAboutSupport: true, + }, + }); +}); + +add_task(async function test_help_menu() { + buildHelpMenu(); + let troubleshootingInfoMenu = document.getElementById("troubleShooting"); + is( + troubleshootingInfoMenu.getAttribute("disabled"), + "true", + "The `More Troubleshooting Information` item should be disabled" + ); +}); + +add_task(async function test_about_memory() { + let tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "about:memory" + ); + + await SpecialPowers.spawn(tab.linkedBrowser, [], async function() { + let aboutSupportLink = content.document.querySelector( + "a[href='about:support']" + ); + + Assert.ok( + !aboutSupportLink, + "The link to about:support at the bottom of the page should not exist" + ); + }); + + await BrowserTestUtils.removeTab(tab); +}); diff --git a/toolkit/components/aboutmemory/content/aboutMemory.js b/toolkit/components/aboutmemory/content/aboutMemory.js index a68e3b8989c9..29a7d5f9fb88 100644 --- a/toolkit/components/aboutmemory/content/aboutMemory.js +++ b/toolkit/components/aboutmemory/content/aboutMemory.js @@ -463,13 +463,15 @@ window.onload = function() {
gFooter = appendElement(document.body, "div", "ancillary hidden");
- let a = appendElementWithText( - gFooter, - "a", - "option", - "Troubleshooting information" - ); - a.href = "about:support"; + if (Services.policies.isAllowed("aboutSupport")) { + let a = appendElementWithText( + gFooter, + "a", + "option", + "Troubleshooting information" + ); + a.href = "about:support"; + }
let legendText1 = "Click on a non-leaf node in a tree to expand ('++') " +