summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/browser_application_xml_handle_internally.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/preferences/tests/browser_application_xml_handle_internally.js
parentInitial commit. (diff)
downloadthunderbird-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/components/preferences/tests/browser_application_xml_handle_internally.js')
-rw-r--r--browser/components/preferences/tests/browser_application_xml_handle_internally.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/browser/components/preferences/tests/browser_application_xml_handle_internally.js b/browser/components/preferences/tests/browser_application_xml_handle_internally.js
new file mode 100644
index 0000000000..edb4a4c0ec
--- /dev/null
+++ b/browser/components/preferences/tests/browser_application_xml_handle_internally.js
@@ -0,0 +1,49 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const HandlerService = Cc[
+ "@mozilla.org/uriloader/handler-service;1"
+].getService(Ci.nsIHandlerService);
+
+const MIMEService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
+
+// This test checks that application/xml has the handle internally option.
+add_task(async function applicationXmlHandleInternally() {
+ const mimeInfo = MIMEService.getFromTypeAndExtension(
+ "application/xml",
+ "xml"
+ );
+ HandlerService.store(mimeInfo);
+ registerCleanupFunction(() => {
+ HandlerService.remove(mimeInfo);
+ });
+
+ await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
+
+ let win = gBrowser.selectedBrowser.contentWindow;
+
+ let container = win.document.getElementById("handlersView");
+
+ // First, find the application/xml item.
+ let xmlItem = container.querySelector("richlistitem[type='application/xml']");
+ Assert.ok(xmlItem, "application/xml is present in handlersView");
+ if (xmlItem) {
+ xmlItem.scrollIntoView({ block: "center" });
+ xmlItem.closest("richlistbox").selectItem(xmlItem);
+
+ // Open its menu
+ let list = xmlItem.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}']`
+ );
+
+ ok(!!handleInternallyItem, "handle internally is present");
+ }
+
+ gBrowser.removeCurrentTab();
+});