/* 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"
);
/** * After useHttpServer() is called, this string contains the URL of the "data" * directory, including the final slash.
*/ var gDataUrl;
/** * Initializes the HTTP server and ensures that it is terminated when tests end. * * @param {string} dir * The test sub-directory to use for the engines. * @returns {HttpServer} * The HttpServer object in case further customization is needed.
*/ 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 httpServer;
}
async function addTestEngines() {
useHttpServer(); // This is a hack, ideally we should be setting up a configuration with // built-in engines, but the `chrome_settings_overrides` section that // WebExtensions need is only defined for browser/
await SearchTestUtils.installOpenSearchEngine({
url: `${gDataUrl}/engine.xml`,
});
await SearchTestUtils.installOpenSearchEngine({
url: `${gDataUrl}/enginePrivate.xml`,
});
await SearchTestUtils.installOpenSearchEngine({
url: `${gDataUrl}/enginePost.xml`,
});
}
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.