summaryrefslogtreecommitdiffstats
path: root/toolkit/components/webextensions/test/xpcshell/head.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-02-13 19:11:37 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-02-13 19:11:37 +0100
commit43d44975b1f49df640916cca5f6a0b138696da3c (patch)
tree98b95bb1043fc6a599e3c02fbb9b1ee7a363bf89 /toolkit/components/webextensions/test/xpcshell/head.js
parent6bb02d95f70000b150569089987701c8244d7d5d (diff)
downloadUXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar.gz
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar.lz
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.tar.xz
UXP-43d44975b1f49df640916cca5f6a0b138696da3c.zip
Remove WebExtension support from the platform.
- Conditional code - WE APIs - WE toolkit theming
Diffstat (limited to 'toolkit/components/webextensions/test/xpcshell/head.js')
-rw-r--r--toolkit/components/webextensions/test/xpcshell/head.js111
1 files changed, 0 insertions, 111 deletions
diff --git a/toolkit/components/webextensions/test/xpcshell/head.js b/toolkit/components/webextensions/test/xpcshell/head.js
deleted file mode 100644
index 9e22be6da..000000000
--- a/toolkit/components/webextensions/test/xpcshell/head.js
+++ /dev/null
@@ -1,111 +0,0 @@
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-/* exported createHttpServer, promiseConsoleOutput, cleanupDir */
-
-Components.utils.import("resource://gre/modules/Task.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Timer.jsm");
-Components.utils.import("resource://testing-common/AddonTestUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
- "resource://gre/modules/AppConstants.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Extension",
- "resource://gre/modules/Extension.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ExtensionData",
- "resource://gre/modules/Extension.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement",
- "resource://gre/modules/ExtensionManagement.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ExtensionTestUtils",
- "resource://testing-common/ExtensionXPCShellUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
- "resource://gre/modules/FileUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
- "resource://testing-common/httpd.js");
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
- "resource://gre/modules/NetUtil.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Schemas",
- "resource://gre/modules/Schemas.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Services",
- "resource://gre/modules/Services.jsm");
-
-ExtensionTestUtils.init(this);
-
-/**
- * Creates a new HttpServer for testing, and begins listening on the
- * specified port. Automatically shuts down the server when the test
- * unit ends.
- *
- * @param {integer} [port]
- * The port to listen on. If omitted, listen on a random
- * port. The latter is the preferred behavior.
- *
- * @returns {HttpServer}
- */
-function createHttpServer(port = -1) {
- let server = new HttpServer();
- server.start(port);
-
- do_register_cleanup(() => {
- return new Promise(resolve => {
- server.stop(resolve);
- });
- });
-
- return server;
-}
-
-var promiseConsoleOutput = Task.async(function* (task) {
- const DONE = `=== console listener ${Math.random()} done ===`;
-
- let listener;
- let messages = [];
- let awaitListener = new Promise(resolve => {
- listener = msg => {
- if (msg == DONE) {
- resolve();
- } else {
- void (msg instanceof Ci.nsIConsoleMessage);
- messages.push(msg);
- }
- };
- });
-
- Services.console.registerListener(listener);
- try {
- let result = yield task();
-
- Services.console.logStringMessage(DONE);
- yield awaitListener;
-
- return {messages, result};
- } finally {
- Services.console.unregisterListener(listener);
- }
-});
-
-// Attempt to remove a directory. If the Windows OS is still using the
-// file sometimes remove() will fail. So try repeatedly until we can
-// remove it or we give up.
-function cleanupDir(dir) {
- let count = 0;
- return new Promise((resolve, reject) => {
- function tryToRemoveDir() {
- count += 1;
- try {
- dir.remove(true);
- } catch (e) {
- // ignore
- }
- if (!dir.exists()) {
- return resolve();
- }
- if (count >= 25) {
- return reject(`Failed to cleanup directory: ${dir}`);
- }
- setTimeout(tryToRemoveDir, 100);
- }
- tryToRemoveDir();
- });
-}