diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/base/content/test/contextMenu/browser_contextmenu_inspect.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
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; + } + }); +}); |