diff --git a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search.js b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search.js
index 141bf7af58b5..9276fbaf3655 100644
--- a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search.js
@@ -10,6 +10,7 @@ const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
let delay = () => new Promise(resolve => setTimeout(resolve, 0));
+const kSearchFormURL = "https://example.com/searchform";
const kSearchEngineURL = "https://example.com/?search={searchTerms}";
const kSearchSuggestURL = "https://example.com/?suggest={searchTerms}";
const kSearchTerm = "foo";
@@ -43,6 +44,7 @@ add_task(async function test_extension_adding_engine() {
search_provider: {
name: "MozSearch",
keyword: "MozSearch",
+ search_form: kSearchFormURL,
search_url: kSearchEngineURL,
suggest_url: kSearchSuggestURL,
},
@@ -89,6 +91,7 @@ add_task(async function test_extension_adding_engine() {
"Suggest URLs should match"
);
+ equal(engine.searchForm, kSearchFormURL, "Search form URLs should match");
await ext1.unload();
await delay();
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-post.xml b/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-post.xml
deleted file mode 100644
index 8b6eb7cab03b..000000000000
--- a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-post.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-engine-rel-searchform-post.xml
-
-http://engine-rel-searchform-post.xml/?search
-
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-post/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-post/manifest.json
deleted file mode 100644
index bb53d66909e9..000000000000
--- a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-post/manifest.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "engine-rel-searchform-post.xml",
- "manifest_version": 2,
- "version": "1.0",
- "applications": {
- "gecko": {
- "id": "engine-rel-searchform-post@search.mozilla.org"
- }
- },
- "hidden": true,
- "chrome_settings_overrides": {
- "search_provider": {
- "name": "engine-rel-searchform-post.xml",
- "search_url": "https://engine-rel-searchform-post.xml/POST"
- }
- }
-}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform.xml b/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform.xml
deleted file mode 100644
index bcd164877ae8..000000000000
--- a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-engine-rel-searchform.xml
-
-
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform/manifest.json
deleted file mode 100644
index ebed283aac0b..000000000000
--- a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform/manifest.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "engine-rel-searchform.xml",
- "manifest_version": 2,
- "version": "1.0",
- "applications": {
- "gecko": {
- "id": "engine-rel-searchform@search.mozilla.org"
- }
- },
- "hidden": true,
- "chrome_settings_overrides": {
- "search_provider": {
- "name": "engine-rel-searchform.xml",
- "search_url": "https://engine-rel-searchform.xml/?search"
- }
- }
-}
diff --git a/toolkit/components/search/tests/xpcshell/opensearch/post.xml b/toolkit/components/search/tests/xpcshell/opensearch/post.xml
index 3b1cfd236be3..621e49c872a0 100644
--- a/toolkit/components/search/tests/xpcshell/opensearch/post.xml
+++ b/toolkit/components/search/tests/xpcshell/opensearch/post.xml
@@ -3,4 +3,6 @@
+
+ http://engine-rel-searchform-post.xml/?search
diff --git a/toolkit/components/search/tests/xpcshell/opensearch/suggestion.xml b/toolkit/components/search/tests/xpcshell/opensearch/suggestion.xml
index 539b8589892e..846265e06802 100644
--- a/toolkit/components/search/tests/xpcshell/opensearch/suggestion.xml
+++ b/toolkit/components/search/tests/xpcshell/opensearch/suggestion.xml
@@ -11,6 +11,5 @@
template="https://example.com/suggest">
-
-https://example.com/
+
diff --git a/toolkit/components/search/tests/xpcshell/test_opensearch.js b/toolkit/components/search/tests/xpcshell/test_opensearch.js
index 47b4749b6a52..d493bb58eb3e 100644
--- a/toolkit/components/search/tests/xpcshell/test_opensearch.js
+++ b/toolkit/components/search/tests/xpcshell/test_opensearch.js
@@ -17,12 +17,16 @@ const tests = [
file: "simple.xml",
name: "simple",
description: "A small test engine",
+ searchForm: "https://example.com/",
searchUrl: "https://example.com/search?q=foo",
},
{
file: "post.xml",
name: "Post",
description: "",
+ // The POST method is not supported for `rel="searchform"` so we fallback
+ // to the `SearchForm` url.
+ searchForm: "http://engine-rel-searchform-post.xml/?search",
searchUrl: "https://example.com/post",
searchPostData: "searchterms=foo",
},
@@ -30,6 +34,7 @@ const tests = [
file: "suggestion.xml",
name: "suggestion",
description: "A small engine with suggestions",
+ searchForm: "http://engine-rel-searchform.xml/?search",
searchUrl: "https://example.com/search?q=foo",
suggestUrl: "https://example.com/suggest?suggestion=foo",
},
@@ -37,6 +42,7 @@ const tests = [
file: "suggestion-alternate.xml",
name: "suggestion-alternate",
description: "A small engine with suggestions",
+ searchForm: "https://example.com/",
searchUrl: "https://example.com/search?q=foo",
suggestUrl: "https://example.com/suggest?suggestion=foo",
},
@@ -44,6 +50,7 @@ const tests = [
file: "mozilla-ns.xml",
name: "mozilla-ns",
description: "An engine using mozilla namespace",
+ searchForm: "https://example.com/",
// mozilla-ns.xml also specifies a MozParam. However, they are only
// valid for app-provided engines, and hence the param should not show
// here.
@@ -104,6 +111,12 @@ for (const test of tests) {
);
}
+ Assert.equal(
+ engine.searchForm,
+ test.searchForm,
+ "Should have the correct search form url"
+ );
+
submission = engine.getSubmission("foo", SearchUtils.URL_TYPE.SUGGEST_JSON);
if (test.suggestUrl) {
Assert.equal(
diff --git a/toolkit/components/search/tests/xpcshell/test_rel_searchform.js b/toolkit/components/search/tests/xpcshell/test_rel_searchform.js
deleted file mode 100644
index 45f1191f1869..000000000000
--- a/toolkit/components/search/tests/xpcshell/test_rel_searchform.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * Tests that is properly recognized as a searchForm.
- */
-
-"use strict";
-
-add_task(async function setup() {
- useHttpServer();
- await AddonTestUtils.promiseStartupManager();
-});
-
-add_task(async function test_rel_searchform() {
- let engineNames = [
- "engine-rel-searchform.xml",
- "engine-rel-searchform-post.xml",
- ];
-
- // The final searchForm of the engine should be a URL whose domain is the
- // in the engine's XML and that has a ?search parameter. The
- // point of the ?search parameter is to avoid accidentally matching the value
- // returned as a last resort by Engine's searchForm getter, which is simply
- // the prePath of the engine's first HTML .
- let items = engineNames.map(e => ({ name: e, xmlFileName: e }));
- for (let engine of await addTestEngines(items)) {
- Assert.equal(engine.searchForm, "http://" + engine.name + "/?search");
- }
-});
diff --git a/toolkit/components/search/tests/xpcshell/xpcshell-common.ini b/toolkit/components/search/tests/xpcshell/xpcshell-common.ini
index cc9f22118aa9..613f52c4d4e2 100644
--- a/toolkit/components/search/tests/xpcshell/xpcshell-common.ini
+++ b/toolkit/components/search/tests/xpcshell/xpcshell-common.ini
@@ -60,7 +60,6 @@ support-files =
[test_parseSubmissionURL.js]
[test_pref.js]
[test_purpose.js]
-[test_rel_searchform.js]
[test_require_engines_in_cache.js]
[test_remove_profile_engine.js]
[test_resultDomain.js]
diff --git a/toolkit/components/search/tests/xpcshell/xpcshell-legacyconfig.ini b/toolkit/components/search/tests/xpcshell/xpcshell-legacyconfig.ini
index b8121beeb04a..6431f63091db 100644
--- a/toolkit/components/search/tests/xpcshell/xpcshell-legacyconfig.ini
+++ b/toolkit/components/search/tests/xpcshell/xpcshell-legacyconfig.ini
@@ -21,10 +21,6 @@ support-files =
data/engine-reordered/manifest.json
data/engineMaker.sjs
data/engine-pref/manifest.json
- data/engine-rel-searchform/manifest.json
- data/engine-rel-searchform.xml
- data/engine-rel-searchform-post/manifest.json
- data/engine-rel-searchform-post.xml
data/engine-rel-searchform-purpose/manifest.json
data/engine-system-purpose/manifest.json
data/engineImages.xml
diff --git a/toolkit/components/search/tests/xpcshell/xpcshell.ini b/toolkit/components/search/tests/xpcshell/xpcshell.ini
index e421599bb370..95d0fb49d187 100644
--- a/toolkit/components/search/tests/xpcshell/xpcshell.ini
+++ b/toolkit/components/search/tests/xpcshell/xpcshell.ini
@@ -21,10 +21,6 @@ support-files =
data/engine-reordered/manifest.json
data/engineMaker.sjs
data/engine-pref/manifest.json
- data/engine-rel-searchform/manifest.json
- data/engine-rel-searchform.xml
- data/engine-rel-searchform-post/manifest.json
- data/engine-rel-searchform-post.xml
data/engine-rel-searchform-purpose/manifest.json
data/engine-system-purpose/manifest.json
data/engineImages.xml