summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/tests/xpcshell/data
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /toolkit/components/search/tests/xpcshell/data
parentInitial commit. (diff)
downloadfirefox-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 'toolkit/components/search/tests/xpcshell/data')
-rw-r--r--toolkit/components/search/tests/xpcshell/data/bigIcon.icobin0 -> 56646 bytes
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-app/manifest.json24
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-chromeicon/manifest.json23
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/en/messages.json8
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/gd/messages.json8
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-diff-name/manifest.json21
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-fr.xml12
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-fr/manifest.json32
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-override/manifest.json24
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-pref/manifest.json33
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-purposes/manifest.json62
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-purpose/manifest.json41
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-reordered/manifest.json40
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/en/messages.json8
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/gd/messages.json8
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-resourceicon/manifest.json21
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/en/messages.json8
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/gd/messages.json8
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-same-name/manifest.json21
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine-system-purpose/manifest.json35
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine.xml15
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine/manifest.json40
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine2.xml9
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engine2/manifest.json18
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engineImages.xml22
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engineImages/manifest.json37
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engineMaker.sjs79
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engines-no-order-hint.json189
-rw-r--r--toolkit/components/search/tests/xpcshell/data/engines.json203
-rw-r--r--toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/af/messages.json17
-rw-r--r--toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/an/messages.json17
-rw-r--r--toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/favicon.icobin0 -> 884 bytes
-rw-r--r--toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/manifest.json23
-rw-r--r--toolkit/components/search/tests/xpcshell/data/iconsRedirect.sjs18
-rw-r--r--toolkit/components/search/tests/xpcshell/data/remoteIcon.icobin0 -> 901 bytes
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-legacy-correct-default-engine-hashes.json112
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-legacy-no-ids.json87
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-legacy-old-loadPaths.json135
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-default-engine-hashes.json114
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-third-party-engine-hashes.json114
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-legacy.json109
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-migration.json68
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-obsolete-app.json41
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-obsolete-distribution.json41
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search-obsolete-langpack.json91
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search.json66
-rw-r--r--toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs187
-rw-r--r--toolkit/components/search/tests/xpcshell/data/search_ignorelist.json51
-rw-r--r--toolkit/components/search/tests/xpcshell/data/svgIcon.svg4
49 files changed, 2344 insertions, 0 deletions
diff --git a/toolkit/components/search/tests/xpcshell/data/bigIcon.ico b/toolkit/components/search/tests/xpcshell/data/bigIcon.ico
new file mode 100644
index 0000000000..f22522411d
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/bigIcon.ico
Binary files differ
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-app/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-app/manifest.json
new file mode 100644
index 0000000000..14bc27bdd4
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-app/manifest.json
@@ -0,0 +1,24 @@
+{
+ "name": "TestEngineApp",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-app@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "A test search engine installed in the application directory",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "TestEngineApp",
+ "search_url": "https://localhost/",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-chromeicon/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-chromeicon/manifest.json
new file mode 100644
index 0000000000..d2896b78f8
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-chromeicon/manifest.json
@@ -0,0 +1,23 @@
+{
+ "name": "engine-chromeicon",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-chromeicon@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "engine-chromeicon",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/en/messages.json b/toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/en/messages.json
new file mode 100644
index 0000000000..07580b8ea5
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/en/messages.json
@@ -0,0 +1,8 @@
+{
+ "extensionName": {
+ "message": "engine-diff-name-en"
+ },
+ "searchUrl": {
+ "message": "https://en.wikipedia.com/search"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/gd/messages.json b/toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/gd/messages.json
new file mode 100644
index 0000000000..de01d16bf0
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-diff-name/_locales/gd/messages.json
@@ -0,0 +1,8 @@
+{
+ "extensionName": {
+ "message": "engine-diff-name-gd"
+ },
+ "searchUrl": {
+ "message": "https://gd.wikipedia.com/search"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-diff-name/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-diff-name/manifest.json
new file mode 100644
index 0000000000..3c80765f61
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-diff-name/manifest.json
@@ -0,0 +1,21 @@
+{
+ "name": "engine-diff-name",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-diff-name@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "icons": {
+ "16": "favicon.png"
+ },
+ "default_locale": "en",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "__MSG_extensionName__",
+ "search_url": "__MSG_searchUrl__"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-fr.xml b/toolkit/components/search/tests/xpcshell/data/engine-fr.xml
new file mode 100644
index 0000000000..4bb4426a12
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-fr.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
+<ShortName>Test search engine (fr)</ShortName>
+<Description>A test search engine (based on Google search for a different locale)</Description>
+<InputEncoding>ISO-8859-1</InputEncoding>
+<Url type="text/html" method="GET" template="http://www.google.fr/search">
+ <Param name="q" value="{searchTerms}"/>
+ <Param name="ie" value="iso-8859-1"/>
+ <Param name="oe" value="iso-8859-1"/>
+</Url>
+<SearchForm>http://www.google.fr/</SearchForm>
+</SearchPlugin>
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-fr/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-fr/manifest.json
new file mode 100644
index 0000000000..cc895d26d9
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-fr/manifest.json
@@ -0,0 +1,32 @@
+{
+ "name": "Test search engine (fr)",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-fr@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "A test search engine (based on Google search for a different locale)",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "Test search engine (fr)",
+ "search_url": "https://www.google.fr/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "ie",
+ "value": "iso-8859-1"
+ },
+ {
+ "name": "oe",
+ "value": "iso-8859-1"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-override/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-override/manifest.json
new file mode 100644
index 0000000000..a894be0a41
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-override/manifest.json
@@ -0,0 +1,24 @@
+{
+ "name": "bug645970",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-override@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "override",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "bug645970",
+ "search_url": "https://searchtest.local",
+ "params": [
+ {
+ "name": "search",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-pref/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-pref/manifest.json
new file mode 100644
index 0000000000..d796b65b63
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-pref/manifest.json
@@ -0,0 +1,33 @@
+{
+ "name": "engine-pref",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-pref@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "engine-pref",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "code",
+ "condition": "pref",
+ "pref": "code"
+ },
+ {
+ "name": "test",
+ "condition": "pref",
+ "pref": "test"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-purposes/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-purposes/manifest.json
new file mode 100644
index 0000000000..fc709063e1
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-purposes/manifest.json
@@ -0,0 +1,62 @@
+{
+ "name": "Test Engine With Purposes",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-purposes@search.mozilla.org"
+ }
+ },
+ "description": "A test search engine with purposes",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "Test Engine With Purposes",
+ "search_url": "https://www.example.com/search",
+ "params": [
+ {
+ "name": "form",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "MOZKEYWORD"
+ },
+ {
+ "name": "form",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "MOZCONTEXT"
+ },
+ {
+ "name": "form",
+ "condition": "purpose",
+ "purpose": "newtab",
+ "value": "MOZNEWTAB"
+ },
+ {
+ "name": "form",
+ "condition": "purpose",
+ "purpose": "searchbar",
+ "value": "MOZSEARCHBAR"
+ },
+ {
+ "name": "form",
+ "condition": "purpose",
+ "purpose": "homepage",
+ "value": "MOZHOMEPAGE"
+ },
+ {
+ "name": "pc",
+ "value": "FIREFOX"
+ },
+ {
+ "name": "channel",
+ "condition": "pref",
+ "pref": "testChannelEnabled"
+ },
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-purpose/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-purpose/manifest.json
new file mode 100644
index 0000000000..ed4a609e7c
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-rel-searchform-purpose/manifest.json
@@ -0,0 +1,41 @@
+{
+ "name": "engine-rel-searchform-purpose",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-rel-searchform-purpose@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "engine-rel-searchform-purpose",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "searchbar",
+ "value": "sb"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-reordered/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-reordered/manifest.json
new file mode 100644
index 0000000000..cc3fc95430
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-reordered/manifest.json
@@ -0,0 +1,40 @@
+{
+ "name": "Test search engine (Reordered)",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-reordered@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "A test search engine (based on Google search)",
+ "icons": {
+ "16": "favicon.ico"
+ },
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "Test search engine (Reordered)",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ }
+ ],
+ "suggest_url": "https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/en/messages.json b/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/en/messages.json
new file mode 100644
index 0000000000..1cc3f68ee1
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/en/messages.json
@@ -0,0 +1,8 @@
+{
+ "extensionName": {
+ "message": "engine-resourceicon"
+ },
+ "searchUrl": {
+ "message": "https://www.google.com/search"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/gd/messages.json b/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/gd/messages.json
new file mode 100644
index 0000000000..3c02e6a2af
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/_locales/gd/messages.json
@@ -0,0 +1,8 @@
+{
+ "extensionName": {
+ "message": "engine-resourceicon-gd"
+ },
+ "searchUrl": {
+ "message": "https://www.google.com/search"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/manifest.json
new file mode 100644
index 0000000000..dc62336145
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-resourceicon/manifest.json
@@ -0,0 +1,21 @@
+{
+ "name": "engine-resourceicon",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-resourceicon@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "icons": {
+ "16": "favicon.png"
+ },
+ "default_locale": "en",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "__MSG_extensionName__",
+ "search_url": "__MSG_searchUrl__"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/en/messages.json b/toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/en/messages.json
new file mode 100644
index 0000000000..ee808e7a62
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/en/messages.json
@@ -0,0 +1,8 @@
+{
+ "extensionName": {
+ "message": "engine-same-name"
+ },
+ "searchUrl": {
+ "message": "https://www.google.com/search?q={searchTerms}"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/gd/messages.json b/toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/gd/messages.json
new file mode 100644
index 0000000000..476a9e56cc
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-same-name/_locales/gd/messages.json
@@ -0,0 +1,8 @@
+{
+ "extensionName": {
+ "message": "engine-same-name"
+ },
+ "searchUrl": {
+ "message": "https://www.example.com/search?q={searchTerms}"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-same-name/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-same-name/manifest.json
new file mode 100644
index 0000000000..dc8a4c5d45
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-same-name/manifest.json
@@ -0,0 +1,21 @@
+{
+ "name": "engine-same-name",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-same-name@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "icons": {
+ "16": "favicon.png"
+ },
+ "default_locale": "en",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "__MSG_extensionName__",
+ "search_url": "__MSG_searchUrl__"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine-system-purpose/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine-system-purpose/manifest.json
new file mode 100644
index 0000000000..d268af8eab
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine-system-purpose/manifest.json
@@ -0,0 +1,35 @@
+{
+ "name": "engine-system-purpose",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine-system-purpose@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "engine-system-purpose",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "searchbar",
+ "value": "sb"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "system",
+ "value": "sys"
+ }
+ ]
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine.xml b/toolkit/components/search/tests/xpcshell/data/engine.xml
new file mode 100644
index 0000000000..a665e46b0b
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
+<ShortName>Test search engine</ShortName>
+<Description>A test search engine (based on Google search)</Description>
+<InputEncoding>UTF-8</InputEncoding>
+<Image width="16" height="16">data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA</Image>
+<Url type="application/x-suggestions+json" method="GET" template="https://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;hl={moz:locale}&amp;q={searchTerms}"/>
+<Url type="text/html" method="GET" template="https://www.google.com/search">
+ <Param name="q" value="{searchTerms}"/>
+ <!-- Dynamic parameters -->
+ <MozParam name="channel" condition="purpose" purpose="contextmenu" value="rcs"/>
+ <MozParam name="channel" condition="purpose" purpose="keyword" value="fflb"/>
+</Url>
+<SearchForm>http://www.google.com/</SearchForm>
+</SearchPlugin>
diff --git a/toolkit/components/search/tests/xpcshell/data/engine/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine/manifest.json
new file mode 100644
index 0000000000..30d221f388
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine/manifest.json
@@ -0,0 +1,40 @@
+{
+ "name": "Test search engine",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "A test search engine (based on Google search)",
+ "icons": {
+ "16": "favicon.ico"
+ },
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "Test search engine",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ }
+ ],
+ "suggest_url": "https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engine2.xml b/toolkit/components/search/tests/xpcshell/data/engine2.xml
new file mode 100644
index 0000000000..9957bfdf48
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
+ <ShortName>A second test engine</ShortName>
+ <Description>A second test search engine (based on DuckDuckGo)</Description>
+ <InputEncoding>UTF-8</InputEncoding>
+ <LongName>A second test search engine (based on DuckDuckGo)</LongName>
+ <Image width="16" height="16">data:image/vnd.microsoft.icon;base64,AAABAAMAEBAAAAEACABoBQAANgAAACAgAAABAAgAqAgAAJ4FAAAwMAAAAQAIAKgOAABGDgAAKAAAABAAAAAgAAAAAQAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUvgAAFMAAABfDAAAYwQAAGscAAB7KAAAgzAAAIcwAACHNAAAizgAAI9AAACTQAAAn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AAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAQAAwAAAAAADAAA=</Image>
+ <Url type="text/html" method="get" template="https://duckduckgo.com/?q={searchTerms}"/>
+</OpenSearchDescription>
diff --git a/toolkit/components/search/tests/xpcshell/data/engine2/manifest.json b/toolkit/components/search/tests/xpcshell/data/engine2/manifest.json
new file mode 100644
index 0000000000..7dd4b15931
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engine2/manifest.json
@@ -0,0 +1,18 @@
+{
+ "name": "A second test engine",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engine2@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "A second test search engine (based on DuckDuckGo)",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "A second test engine",
+ "search_url": "https://duckduckgo.com/?q={searchTerms}"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engineImages.xml b/toolkit/components/search/tests/xpcshell/data/engineImages.xml
new file mode 100644
index 0000000000..65b550b31b
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engineImages.xml
@@ -0,0 +1,22 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
+ <ShortName>IconsTest</ShortName>
+ <Description>IconsTest. Search by Test.</Description>
+ <InputEncoding>UTF-8</InputEncoding>
+ <Image width="16" height="16">data:image/x-icon;base64,ico16</Image>
+ <Image width="32" height="32">data:image/x-icon;base64,ico32</Image>
+ <Image width="74" height="74">data:image/png;base64,ico74</Image>
+ <Url type="application/x-suggestions+json" template="http://api.bing.com/osjson.aspx">
+ <Param name="query" value="{searchTerms}"/>
+ <Param name="form" value="MOZW"/>
+ </Url>
+ <Url type="text/html" method="GET" template="http://www.bing.com/search">
+ <Param name="q" value="{searchTerms}"/>
+ <MozParam name="pc" condition="pref" pref="ms-pc"/>
+ <Param name="form" value="MOZW"/>
+ </Url>
+ <SearchForm>http://www.bing.com/search</SearchForm>
+</SearchPlugin>
diff --git a/toolkit/components/search/tests/xpcshell/data/engineImages/manifest.json b/toolkit/components/search/tests/xpcshell/data/engineImages/manifest.json
new file mode 100644
index 0000000000..b5366a6eb6
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engineImages/manifest.json
@@ -0,0 +1,37 @@
+{
+ "name": "IconsTest",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "engineImages@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "IconsTest. Search by Test.",
+ "icons": {
+ "16": "data:image/x-icon;base64,ico16"
+ },
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "IconsTest",
+ "search_url": "https://www.bing.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "form",
+ "value": "MOZW"
+ },
+ {
+ "name": "pc",
+ "condition": "pref",
+ "pref": "ms-pc"
+ }
+ ],
+ "suggest_url": "https://api.bing.com/osjson.aspxquery={searchTerms}&form=MOZW"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs b/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs
new file mode 100644
index 0000000000..4f97bd7635
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs
@@ -0,0 +1,79 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Dynamically create an OpenSearch search engine offering search suggestions
+ * via searchSuggestions.sjs.
+ *
+ * The engine is constructed by passing a JSON object with engine details as the query string.
+ */
+
+function handleRequest(request, response) {
+ let engineData = JSON.parse(unescape(request.queryString).replace("+", " "));
+
+ if (!engineData.baseURL) {
+ response.setStatusLine(request.httpVersion, 500, "baseURL required");
+ return;
+ }
+
+ engineData.name = engineData.name || "Generated test engine";
+ engineData.description =
+ engineData.description || "Generated test engine description";
+ engineData.method = engineData.method || "GET";
+
+ response.setStatusLine(request.httpVersion, 200, "OK");
+ createOpenSearchEngine(response, engineData);
+}
+
+/**
+ * Create an OpenSearch engine for the given base URL.
+ *
+ * @param {Response} response
+ * The response object to write the engine to.
+ * @param {object} engineData
+ * Information about the search engine to write to the response.
+ */
+function createOpenSearchEngine(response, engineData) {
+ let params = "";
+ let queryString = "";
+ if (engineData.queryString) {
+ queryString = engineData.queryString.replace("&", "&amp;");
+ } else if (engineData.method == "POST") {
+ params = "<Param name='q' value='{searchTerms}'/>";
+ } else {
+ queryString = "?q={searchTerms}";
+ }
+ let type = "type='application/x-suggestions+json'";
+ if (engineData.alternativeJSONType) {
+ type = "type='application/json' rel='suggestions'";
+ }
+ let image = "";
+ if (engineData.image) {
+ image = `<Image width="16" height="16">${engineData.baseURL}${engineData.image}</Image>`;
+ }
+ let updateFile = "";
+ if (engineData.updateFile) {
+ updateFile = `<Url type="application/opensearchdescription+xml"
+ rel="self"
+ template="${engineData.baseURL}${engineData.updateFile}" />
+ `;
+ }
+
+ let result = `<?xml version='1.0' encoding='utf-8'?>
+<OpenSearchDescription xmlns='http://a9.com/-/spec/opensearch/1.1/'>
+ <ShortName>${engineData.name}</ShortName>
+ <Description>${engineData.description}</Description>
+ <InputEncoding>UTF-8</InputEncoding>
+ <LongName>${engineData.name}</LongName>
+ ${image}
+ <Url ${type} method='${engineData.method}'
+ template='${engineData.baseURL}searchSuggestions.sjs${queryString}'>
+ ${params}
+ </Url>
+ <Url type='text/html' method='${engineData.method}'
+ template='${engineData.baseURL}${queryString}'/>
+ ${updateFile}
+</OpenSearchDescription>
+`;
+ response.write(result);
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engines-no-order-hint.json b/toolkit/components/search/tests/xpcshell/data/engines-no-order-hint.json
new file mode 100644
index 0000000000..3c8befc726
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engines-no-order-hint.json
@@ -0,0 +1,189 @@
+{
+ "data": [
+ {
+ "webExtension": {
+ "id": "engine@search.mozilla.org",
+ "name": "Test search engine",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ }
+ ],
+ "suggest_url": "https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}"
+ },
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "default": "yes"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-rel-searchform-purpose@search.mozilla.org",
+ "name": "engine-rel-searchform-purpose",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "searchbar",
+ "value": "sb"
+ }
+ ]
+ },
+ "orderHint": 1000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de", "fr"] } },
+ "default": "no"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-chromeicon@search.mozilla.org",
+ "name": "engine-chromeicon",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ },
+ "orderHint": 1000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de", "fr"] } },
+ "default": "no"
+ },
+ {
+ "included": { "regions": ["ru"] },
+ "default": "no"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-resourceicon@search.mozilla.org",
+ "name": "engine-resourceicon",
+ "search_url": "https://www.google.com/search",
+ "search_provider": {
+ "en": {
+ "name": "engine-resourceicon",
+ "search_url": "https://www.google.com/search"
+ },
+ "gd": {
+ "name": "engine-resourceicon-gd",
+ "search_url": "https://www.google.com/search"
+ }
+ }
+ },
+ "appliesTo": [
+ {
+ "included": { "locales": { "matches": ["en-US", "fr"] } },
+ "excluded": {
+ "regions": ["ru"]
+ },
+ "default": "no"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-reordered@search.mozilla.org",
+ "name": "Test search engine (Reordered)",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ }
+ ],
+ "suggest_url": "https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}"
+ },
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de", "fr"] } },
+ "default": "no"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-pref@search.mozilla.org",
+ "name": "engine-pref",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "code",
+ "condition": "pref",
+ "pref": "code"
+ },
+ {
+ "name": "test",
+ "condition": "pref",
+ "pref": "test"
+ }
+ ]
+ },
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de"] } },
+ "default": "no"
+ }
+ ]
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/engines.json b/toolkit/components/search/tests/xpcshell/data/engines.json
new file mode 100644
index 0000000000..f27a4844df
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/engines.json
@@ -0,0 +1,203 @@
+{
+ "data": [
+ {
+ "webExtension": {
+ "id": "engine@search.mozilla.org",
+ "name": "Test search engine",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ }
+ ],
+ "suggest_url": "https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}"
+ },
+ "orderHint": 10000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["gd"] } },
+ "default": "yes"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-pref@search.mozilla.org",
+ "name": "engine-pref",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "code",
+ "condition": "pref",
+ "pref": "code"
+ },
+ {
+ "name": "test",
+ "condition": "pref",
+ "pref": "test"
+ }
+ ]
+ },
+ "orderHint": 7000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de"] } },
+ "default": "no",
+ "defaultPrivate": "yes"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-rel-searchform-purpose@search.mozilla.org",
+ "name": "engine-rel-searchform-purpose",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "searchbar",
+ "value": "sb"
+ }
+ ]
+ },
+ "orderHint": 6000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de", "fr"] } },
+ "default": "no"
+ },
+ {
+ "included": { "locales": { "matches": ["gd"] } },
+ "orderHint": 9000
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-chromeicon@search.mozilla.org",
+ "name": "engine-chromeicon",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ },
+ "orderHint": 8000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de", "fr"] } },
+ "default": "no"
+ },
+ {
+ "included": { "regions": ["ru"] },
+ "default": "no"
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-resourceicon@search.mozilla.org",
+ "default_locale": "en",
+ "searchProvider": {
+ "en": {
+ "name": "engine-resourceicon",
+ "search_url": "https://www.google.com/search"
+ },
+ "gd": {
+ "name": "engine-resourceicon-gd",
+ "search_url": "https://www.google.com/search"
+ }
+ }
+ },
+ "orderHint": 9000,
+ "appliesTo": [
+ {
+ "included": { "locales": { "matches": ["en-US", "fr"] } },
+ "excluded": { "regions": ["ru"] },
+ "default": "no"
+ },
+ {
+ "included": { "locales": { "matches": ["gd"] } },
+ "default": "yes",
+ "webExtension": {
+ "locales": ["gd"]
+ }
+ }
+ ]
+ },
+ {
+ "webExtension": {
+ "id": "engine-reordered@search.mozilla.org",
+ "name": "Test search engine (Reordered)",
+ "search_url": "https://www.google.com/search",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "contextmenu",
+ "value": "rcs"
+ },
+ {
+ "name": "channel",
+ "condition": "purpose",
+ "purpose": "keyword",
+ "value": "fflb"
+ }
+ ],
+ "suggest_url": "https://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}"
+ },
+ "orderHint": 5000,
+ "appliesTo": [
+ {
+ "included": { "everywhere": true },
+ "excluded": { "locales": { "matches": ["de", "fr"] } },
+ "default": "no"
+ }
+ ]
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/af/messages.json b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/af/messages.json
new file mode 100644
index 0000000000..29ddd24df5
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/af/messages.json
@@ -0,0 +1,17 @@
+{
+ "extensionName": {
+ "message": "Multilocale"
+ },
+ "extensionDescription": {
+ "message": "Wikipedia, die vrye ensiklopedie"
+ },
+ "url_lang": {
+ "message": "af"
+ },
+ "searchUrl": {
+ "message": "https://af.wikipedia.org/wiki/Spesiaal:Soek"
+ },
+ "suggestUrl": {
+ "message": "https://af.wikipedia.org/w/api.php"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/an/messages.json b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/an/messages.json
new file mode 100644
index 0000000000..d21d910463
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/_locales/an/messages.json
@@ -0,0 +1,17 @@
+{
+ "extensionName": {
+ "message": "Multilocale"
+ },
+ "extensionDescription": {
+ "message": "A enciclopedia Libre"
+ },
+ "url_lang": {
+ "message": "an"
+ },
+ "searchUrl": {
+ "message": "https://an.wikipedia.org/wiki/Especial:Mirar"
+ },
+ "suggestUrl": {
+ "message": "https://an.wikipedia.org/w/api.php"
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/favicon.ico b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/favicon.ico
new file mode 100644
index 0000000000..4314071e24
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/favicon.ico
Binary files differ
diff --git a/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/manifest.json b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/manifest.json
new file mode 100644
index 0000000000..0fd835ca40
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/geolookup-extensions/multilocale/manifest.json
@@ -0,0 +1,23 @@
+{
+ "name": "__MSG_extensionName__",
+ "manifest_version": 2,
+ "version": "1.0",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "multilocale@search.mozilla.org"
+ }
+ },
+ "hidden": true,
+ "description": "__MSG_extensionDescription__",
+ "icons": {
+ "16": "favicon.ico"
+ },
+ "default_locale": "af",
+ "chrome_settings_overrides": {
+ "search_provider": {
+ "name": "__MSG_extensionName__",
+ "search_url": "__MSG_searchUrl__",
+ "suggest_url": "__MSG_searchUrl__"
+ }
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/iconsRedirect.sjs b/toolkit/components/search/tests/xpcshell/data/iconsRedirect.sjs
new file mode 100644
index 0000000000..98f9aed4d0
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/iconsRedirect.sjs
@@ -0,0 +1,18 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Redirect a request for an icon to a different place, using a different
+ * content-type.
+ */
+
+function handleRequest(request, response) {
+ response.setStatusLine("1.1", 302, "Moved");
+ if (request.queryString == "type=invalid") {
+ response.setHeader("Content-Type", "image/png", false);
+ response.setHeader("Location", "/head_search.js", false);
+ } else {
+ response.setHeader("Content-Type", "text/html", false);
+ response.setHeader("Location", "remoteIcon.ico", false);
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/remoteIcon.ico b/toolkit/components/search/tests/xpcshell/data/remoteIcon.ico
new file mode 100644
index 0000000000..442ab4dc80
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/remoteIcon.ico
Binary files differ
diff --git a/toolkit/components/search/tests/xpcshell/data/search-legacy-correct-default-engine-hashes.json b/toolkit/components/search/tests/xpcshell/data/search-legacy-correct-default-engine-hashes.json
new file mode 100644
index 0000000000..e6091b7230
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-legacy-correct-default-engine-hashes.json
@@ -0,0 +1,112 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {
+ "current": "engine2",
+ "private": "engine2"
+ },
+ "engines": [
+ {
+ "_name": "engine1",
+ "_shortName": "engine1",
+ "_loadPath": "[other]addEngineWithDetails:engine1@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico"
+ },
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_urls": [
+ {
+ "template": "https://1.example.com/search",
+ "rels": [],
+ "resultDomain": "1.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine1@search.mozilla.org"
+ },
+ {
+ "_name": "engine2",
+ "_shortName": "engine2",
+ "_loadPath": "[other]addEngineWithDetails:engine2@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico"
+ },
+ "_metaData": {
+ "alias": null,
+ "hidden": false
+ },
+ "_urls": [
+ {
+ "template": "https://2.example.com/search",
+ "rels": [],
+ "resultDomain": "2.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine2@search.mozilla.org"
+ },
+ {
+ "_name": "Test search engine",
+ "_shortName": "test-search-engine",
+ "description": "A test search engine (based on Google search)",
+ "__searchForm": "http://www.google.com/",
+ "_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}",
+ "rels": [],
+ "resultDomain": "suggestqueries.google.com",
+ "type": "application/x-suggestions+json",
+ "params": []
+ },
+ {
+ "template": "http://www.google.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "value": "fflb",
+ "purpose": "keyword"
+ },
+ {
+ "name": "channel",
+ "value": "rcs",
+ "purpose": "contextmenu"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "extensionID": "test-addon-id@mozilla.org"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-legacy-no-ids.json b/toolkit/components/search/tests/xpcshell/data/search-legacy-no-ids.json
new file mode 100644
index 0000000000..733c323876
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-legacy-no-ids.json
@@ -0,0 +1,87 @@
+{
+ "version": 6,
+ "engines": [
+ { "_name": "Google", "_isAppProvided": true, "_metaData": { "order": 1 } },
+ {
+ "_name": "Wikipedia (en)",
+ "_isAppProvided": true,
+ "_metaData": { "order": 7 }
+ },
+ { "_name": "Bing", "_isAppProvided": true, "_metaData": { "order": 3 } },
+ {
+ "_name": "Amazon.co.uk",
+ "_isAppProvided": true,
+ "_metaData": { "order": 2 }
+ },
+ {
+ "_name": "DuckDuckGo",
+ "_isAppProvided": true,
+ "_metaData": { "order": 4 }
+ },
+ { "_name": "eBay", "_isAppProvided": true, "_metaData": { "order": 5 } },
+ {
+ "_name": "Policy",
+ "_loadPath": "[other]addEngineWithDetails:set-via-policy",
+ "_metaData": { "alias": "PolicyAlias", "order": 6 }
+ },
+ {
+ "_name": "Bugzilla@Mozilla",
+ "_loadPath": "[https]bugzilla.mozilla.org/bugzillamozilla.xml",
+ "description": "Bugzilla@Mozilla Quick Search",
+ "_metaData": {
+ "loadPathHash": "Bxz6jVe3IIBxLLaafUus536LMyLKoGZm7xsBv/yiTw8=",
+ "order": 8,
+ "alias": "bugzillaAlias"
+ },
+ "_urls": [
+ {
+ "params": [],
+ "rels": [],
+ "template": "https://bugzilla.mozilla.org/buglist.cgi?quicksearch={searchTerms}"
+ }
+ ],
+ "_orderHint": null,
+ "_telemetryId": null,
+ "_updateInterval": null,
+ "_updateURL": null,
+ "_iconUpdateURL": null,
+ "_extensionID": null,
+ "_locale": null,
+ "_definedAliases": []
+ },
+ {
+ "_name": "User",
+ "_loadPath": "[other]addEngineWithDetails:set-via-user",
+ "_metaData": {
+ "order": 9,
+ "alias": "UserAlias"
+ },
+ "_urls": [
+ {
+ "params": [],
+ "rels": [],
+ "template": "https://example.com/test?q={searchTerms}"
+ }
+ ],
+ "_telemetryId": null,
+ "_updateInterval": null,
+ "_updateURL": null,
+ "_iconUpdateURL": null,
+ "_extensionID": null,
+ "_locale": null,
+ "_hasPreferredIcon": null
+ },
+ { "_name": "Amazon.com", "_isAppProvided": true, "_metaData": {} }
+ ],
+ "metaData": {
+ "useSavedOrder": true,
+ "locale": "en-US",
+ "region": "GB",
+ "channel": "default",
+ "experiment": "",
+ "distroID": "",
+ "appDefaultEngine": "Google",
+ "current": "Bing",
+ "hash": "5Of6s1D+BDjPRti1wqtFyBTH1PnOf9n6cRwWlEXZhd0="
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-legacy-old-loadPaths.json b/toolkit/components/search/tests/xpcshell/data/search-legacy-old-loadPaths.json
new file mode 100644
index 0000000000..f716fb3e4a
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-legacy-old-loadPaths.json
@@ -0,0 +1,135 @@
+{
+ "version": 7,
+ "engines": [
+ {
+ "id": "google@search.mozilla.orgdefault",
+ "_name": "Google",
+ "_isAppProvided": true,
+ "_metaData": { "order": 1 }
+ },
+ {
+ "id": "amazon@search.mozilla.orgen-GB",
+ "_name": "Amazon.co.uk",
+ "_isAppProvided": true,
+ "_metaData": { "order": 2 }
+ },
+ {
+ "id": "bing@search.mozilla.orgdefault",
+ "_name": "Bing",
+ "_isAppProvided": true,
+ "_metaData": { "order": 3 }
+ },
+ {
+ "id": "ddg@search.mozilla.orgdefault",
+ "_name": "DuckDuckGo",
+ "_isAppProvided": true,
+ "_metaData": { "order": 4 }
+ },
+ {
+ "id": "ebay@search.mozilla.orguk",
+ "_name": "eBay",
+ "_isAppProvided": true,
+ "_metaData": { "order": 5 }
+ },
+ {
+ "id": "wikipedia@search.mozilla.orgdefault",
+ "_name": "Wikipedia (en)",
+ "_isAppProvided": true,
+ "_metaData": { "order": 6 }
+ },
+ {
+ "id": "policy-Policy",
+ "_name": "Policy",
+ "_loadPath": "[other]addEngineWithDetails:set-via-policy",
+ "_metaData": { "alias": "PolicyAlias", "order": 6 }
+ },
+ {
+ "id": "bbc163e7-7b1a-47aa-a32c-c59062de2753",
+ "_name": "Bugzilla@Mozilla",
+ "_loadPath": "[https]bugzilla.mozilla.org/bugzillamozilla.xml",
+ "description": "Bugzilla@Mozilla Quick Search",
+ "_metaData": {
+ "loadPathHash": "Bxz6jVe3IIBxLLaafUus536LMyLKoGZm7xsBv/yiTw8=",
+ "order": 8,
+ "alias": "bugzillaAlias"
+ },
+ "_urls": [
+ {
+ "params": [],
+ "rels": [],
+ "template": "https://bugzilla.mozilla.org/buglist.cgi?quicksearch={searchTerms}"
+ }
+ ],
+ "_orderHint": null,
+ "_telemetryId": null,
+ "_updateInterval": null,
+ "_updateURL": null,
+ "_iconUpdateURL": null,
+ "_extensionID": null,
+ "_locale": null,
+ "_definedAliases": []
+ },
+ {
+ "id": "bbc163e7-7b1a-47aa-a32c-c59062de2754",
+ "_name": "User",
+ "_loadPath": "[other]addEngineWithDetails:set-via-user",
+ "_metaData": {
+ "order": 9,
+ "alias": "UserAlias"
+ },
+ "_urls": [
+ {
+ "params": [],
+ "rels": [],
+ "template": "https://example.com/test?q={searchTerms}"
+ }
+ ],
+ "_telemetryId": null,
+ "_updateInterval": null,
+ "_updateURL": null,
+ "_iconUpdateURL": null,
+ "_extensionID": null,
+ "_locale": null,
+ "_hasPreferredIcon": null
+ },
+ {
+ "id": "example@tests.mozilla.orgdefault",
+ "_name": "Example",
+ "_loadPath": "[other]addEngineWithDetails:example@tests.mozilla.org",
+ "description": null,
+ "_iconURL": "",
+ "_metaData": {},
+ "_urls": [
+ {
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ],
+ "rels": [],
+ "template": "https://example.com/"
+ }
+ ],
+ "_telemetryId": null,
+ "_updateInterval": null,
+ "_updateURL": null,
+ "_iconUpdateURL": null,
+ "_extensionID": "example@tests.mozilla.org",
+ "_locale": "default",
+ "_definedAliases": [],
+ "_hasPreferredIcon": null
+ }
+ ],
+ "metaData": {
+ "useSavedOrder": true,
+ "locale": "en-US",
+ "region": "GB",
+ "channel": "default",
+ "experiment": "",
+ "distroID": "",
+ "appDefaultEngine": "Google",
+ "current": "Bing",
+ "hash": "5Of6s1D+BDjPRti1wqtFyBTH1PnOf9n6cRwWlEXZhd0="
+ }
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-default-engine-hashes.json b/toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-default-engine-hashes.json
new file mode 100644
index 0000000000..ca7081f565
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-default-engine-hashes.json
@@ -0,0 +1,114 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {
+ "current": "engine2",
+ "private": "engine2",
+ "hash": "wrong-hash-o/HzjHlVpb97AFGH3pY1GZ6CoTQkQslUKRd38/qasto=",
+ "privateHash": "wrong-hash-o/HzjHlVpb97AFGH3pY1GZ6CoTQkQslUKRd38/qasto="
+ },
+ "engines": [
+ {
+ "_name": "engine1",
+ "_shortName": "engine1",
+ "_loadPath": "[other]addEngineWithDetails:engine1@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico"
+ },
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_urls": [
+ {
+ "template": "https://1.example.com/search",
+ "rels": [],
+ "resultDomain": "1.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine1@search.mozilla.org"
+ },
+ {
+ "_name": "engine2",
+ "_shortName": "engine2",
+ "_loadPath": "[other]addEngineWithDetails:engine2@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico"
+ },
+ "_metaData": {
+ "alias": null,
+ "hidden": false
+ },
+ "_urls": [
+ {
+ "template": "https://2.example.com/search",
+ "rels": [],
+ "resultDomain": "2.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine2@search.mozilla.org"
+ },
+ {
+ "_name": "Test search engine",
+ "_shortName": "test-search-engine",
+ "description": "A test search engine (based on Google search)",
+ "__searchForm": "http://www.google.com/",
+ "_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}",
+ "rels": [],
+ "resultDomain": "suggestqueries.google.com",
+ "type": "application/x-suggestions+json",
+ "params": []
+ },
+ {
+ "template": "http://www.google.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "value": "fflb",
+ "purpose": "keyword"
+ },
+ {
+ "name": "channel",
+ "value": "rcs",
+ "purpose": "contextmenu"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "extensionID": "test-addon-id@mozilla.org"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-third-party-engine-hashes.json b/toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-third-party-engine-hashes.json
new file mode 100644
index 0000000000..25329e083f
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-legacy-wrong-third-party-engine-hashes.json
@@ -0,0 +1,114 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {
+ "current": "Test search engine",
+ "private": "Test search engine",
+ "hash": "wrong-hash-o/HzjHlVpb97AFGH3pY1GZ6CoTQkQslUKRd38/qasto=",
+ "privateHash": "wrong-hash-o/HzjHlVpb97AFGH3pY1GZ6CoTQkQslUKRd38/qasto="
+ },
+ "engines": [
+ {
+ "_name": "engine1",
+ "_shortName": "engine1",
+ "_loadPath": "[other]addEngineWithDetails:engine1@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico"
+ },
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_urls": [
+ {
+ "template": "https://1.example.com/search",
+ "rels": [],
+ "resultDomain": "1.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine1@search.mozilla.org"
+ },
+ {
+ "_name": "engine2",
+ "_shortName": "engine2",
+ "_loadPath": "[other]addEngineWithDetails:engine2@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico"
+ },
+ "_metaData": {
+ "alias": null,
+ "hidden": false
+ },
+ "_urls": [
+ {
+ "template": "https://2.example.com/search",
+ "rels": [],
+ "resultDomain": "2.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine2@search.mozilla.org"
+ },
+ {
+ "_name": "Test search engine",
+ "_shortName": "test-search-engine",
+ "description": "A test search engine (based on Google search)",
+ "__searchForm": "http://www.google.com/",
+ "_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}",
+ "rels": [],
+ "resultDomain": "suggestqueries.google.com",
+ "type": "application/x-suggestions+json",
+ "params": []
+ },
+ {
+ "template": "http://www.google.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "value": "fflb",
+ "purpose": "keyword"
+ },
+ {
+ "name": "channel",
+ "value": "rcs",
+ "purpose": "contextmenu"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "extensionID": "test-addon-id@mozilla.org"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-legacy.json b/toolkit/components/search/tests/xpcshell/data/search-legacy.json
new file mode 100644
index 0000000000..c8416f3813
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-legacy.json
@@ -0,0 +1,109 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "_name": "engine1",
+ "_shortName": "engine1",
+ "_loadPath": "[other]addEngineWithDetails:engine1@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://9c38b851-bede-2244-a086-9be8128dd64d/favicon.ico"
+ },
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_urls": [
+ {
+ "template": "https://1.example.com/search",
+ "rels": [],
+ "resultDomain": "1.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine1@search.mozilla.org"
+ },
+ {
+ "_name": "engine2",
+ "_shortName": "engine2",
+ "_loadPath": "[other]addEngineWithDetails:engine2@search.mozilla.org",
+ "description": "A small test engine",
+ "__searchForm": null,
+ "_iconURL": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico",
+ "_iconMapObj": {
+ "{}": "moz-extension://0ea1d9b5-a14c-0e42-afaf-f25e8261c135/favicon.ico"
+ },
+ "_metaData": {
+ "alias": null,
+ "hidden": true
+ },
+ "_urls": [
+ {
+ "template": "https://2.example.com/search",
+ "rels": [],
+ "resultDomain": "2.example.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "_isBuiltin": true,
+ "queryCharset": "UTF-8",
+ "extensionID": "engine2@search.mozilla.org"
+ },
+ {
+ "_name": "Test search engine",
+ "_shortName": "test-search-engine",
+ "description": "A test search engine (based on Google search)",
+ "__searchForm": "http://www.google.com/",
+ "_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}",
+ "rels": [],
+ "resultDomain": "suggestqueries.google.com",
+ "type": "application/x-suggestions+json",
+ "params": []
+ },
+ {
+ "template": "http://www.google.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "value": "fflb",
+ "purpose": "keyword"
+ },
+ {
+ "name": "channel",
+ "value": "rcs",
+ "purpose": "contextmenu"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "extensionID": "test-addon-id@mozilla.org"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-migration.json b/toolkit/components/search/tests/xpcshell/data/search-migration.json
new file mode 100644
index 0000000000..520149a370
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-migration.json
@@ -0,0 +1,68 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "_name": "engine1",
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "engine2",
+ "_metaData": {
+ "alias": null,
+ "hidden": true
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "simple",
+ "_loadPath": "jar:[profile]/extensions/simple@tests.mozilla.org.xpi!/simple.xml",
+ "_shortName": "simple",
+ "description": "A migration test engine",
+ "__searchForm": "http://www.example.com/",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://www.example.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8"
+ },
+ {
+ "_name": "simple search",
+ "_loadPath": "[other]addEngineWithDetails:simple@tests.mozilla.org",
+ "_shortName": "simple search",
+ "description": "A migration test engine",
+ "__searchForm": "http://www.example.com/",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://www.example.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "_extensionID": "simple@tests.mozilla.org"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-obsolete-app.json b/toolkit/components/search/tests/xpcshell/data/search-obsolete-app.json
new file mode 100644
index 0000000000..151359ff73
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-obsolete-app.json
@@ -0,0 +1,41 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "_name": "engine1",
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "engine2",
+ "_metaData": {
+ "alias": null,
+ "hidden": true
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "App",
+ "_shortName": "app",
+ "_loadPath": "jar:[app]/omni.ja!distribution.xml",
+ "description": "App Search",
+ "__searchForm": null,
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "https://example.com/search",
+ "rels": ["searchform"],
+ "resultDomain": "example.com",
+ "params": []
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "_readOnly": false
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-obsolete-distribution.json b/toolkit/components/search/tests/xpcshell/data/search-obsolete-distribution.json
new file mode 100644
index 0000000000..efc609a5af
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-obsolete-distribution.json
@@ -0,0 +1,41 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "_name": "engine1",
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "engine2",
+ "_metaData": {
+ "alias": null,
+ "hidden": true
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "Distribution",
+ "_shortName": "distribution",
+ "_loadPath": "[distribution]/searchplugins/common/distribution.xml",
+ "description": "Distribution Search",
+ "__searchForm": null,
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "https://example.com/search",
+ "rels": ["searchform"],
+ "resultDomain": "example.com",
+ "params": []
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "_readOnly": false
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search-obsolete-langpack.json b/toolkit/components/search/tests/xpcshell/data/search-obsolete-langpack.json
new file mode 100644
index 0000000000..8c45b4d61f
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search-obsolete-langpack.json
@@ -0,0 +1,91 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "_name": "engine1",
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "engine2",
+ "_metaData": {
+ "alias": null,
+ "hidden": true
+ },
+ "_isAppProvided": true
+ },
+ {
+ "_name": "Langpack",
+ "_shortName": "langpack-ru",
+ "_loadPath": "jar:[app]/extensions/langpack-ru@firefox.mozilla.org.xpi!browser/langpack.xml",
+ "description": "Langpack search",
+ "__searchForm": null,
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "https://example.com/search",
+ "rels": ["searchform"],
+ "resultDomain": "example.com",
+ "params": []
+ }
+ ],
+ "queryCharset": "UTF-8"
+ },
+ {
+ "_name": "Langpack1",
+ "_shortName": "langpack1-ru",
+ "_loadPath": "[app]/extensions/langpack-ru@firefox.mozilla.org.xpi!browser/langpack1.xml",
+ "description": "Langpack1 search",
+ "__searchForm": null,
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "https://example1.com/search",
+ "rels": ["searchform"],
+ "resultDomain": "example1.com",
+ "params": []
+ }
+ ],
+ "queryCharset": "UTF-8"
+ },
+ {
+ "_name": "Langpack2",
+ "_shortName": "langpack2-ru",
+ "_loadPath": "jar:[profile]/extensions/langpack-ru@firefox.mozilla.org.xpi!browser/langpack2.xml",
+ "description": "Langpack2 search",
+ "__searchForm": null,
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "https://example2.com/search",
+ "rels": ["searchform"],
+ "resultDomain": "example2.com",
+ "params": []
+ }
+ ],
+ "queryCharset": "UTF-8"
+ },
+ {
+ "_name": "Langpack3",
+ "_shortName": "langpack3-ru",
+ "_loadPath": "jar:[other]/langpack-ru@firefox.mozilla.org.xpi!browser/langpack3.xml",
+ "description": "Langpack3 search",
+ "__searchForm": null,
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "https://example3.com/search",
+ "rels": ["searchform"],
+ "resultDomain": "example3.com",
+ "params": []
+ }
+ ],
+ "queryCharset": "UTF-8"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search.json b/toolkit/components/search/tests/xpcshell/data/search.json
new file mode 100644
index 0000000000..f757af2ab3
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search.json
@@ -0,0 +1,66 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "id": "engine1@search.mozilla.orgdefault",
+ "_name": "engine1",
+ "_metaData": {
+ "alias": "testAlias"
+ },
+ "_isAppProvided": true
+ },
+ {
+ "id": "engine2@search.mozilla.orgdefault",
+ "_name": "engine2",
+ "_metaData": {
+ "alias": null,
+ "hidden": true
+ },
+ "_isAppProvided": true
+ },
+ {
+ "id": "test-addon-id@mozilla.orgdefault",
+ "_name": "Test search engine",
+ "_shortName": "test-search-engine",
+ "description": "A test search engine (based on Google search)",
+ "__searchForm": "http://www.google.com/",
+ "_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}",
+ "rels": [],
+ "resultDomain": "suggestqueries.google.com",
+ "type": "application/x-suggestions+json",
+ "params": []
+ },
+ {
+ "template": "http://www.google.com/search",
+ "rels": [],
+ "resultDomain": "google.com",
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "channel",
+ "value": "fflb",
+ "purpose": "searchbar"
+ },
+ {
+ "name": "channel",
+ "value": "rcs",
+ "purpose": "contextmenu"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8",
+ "_extensionID": "test-addon-id@mozilla.org"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs b/toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs
new file mode 100644
index 0000000000..2eaa2684c4
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/searchSuggestions.sjs
@@ -0,0 +1,187 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+let { setTimeout } = ChromeUtils.importESModule(
+ "resource://gre/modules/Timer.sys.mjs"
+);
+let { NetUtil } = ChromeUtils.importESModule(
+ "resource://gre/modules/NetUtil.sys.mjs"
+);
+
+/**
+ * Provide search suggestions in the OpenSearch JSON format.
+ */
+
+function handleRequest(request, response) {
+ // Get the query parameters from the query string.
+ let query = parseQueryString(request.queryString);
+
+ function convertToUtf8(str) {
+ return String.fromCharCode(...new TextEncoder().encode(str));
+ }
+
+ function writeSuggestions(q, completions = []) {
+ let jsonString = JSON.stringify([q, completions]);
+
+ // This script must be evaluated as UTF-8 for this to write out the bytes of
+ // the string in UTF-8. If it's evaluated as Latin-1, the written bytes
+ // will be the result of UTF-8-encoding the result-string *twice*, which
+ // will break the "I ❤️" case further down.
+ let stringOfUtf8Bytes = convertToUtf8(jsonString);
+
+ response.write(stringOfUtf8Bytes);
+ }
+
+ /**
+ * Sends `data` as suggestions directly. This is useful when testing rich
+ * suggestions, which do not conform to the object shape sent by
+ * writeSuggestions.
+ *
+ * @param {Array} data The data to send as suggestions.
+ */
+ function writeSuggestionsDirectly(data) {
+ let jsonString = JSON.stringify(data);
+ let stringOfUtf8Bytes = convertToUtf8(jsonString);
+ response.setHeader("Content-Type", "application/json", false);
+ response.write(stringOfUtf8Bytes);
+ }
+
+ response.setStatusLine(request.httpVersion, 200, "OK");
+
+ let q = request.method == "GET" ? query.q : undefined;
+ if (q == "cookie") {
+ response.setHeader("Set-Cookie", "cookie=1");
+ writeSuggestions(q);
+ } else if (q == "no remote" || q == "no results") {
+ writeSuggestions(q);
+ } else if (q == "Query Mismatch") {
+ writeSuggestions("This is an incorrect query string", ["some result"]);
+ } else if (q == "Query Case Mismatch") {
+ writeSuggestions(q.toUpperCase(), [q]);
+ } else if (q == "") {
+ writeSuggestions("", ["The server should never be sent an empty query"]);
+ } else if (q?.startsWith("mo")) {
+ writeSuggestions(q, ["Mozilla", "modern", "mom"]);
+ } else if (q?.startsWith("I ❤️")) {
+ writeSuggestions(q, ["I ❤️ Mozilla"]);
+ } else if (q?.startsWith("stü")) {
+ writeSuggestions("st\\u00FC", ["stühle", "stüssy"]);
+ } else if (q?.startsWith("tailjunk ")) {
+ writeSuggestionsDirectly([
+ q,
+ [q + " normal", q + " tail 1", q + " tail 2"],
+ [],
+ {
+ "google:irrelevantparameter": [],
+ "google:badformat": {
+ "google:suggestdetail": [
+ {},
+ { mp: "… ", t: "tail 1" },
+ { mp: "… ", t: "tail 2" },
+ ],
+ },
+ },
+ ]);
+ } else if (q?.startsWith("tailjunk few ")) {
+ writeSuggestionsDirectly([
+ q,
+ [q + " normal", q + " tail 1", q + " tail 2"],
+ [],
+ {
+ "google:irrelevantparameter": [],
+ "google:badformat": {
+ "google:suggestdetail": [{ mp: "… ", t: "tail 1" }],
+ },
+ },
+ ]);
+ } else if (q?.startsWith("tailalt ")) {
+ writeSuggestionsDirectly([
+ q,
+ [q + " normal", q + " tail 1", q + " tail 2"],
+ {
+ "google:suggestdetail": [
+ {},
+ { mp: "… ", t: "tail 1" },
+ { mp: "… ", t: "tail 2" },
+ ],
+ },
+ ]);
+ } else if (q?.startsWith("tail ")) {
+ writeSuggestionsDirectly([
+ q,
+ [q + " normal", q + " tail 1", q + " tail 2"],
+ [],
+ {
+ "google:irrelevantparameter": [],
+ "google:suggestdetail": [
+ {},
+ { mp: "… ", t: "tail 1" },
+ { mp: "… ", t: "tail 2" },
+ ],
+ },
+ ]);
+ } else if (q?.startsWith("richempty ")) {
+ writeSuggestionsDirectly([
+ q,
+ [q + " normal", q + " tail 1", q + " tail 2"],
+ [],
+ {
+ "google:irrelevantparameter": [],
+ "google:suggestdetail": [],
+ },
+ ]);
+ } else if (q?.startsWith("letter ")) {
+ let letters = [];
+ for (
+ let charCode = "A".charCodeAt();
+ charCode <= "Z".charCodeAt();
+ charCode++
+ ) {
+ letters.push("letter " + String.fromCharCode(charCode));
+ }
+ writeSuggestions(q, letters);
+ } else if (q?.startsWith("HTTP ")) {
+ response.setStatusLine(request.httpVersion, q.replace("HTTP ", ""), q);
+ writeSuggestions(q, [q]);
+ } else if (q == "invalidJSON") {
+ response.setHeader("Content-Type", "application/json", false);
+ response.write('["invalid"]');
+ } else if (q == "invalidContentType") {
+ response.setHeader("Content-Type", "text/xml", false);
+ writeSuggestions(q, ["invalidContentType response"]);
+ } else if (q?.startsWith("delay")) {
+ // Delay the response by delayMs milliseconds. 200ms is the default, less
+ // than the timeout but hopefully enough to abort before completion.
+ let match = /^delay([0-9]+)/.exec(q);
+ let delayMs = match ? parseInt(match[1]) : 200;
+ response.processAsync();
+ writeSuggestions(q, [q]);
+ setTimeout(() => response.finish(), delayMs);
+ } else if (q?.startsWith("slow ")) {
+ // Delay the response by 10 seconds so the client timeout is reached.
+ response.processAsync();
+ writeSuggestions(q, [q]);
+ setTimeout(() => response.finish(), 10000);
+ } else if (request.method == "POST") {
+ // This includes headers, not just the body
+ let requestText = NetUtil.readInputStreamToString(
+ request.bodyInputStream,
+ request.bodyInputStream.available()
+ );
+ // Only use the last line which contains the encoded params
+ let requestLines = requestText.split("\n");
+ let postParams = parseQueryString(requestLines[requestLines.length - 1]);
+ writeSuggestions(postParams.q, ["Mozilla", "modern", "mom"]);
+ } else {
+ response.setStatusLine(request.httpVersion, 404, "Not Found");
+ }
+}
+
+function parseQueryString(queryString) {
+ let query = {};
+ queryString.split("&").forEach(function (val) {
+ let [name, value] = val.split("=");
+ query[name] = decodeURIComponent(value).replace(/[+]/g, " ");
+ });
+ return query;
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/search_ignorelist.json b/toolkit/components/search/tests/xpcshell/data/search_ignorelist.json
new file mode 100644
index 0000000000..35240893ec
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/search_ignorelist.json
@@ -0,0 +1,51 @@
+{
+ "version": 1,
+ "buildID": "20121106",
+ "locale": "en-US",
+ "metaData": {},
+ "engines": [
+ {
+ "_name": "Test search engine",
+ "_shortName": "test-search-engine",
+ "description": "A test search engine (based on Google search)",
+ "extensionID": "test-addon-id@mozilla.org",
+ "__searchForm": "http://www.google.com/",
+ "_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
+ "_metaData": {},
+ "_urls": [
+ {
+ "template": "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}",
+ "rels": [],
+ "type": "application/x-suggestions+json",
+ "params": []
+ },
+ {
+ "template": "http://www.google.com/search",
+ "resultDomain": "google.com",
+ "rels": [],
+ "params": [
+ {
+ "name": "q",
+ "value": "{searchTerms}"
+ },
+ {
+ "name": "ignore",
+ "value": "true"
+ },
+ {
+ "name": "channel",
+ "value": "fflb",
+ "purpose": "keyword"
+ },
+ {
+ "name": "channel",
+ "value": "rcs",
+ "purpose": "contextmenu"
+ }
+ ]
+ }
+ ],
+ "queryCharset": "UTF-8"
+ }
+ ]
+}
diff --git a/toolkit/components/search/tests/xpcshell/data/svgIcon.svg b/toolkit/components/search/tests/xpcshell/data/svgIcon.svg
new file mode 100644
index 0000000000..e2550f8d5d
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/data/svgIcon.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="16" height="16" viewBox="0 0 16 16">
+ <rect x="4" y="4" width="8px" height="8px" style="fill: blue" />
+</svg>