summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.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 /toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.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 'toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.js')
-rw-r--r--toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.js b/toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.js
new file mode 100644
index 0000000000..4f81b0e9d3
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/test_opensearch_icons_invalid.js
@@ -0,0 +1,49 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* Test that an installed engine can't use a resource URL for an icon */
+
+"use strict";
+
+add_task(async function setup() {
+ let server = useHttpServer("");
+ server.registerContentType("sjs", "sjs");
+ await AddonTestUtils.promiseStartupManager();
+});
+
+add_task(async function test_installedresourceicon() {
+ let engine1 = await SearchTestUtils.promiseNewSearchEngine({
+ url: `${gDataUrl}opensearch/resourceicon.xml`,
+ });
+ let engine2 = await SearchTestUtils.promiseNewSearchEngine({
+ url: `${gDataUrl}opensearch/chromeicon.xml`,
+ });
+
+ Assert.equal(null, engine1.iconURI);
+ Assert.equal(null, engine2.iconURI);
+});
+
+add_task(async function test_installedhttpplace() {
+ let observed = TestUtils.consoleMessageObserved(msg => {
+ return msg.wrappedJSObject.arguments[0].includes(
+ "Content type does not match expected"
+ );
+ });
+
+ // The easiest way to test adding the icon is via a generated xml, otherwise
+ // we have to somehow insert the address of the server into it.
+ let engine = await SearchTestUtils.promiseNewSearchEngine({
+ url:
+ `${gDataUrl}data/engineMaker.sjs?` +
+ JSON.stringify({
+ baseURL: gDataUrl,
+ image: "opensearch/resourceicon.xml",
+ name: "invalidicon",
+ method: "GET",
+ }),
+ });
+
+ await observed;
+
+ Assert.equal(null, engine.iconURI, "Should not have set an iconURI");
+});