Commit 3ac80b57 authored by Gregory Pappas's avatar Gregory Pappas
Browse files

Bug 1792205 - Disable 'More troubleshooting information...' when...

Bug 1792205 - Disable 'More troubleshooting information...' when BlockAboutSupport is active r=mkaply,mconley, a=dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D158071
parent 682d7708
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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");
+1 −0
Original line number Diff line number Diff line
@@ -365,6 +365,7 @@ var Policies = {
    onBeforeUIStartup(manager, param) {
      if (param) {
        blockAboutPage(manager, "about:support");
        manager.disallowFeature("aboutSupport");
      }
    },
  },
+1 −0
Original line number Diff line number Diff line
@@ -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]
+41 −0
Original line number Diff line number Diff line
/* 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);
});
+9 −7
Original line number Diff line number Diff line
@@ -463,6 +463,7 @@ window.onload = function() {

  gFooter = appendElement(document.body, "div", "ancillary hidden");

  if (Services.policies.isAllowed("aboutSupport")) {
    let a = appendElementWithText(
      gFooter,
      "a",
@@ -470,6 +471,7 @@ window.onload = function() {
      "Troubleshooting information"
    );
    a.href = "about:support";
  }

  let legendText1 =
    "Click on a non-leaf node in a tree to expand ('++') " +