diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-04-23 13:38:38 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-04-23 13:38:38 -0400 |
commit | 0c84220a4f93a3e4f48d8d183aa0f5d8b15eb7ab (patch) | |
tree | 9bd44f6fe33bc8217cec52d5a3ba0c9b4ae03c40 /toolkit/components/search/tests/xpcshell/data/engineMaker.sjs | |
parent | 228e55129b510f259535810ac31f1777b75ba526 (diff) | |
download | UXP-0c84220a4f93a3e4f48d8d183aa0f5d8b15eb7ab.tar UXP-0c84220a4f93a3e4f48d8d183aa0f5d8b15eb7ab.tar.gz UXP-0c84220a4f93a3e4f48d8d183aa0f5d8b15eb7ab.tar.lz UXP-0c84220a4f93a3e4f48d8d183aa0f5d8b15eb7ab.tar.xz UXP-0c84220a4f93a3e4f48d8d183aa0f5d8b15eb7ab.zip |
Remove tests from search service
Diffstat (limited to 'toolkit/components/search/tests/xpcshell/data/engineMaker.sjs')
-rw-r--r-- | toolkit/components/search/tests/xpcshell/data/engineMaker.sjs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs b/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs deleted file mode 100644 index 4c432e7ee..000000000 --- a/toolkit/components/search/tests/xpcshell/data/engineMaker.sjs +++ /dev/null @@ -1,54 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; - -/** - * Dynamically create a search engine offering search suggestions via searchSuggestions.sjs. - * - * The engine is constructed by passing a JSON object with engine datails 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. - */ -function createOpenSearchEngine(response, engineData) { - let params = "", queryString = ""; - if (engineData.method == "POST") { - params = "<Param name='q' value='{searchTerms}'/>"; - } else { - queryString = "?q={searchTerms}"; - } - - 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>\ - <Url type='application/x-suggestions+json' method='" + engineData.method + "'\ - template='" + engineData.baseURL + "searchSuggestions.sjs" + queryString + "'>\ - " + params + "\ - </Url>\ - <Url type='text/html' method='" + engineData.method + "'\ - template='" + engineData.baseURL + queryString + "'/>\ -</OpenSearchDescription>\ -"; - response.write(result); -} |