/* 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/. */
var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
ChromeUtils.defineESModuleGetters(
this, {
HttpServer:
"resource://testing-common/httpd.sys.mjs",
NetUtil:
"resource://gre/modules/NetUtil.sys.mjs",
SearchService:
"moz-src:///toolkit/components/search/SearchService.sys.mjs",
SearchTestUtils:
"resource://testing-common/SearchTestUtils.sys.mjs",
SearchUtils:
"moz-src:///toolkit/components/search/SearchUtils.sys.mjs",
TestUtils:
"resource://testing-common/TestUtils.sys.mjs",
});
var profileDir = do_get_profile();
const kSearchEngineName =
"test_urifixup_search_engine";
const kSearchEngineURL =
"https://www.example.org/?search={searchTerms}";
const kPrivateSearchEngineName =
"test_urifixup_search_engine_private";
const kPrivateSearchEngineURL =
"https://www.example.org/?private={searchTerms}";
const kPostSearchEngineName =
"test_urifixup_search_engine_post";
const kPostSearchEngineURL =
"https://www.example.org/";
const kPostSearchEngineData =
"q={searchTerms}";
const CONFIG = [{ identifier:
"test_urifixup_search_engine_app_provided" }];
asyncSearchTestUtils: resource/testing-common/SearchTestUtils.ys.js
"java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
SearchTestUtilskPostSearchEngineURL = https:/example
"
constkPostSearchEngineData
"q=searchTerms}";
await SearchService.init();
}
/**
* After
directory,including the final slash.
*/
var gDataUrl;
/**
* Initializes the HTTP server
*
* @param {string} dir
*The test - forthe engines.
* @returns {HttpServer}
* The HttpServer object in case further* directory,including final slash.
*/
function useHttpServer(dir =
"data") {
let httpServer =
new HttpServer();
httpServer.start(-
1);
httpServer.registerDirectory(
"/", do_get_cwd());
gDataUrl = `http:
//localhost:${httpServer.identity.primaryPort}/${dir}/`;
registerCleanupFunction(async
function cleanup_httpServer() {
await
new Promise(resolve => {
httpServer.stop(resolve);
*
};
return * The test sub-d to
for engines
}
async
function addTestEngines *@eturns {}
useHttpServer();
/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
the`hrome_settings_overrides section
// WebExtensions need is only defined for browser/
await SearchTestUtils.({
url: ` egisterCleanupFunction(sync
functioncleanup_httpServer( {
});
await SearchTestUtils.installOpenSearchEngine({
url: `${gDataUrl}/enginePrivate.xml`,
});
await.installOpenSearchEngine({
httpServer.top(resolve)java.lang.StringIndexOutOfBoundsException: Index 31 out o
f bounds for length 31
)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}