From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../test/sync/browser_contextmenu_sendpage.js | 57 ++++++++++------------ 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'browser/base/content/test/sync/browser_contextmenu_sendpage.js') diff --git a/browser/base/content/test/sync/browser_contextmenu_sendpage.js b/browser/base/content/test/sync/browser_contextmenu_sendpage.js index a80cf8a1d0..14b5f72860 100644 --- a/browser/base/content/test/sync/browser_contextmenu_sendpage.js +++ b/browser/base/content/test/sync/browser_contextmenu_sendpage.js @@ -93,47 +93,44 @@ add_task(async function test_link_contextmenu() { "context-sendlinktodevice-popup" ); - let expectedArray = ["context-openlinkintab"]; - - if ( + const expectOpenLinkInUserContextMenu = Services.prefs.getBoolPref("privacy.userContext.enabled") && - ContextualIdentityService.getPublicIdentities().length - ) { - expectedArray.push("context-openlinkinusercontext-menu"); - } + ContextualIdentityService.getPublicIdentities().length; + + const expectStripOnShareLink = Services.prefs.getBoolPref( + "privacy.query_stripping.strip_on_share.enabled" + ); + + const expectTranslateSelection = + Services.prefs.getBoolPref("browser.translations.enable") && + Services.prefs.getBoolPref("browser.translations.select.enable"); - expectedArray.push( + const expectInspectAccessibility = + Services.prefs.getBoolPref("devtools.accessibility.enabled", true) && + (Services.prefs.getBoolPref("devtools.everOpened", false) || + Services.prefs.getIntPref("devtools.selfxss.count", 0) > 0); + + const expectedArray = [ + "context-openlinkintab", + ...(expectOpenLinkInUserContextMenu + ? ["context-openlinkinusercontext-menu"] + : []), "context-openlink", "context-openlinkprivate", "context-sep-open", "context-bookmarklink", "context-savelink", "context-savelinktopocket", - "context-copylink" - ); - - if ( - Services.prefs.getBoolPref("privacy.query_stripping.strip_on_share.enabled") - ) { - expectedArray.push("context-stripOnShareLink"); - } - - expectedArray.push( + "context-copylink", + ...(expectStripOnShareLink ? ["context-stripOnShareLink"] : []), "context-sendlinktodevice", "context-sep-sendlinktodevice", "context-searchselect", - "frame-sep" - ); - - if ( - Services.prefs.getBoolPref("devtools.accessibility.enabled", true) && - (Services.prefs.getBoolPref("devtools.everOpened", false) || - Services.prefs.getIntPref("devtools.selfxss.count", 0) > 0) - ) { - expectedArray.push("context-inspect-a11y"); - } - - expectedArray.push("context-inspect"); + ...(expectTranslateSelection ? ["context-translate-selection"] : []), + "frame-sep", + ...(expectInspectAccessibility ? ["context-inspect-a11y"] : []), + "context-inspect", + ]; let menu = document.getElementById("contentAreaContextMenu"); -- cgit v1.2.3