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/components/preferences/tests/browser_pdf_disabled.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/components/preferences/tests/browser_pdf_disabled.js')
-rw-r--r-- | browser/components/preferences/tests/browser_pdf_disabled.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/browser/components/preferences/tests/browser_pdf_disabled.js b/browser/components/preferences/tests/browser_pdf_disabled.js new file mode 100644 index 0000000000..5b814b39e9 --- /dev/null +++ b/browser/components/preferences/tests/browser_pdf_disabled.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// This test checks that pdf always appears in the applications list even +// both a customized handler doesn't exist and when the internal viewer is +// not enabled. +add_task(async function pdfIsAlwaysPresent() { + // Try again with the pdf viewer enabled and disabled. + for (let test of ["enabled", "disabled"]) { + await SpecialPowers.pushPrefEnv({ + set: [["pdfjs.disabled", test == "disabled"]], + }); + + await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }); + + let win = gBrowser.selectedBrowser.contentWindow; + + let container = win.document.getElementById("handlersView"); + + // First, find the PDF item. + let pdfItem = container.querySelector( + "richlistitem[type='application/pdf']" + ); + Assert.ok(pdfItem, "pdfItem is present in handlersView when " + test); + if (pdfItem) { + pdfItem.scrollIntoView({ block: "center" }); + pdfItem.closest("richlistbox").selectItem(pdfItem); + + // Open its menu + let list = pdfItem.querySelector(".actionsMenu"); + let popup = list.menupopup; + let popupShown = BrowserTestUtils.waitForEvent(popup, "popupshown"); + EventUtils.synthesizeMouseAtCenter(list, {}, win); + await popupShown; + + let handleInternallyItem = list.querySelector( + `menuitem[action='${Ci.nsIHandlerInfo.handleInternally}']` + ); + + is( + test == "enabled", + !!handleInternallyItem, + "handle internally is present when " + test + ); + } + + gBrowser.removeCurrentTab(); + } +}); |