diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /browser/base/content/test/contextMenu/browser_contextmenu_inspect.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/contextMenu/browser_contextmenu_inspect.js')
-rw-r--r-- | browser/base/content/test/contextMenu/browser_contextmenu_inspect.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/browser/base/content/test/contextMenu/browser_contextmenu_inspect.js b/browser/base/content/test/contextMenu/browser_contextmenu_inspect.js new file mode 100644 index 0000000000..94241e9e1f --- /dev/null +++ b/browser/base/content/test/contextMenu/browser_contextmenu_inspect.js @@ -0,0 +1,61 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Check that we show the inspect item(s) as appropriate. + */ +add_task(async function test_contextmenu_inspect() { + await SpecialPowers.pushPrefEnv({ + set: [ + ["devtools.selfxss.count", 0], + ["devtools.everOpened", false], + ], + }); + let contextMenu = document.getElementById("contentAreaContextMenu"); + await BrowserTestUtils.withNewTab("about:blank", async browser => { + for (let [pref, value, expectation] of [ + ["devtools.selfxss.count", 10, true], + ["devtools.selfxss.count", 0, false], + ["devtools.everOpened", false, false], + ["devtools.everOpened", true, true], + ]) { + await SpecialPowers.pushPrefEnv({ + set: [["devtools.selfxss.count", value]], + }); + is(contextMenu.state, "closed", "checking if popup is closed"); + let promisePopupShown = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + let promisePopupHidden = BrowserTestUtils.waitForEvent( + contextMenu, + "popuphidden" + ); + await BrowserTestUtils.synthesizeMouse( + "body", + 2, + 2, + { type: "contextmenu", button: 2 }, + browser + ); + await promisePopupShown; + let inspectItem = document.getElementById("context-inspect"); + ok( + !inspectItem.hidden, + `Inspect should be shown (pref ${pref} is ${value}).` + ); + let inspectA11y = document.getElementById("context-inspect-a11y"); + is( + inspectA11y.hidden, + !expectation, + `A11y should be ${ + expectation ? "visible" : "hidden" + } (pref ${pref} is ${value}).` + ); + contextMenu.hidePopup(); + await promisePopupHidden; + } + }); +}); |