forked from mirrors/gecko-dev
Bug 1457835 - Enable ESLint for testing/mochitest (manual changes). r=jmaher
MozReview-Commit-ID: BoGnB1aQxm8 --HG-- extra : rebase_source : 3014c44fb75c24616da5ca35b4e0addaf9982d9e
This commit is contained in:
parent
7953526ea2
commit
d19d88da30
24 changed files with 139 additions and 76 deletions
|
|
@ -350,8 +350,11 @@ testing/marionette/doc
|
|||
testing/marionette/harness
|
||||
|
||||
# other testing/ exclusions
|
||||
testing/mochitest/**
|
||||
# third party modules
|
||||
testing/mochitest/tests/Harness_sanity/**
|
||||
testing/mochitest/MochiKit/**
|
||||
testing/mochitest/tests/MochiKit-1.4.2/**
|
||||
testing/mochitest/tests/SimpleTest/**
|
||||
testing/modules/ajv-4.1.1.js
|
||||
testing/modules/sinon-2.3.2.js
|
||||
# octothorpe used for pref file comment causes parsing error
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ stubPreparedMessages.set(`ReferenceError: asdf is not defined`, new ConsoleMessa
|
|||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js line 50 > eval",
|
||||
"filename": "resource://testing-common/content-task.js line 55 > eval",
|
||||
"lineNumber": 7,
|
||||
"columnNumber": 9,
|
||||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js",
|
||||
"lineNumber": 51,
|
||||
"lineNumber": 56,
|
||||
"columnNumber": 20,
|
||||
"functionName": null
|
||||
}
|
||||
|
|
@ -83,14 +83,14 @@ stubPreparedMessages.set(`SyntaxError: redeclaration of let a`, new ConsoleMessa
|
|||
"repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html\",\"line\":2,\"column\":9},\"groupId\":null,\"indent\":0,\"level\":\"error\",\"messageText\":\"SyntaxError: redeclaration of let a\",\"parameters\":null,\"source\":\"javascript\",\"type\":\"log\",\"userProvidedStyles\":null,\"private\":false}",
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js line 50 > eval",
|
||||
"filename": "resource://testing-common/content-task.js line 55 > eval",
|
||||
"lineNumber": 7,
|
||||
"columnNumber": 9,
|
||||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js",
|
||||
"lineNumber": 51,
|
||||
"lineNumber": 56,
|
||||
"columnNumber": 20,
|
||||
"functionName": null
|
||||
}
|
||||
|
|
@ -141,14 +141,14 @@ stubPreparedMessages.set(`TypeError longString message`, new ConsoleMessage({
|
|||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js line 50 > eval",
|
||||
"filename": "resource://testing-common/content-task.js line 55 > eval",
|
||||
"lineNumber": 7,
|
||||
"columnNumber": 9,
|
||||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js",
|
||||
"lineNumber": 51,
|
||||
"lineNumber": 56,
|
||||
"columnNumber": 20,
|
||||
"functionName": null
|
||||
}
|
||||
|
|
@ -247,14 +247,14 @@ stubPackets.set(`ReferenceError: asdf is not defined`, {
|
|||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js line 50 > eval",
|
||||
"filename": "resource://testing-common/content-task.js line 55 > eval",
|
||||
"lineNumber": 7,
|
||||
"columnNumber": 9,
|
||||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js",
|
||||
"lineNumber": 51,
|
||||
"lineNumber": 56,
|
||||
"columnNumber": 20,
|
||||
"functionName": null
|
||||
}
|
||||
|
|
@ -283,14 +283,14 @@ stubPackets.set(`SyntaxError: redeclaration of let a`, {
|
|||
"private": false,
|
||||
"stacktrace": [
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js line 50 > eval",
|
||||
"filename": "resource://testing-common/content-task.js line 55 > eval",
|
||||
"lineNumber": 7,
|
||||
"columnNumber": 9,
|
||||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js",
|
||||
"lineNumber": 51,
|
||||
"lineNumber": 56,
|
||||
"columnNumber": 20,
|
||||
"functionName": null
|
||||
}
|
||||
|
|
@ -339,14 +339,14 @@ stubPackets.set(`TypeError longString message`, {
|
|||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js line 50 > eval",
|
||||
"filename": "resource://testing-common/content-task.js line 55 > eval",
|
||||
"lineNumber": 7,
|
||||
"columnNumber": 9,
|
||||
"functionName": null
|
||||
},
|
||||
{
|
||||
"filename": "resource://testing-common/content-task.js",
|
||||
"lineNumber": 51,
|
||||
"lineNumber": 56,
|
||||
"columnNumber": 20,
|
||||
"functionName": null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
* callback based.
|
||||
*/
|
||||
|
||||
// This file uses ContentTask & frame scripts, where these are available.
|
||||
/* global addEventListener, removeEventListener, sendAsyncMessage,
|
||||
addMessageListener, removeMessageListener, privateNoteIntentionalCrash */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
|
|
@ -359,8 +363,6 @@ var BrowserTestUtils = {
|
|||
*/
|
||||
browserStopped(browser, expectedURI, checkAborts = false) {
|
||||
return new Promise(resolve => {
|
||||
const kDocStopFlags = Ci.nsIWebProgressListener.STATE_IS_NETWORK |
|
||||
Ci.nsIWebProgressListener.STATE_STOP;
|
||||
let wpl = {
|
||||
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
dump("Saw state " + aStateFlags.toString(16) + " and status " + aStatus.toString(16) + "\n");
|
||||
|
|
@ -908,6 +910,7 @@ var BrowserTestUtils = {
|
|||
checkFnSource: checkFn ? checkFn.toSource() : null,
|
||||
wantsUntrusted,
|
||||
};
|
||||
/* eslint-disable no-eval */
|
||||
return ContentTask.spawn(browser, parameters,
|
||||
function({ eventName, capture, checkFnSource, wantsUntrusted }) {
|
||||
let checkFn;
|
||||
|
|
@ -929,6 +932,7 @@ var BrowserTestUtils = {
|
|||
}, capture, wantsUntrusted);
|
||||
});
|
||||
});
|
||||
/* eslint-enable no-eval */
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -977,6 +981,7 @@ var BrowserTestUtils = {
|
|||
// into all tabs but ignore messages from the ones not related to
|
||||
// |browser|.
|
||||
|
||||
/* eslint-disable no-eval */
|
||||
function frameScript(id, eventName, useCapture, checkFnSource, wantsUntrusted) {
|
||||
let checkFn;
|
||||
if (checkFnSource) {
|
||||
|
|
@ -998,6 +1003,7 @@ var BrowserTestUtils = {
|
|||
addMessageListener("ContentEventListener:Remove", removeListener);
|
||||
addEventListener(eventName, listener, useCapture, wantsUntrusted);
|
||||
}
|
||||
/* eslint-enable no-eval */
|
||||
|
||||
let frameScriptSource =
|
||||
`data:,(${frameScript.toString()})(${id}, "${eventName}", ${useCapture}, "${checkFnSource}", ${wantsUntrusted})`;
|
||||
|
|
@ -1274,10 +1280,12 @@ var BrowserTestUtils = {
|
|||
let crashCleanupPromise = new Promise((resolve, reject) => {
|
||||
let observer = (subject, topic, data) => {
|
||||
if (topic != "ipc:content-shutdown") {
|
||||
return reject("Received incorrect observer topic: " + topic);
|
||||
reject("Received incorrect observer topic: " + topic);
|
||||
return;
|
||||
}
|
||||
if (!(subject instanceof Ci.nsIPropertyBag2)) {
|
||||
return reject("Subject did not implement nsIPropertyBag2");
|
||||
reject("Subject did not implement nsIPropertyBag2");
|
||||
return;
|
||||
}
|
||||
// we might see this called as the process terminates due to previous tests.
|
||||
// We are only looking for "abnormal" exits...
|
||||
|
|
@ -1290,8 +1298,8 @@ var BrowserTestUtils = {
|
|||
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||
dumpID = subject.getPropertyAsAString("dumpID");
|
||||
if (!dumpID) {
|
||||
return reject("dumpID was not present despite crash reporting " +
|
||||
"being enabled");
|
||||
reject("dumpID was not present despite crash reporting being enabled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
var Cm = Components.manager;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Task.jsm", this);
|
||||
|
|
@ -29,6 +31,7 @@ addMessageListener("content-task:spawn", function(msg) {
|
|||
});
|
||||
});
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
var ok = Assert.ok.bind(Assert);
|
||||
var is = Assert.equal.bind(Assert);
|
||||
var isnot = Assert.notEqual.bind(Assert);
|
||||
|
|
@ -40,6 +43,7 @@ addMessageListener("content-task:spawn", function(msg) {
|
|||
function info(name) {
|
||||
sendAsyncMessage("content-task:test-info", {id, name});
|
||||
}
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
try {
|
||||
let runnablestr = `
|
||||
|
|
@ -47,6 +51,7 @@ addMessageListener("content-task:spawn", function(msg) {
|
|||
return (${source});
|
||||
})();`;
|
||||
|
||||
// eslint-disable-next-line no-eval
|
||||
let runnable = eval(runnablestr);
|
||||
let iterator = runnable.call(this, msg.data.arg);
|
||||
Task.spawn(iterator).then((val) => {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
|
@ -21,4 +23,3 @@ addEventListener("load", function(event) {
|
|||
{subframe, internalURL: event.target.documentURI,
|
||||
visibleURL: content.document.location.href});
|
||||
}, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ var EXPORTED_SYMBOLS = ["ContentCollector"];
|
|||
|
||||
var ContentCollector = {
|
||||
init() {
|
||||
let processType = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processType;
|
||||
let processType = Services.appinfo.processType;
|
||||
if (processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
// In the main process, we handle triggering collections in browser-test.js
|
||||
return;
|
||||
|
|
@ -54,7 +54,7 @@ var ContentCollector = {
|
|||
},
|
||||
|
||||
finish() {
|
||||
let pid = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processID;
|
||||
let pid = Services.appinfo.processID;
|
||||
dump("Completed ShutdownLeaks collections in process " + pid + "\n");
|
||||
|
||||
Services.cpmm.removeMessageListener("browser-test:collect-request", this);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
/* -*- js-indent-level: 2; tab-width: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/* eslint-env mozilla/browser-window */
|
||||
/* import-globals-from chrome-harness.js */
|
||||
/* import-globals-from mochitest-e10s-utils.js */
|
||||
|
||||
// Test timeout (seconds)
|
||||
var gTimeoutSeconds = 45;
|
||||
var gConfig;
|
||||
|
|
@ -83,18 +88,22 @@ function testInit() {
|
|||
} else {
|
||||
// This code allows us to redirect without requiring specialpowers for chrome and a11y tests.
|
||||
let messageHandler = function(m) {
|
||||
// eslint-disable-next-line no-undef
|
||||
messageManager.removeMessageListener("chromeEvent", messageHandler);
|
||||
var url = m.json.data;
|
||||
|
||||
// Window is the [ChromeWindow] for messageManager, so we need content.window
|
||||
// Currently chrome tests are run in a content window instead of a ChromeWindow
|
||||
// eslint-disable-next-line no-undef
|
||||
var webNav = content.window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation);
|
||||
webNav.loadURI(url, null, null, null, null);
|
||||
};
|
||||
|
||||
var listener = 'data:,function doLoad(e) { var data=e.detail&&e.detail.data;removeEventListener("contentEvent", function (e) { doLoad(e); }, false, true);sendAsyncMessage("chromeEvent", {"data":data}); };addEventListener("contentEvent", function (e) { doLoad(e); }, false, true);';
|
||||
// eslint-disable-next-line no-undef
|
||||
messageManager.addMessageListener("chromeEvent", messageHandler);
|
||||
// eslint-disable-next-line no-undef
|
||||
messageManager.loadFrameScript(listener, true);
|
||||
}
|
||||
if (gConfig.e10s) {
|
||||
|
|
@ -524,7 +533,7 @@ Tester.prototype = {
|
|||
|
||||
waitForWindowsState: function Tester_waitForWindowsState(aCallback) {
|
||||
let timedOut = this.currentTest && this.currentTest.timedOut;
|
||||
let startTime = Date.now();
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
let baseMsg = timedOut ? "Found a {elt} after previous test timed out"
|
||||
: this.currentTest ? "Found an unexpected {elt} at the end of test run"
|
||||
: "Found an unexpected {elt}";
|
||||
|
|
@ -548,7 +557,7 @@ Tester.prototype = {
|
|||
|
||||
// Replace the last tab with a fresh one
|
||||
if (window.gBrowser) {
|
||||
let newTab = gBrowser.addTab("about:blank", { skipAnimation: true });
|
||||
gBrowser.addTab("about:blank", { skipAnimation: true });
|
||||
gBrowser.removeTab(gBrowser.selectedTab, { skipPermitUnload: true });
|
||||
gBrowser.stop();
|
||||
}
|
||||
|
|
@ -604,7 +613,7 @@ Tester.prototype = {
|
|||
this.PromiseTestUtils.uninit();
|
||||
|
||||
// In the main process, we print the ShutdownLeaksCollector message here.
|
||||
let pid = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processID;
|
||||
let pid = Services.appinfo.processID;
|
||||
dump("Completed ShutdownLeaks collections in process " + pid + "\n");
|
||||
|
||||
this.structuredLogger.info("TEST-START | Shutdown");
|
||||
|
|
@ -740,6 +749,7 @@ Tester.prototype = {
|
|||
// behavior of returning the last opened popup.
|
||||
document.popupNode = null;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
await new Promise(resolve => SpecialPowers.flushPrefEnv(resolve));
|
||||
|
||||
if (gConfig.cleanupCrashes) {
|
||||
|
|
@ -836,9 +846,7 @@ Tester.prototype = {
|
|||
}
|
||||
|
||||
// Dump memory stats for main thread.
|
||||
if (Cc["@mozilla.org/xre/runtime;1"]
|
||||
.getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
this.MemoryStats.dump(this.currentTestIndex,
|
||||
this.currentTest.path,
|
||||
gConfig.dumpOutputDirectory,
|
||||
|
|
@ -1050,7 +1058,6 @@ Tester.prototype = {
|
|||
if ("test" in this.currentTest.scope) {
|
||||
throw "Cannot run both a add_task test and a normal test at the same time.";
|
||||
}
|
||||
let Promise = this.Promise;
|
||||
let PromiseTestUtils = this.PromiseTestUtils;
|
||||
|
||||
// Allow for a task to be skipped; we need only use the structured logger
|
||||
|
|
@ -1396,6 +1403,7 @@ function testScope(aTester, aTest, expected) {
|
|||
Cu.permitCPOWsInScope(sandbox);
|
||||
return sandbox;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function decorateTaskFn(fn) {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,14 @@
|
|||
* 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/. */
|
||||
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
/* import-globals-from manifestLibrary.js */
|
||||
|
||||
// Defined in browser-test.js
|
||||
/* global gTestPath */
|
||||
|
||||
/*
|
||||
* getChromeURI converts a URL to a URI
|
||||
*
|
||||
|
|
@ -15,9 +20,7 @@ ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
|||
*
|
||||
*/
|
||||
function getChromeURI(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newURI(url);
|
||||
return Services.io.newURI(url);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -105,9 +108,7 @@ function getJar(uri) {
|
|||
* we will return the location of /TmpD/mochikit.tmp* so you can reference the files locally
|
||||
*/
|
||||
function extractJarToTmp(jar) {
|
||||
var tmpdir = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("ProfD", Ci.nsIFile);
|
||||
var tmpdir = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
tmpdir.append("mochikit.tmp");
|
||||
// parseInt is used because octal escape sequences cause deprecation warnings
|
||||
// in strict mode (which is turned on in debug builds)
|
||||
|
|
@ -217,9 +218,7 @@ function buildRelativePath(jarentryname, destdir, basepath) {
|
|||
function readConfig(filename) {
|
||||
filename = filename || "testConfig.js";
|
||||
|
||||
var fileLocator = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var configFile = fileLocator.get("ProfD", Ci.nsIFile);
|
||||
var configFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
configFile.append(filename);
|
||||
|
||||
if (!configFile.exists())
|
||||
|
|
@ -237,7 +236,7 @@ function readConfig(filename) {
|
|||
function getTestList(params, callback) {
|
||||
var baseurl = "chrome://mochitests/content";
|
||||
if (window.parseQueryString) {
|
||||
params = parseQueryString(location.search.substring(1), true);
|
||||
params = window.parseQueryString(location.search.substring(1), true);
|
||||
}
|
||||
if (!params.baseurl) {
|
||||
params.baseurl = baseurl;
|
||||
|
|
|
|||
7
testing/mochitest/chrome/.eslintrc.js
Normal file
7
testing/mochitest/chrome/.eslintrc.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/chrome-test"
|
||||
]
|
||||
};
|
||||
|
|
@ -20,7 +20,7 @@ function starttest() {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
var startTime = new Date();
|
||||
// increase the runtime of the test so it is detectible, otherwise we get 0-1ms
|
||||
runtimes = 100;
|
||||
let runtimes = 100;
|
||||
function runTest(plugin) {
|
||||
is(plugin.version, "1.0.0.0", "Make sure version is correct");
|
||||
is(plugin.name, "Test Plug-in");
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function parseTestManifest(testManifest, params, callback) {
|
||||
var links = {};
|
||||
var paths = [];
|
||||
let links = {};
|
||||
let paths = [];
|
||||
|
||||
// Support --test-manifest format for mobile
|
||||
if ("runtests" in testManifest || "excludetests" in testManifest) {
|
||||
|
|
@ -17,18 +17,18 @@ function parseTestManifest(testManifest, params, callback) {
|
|||
// For mochitest-chrome and mochitest-browser-chrome harnesses, we
|
||||
// define tests as links[testname] = true.
|
||||
// For mochitest-plain, we define lists as an array of testnames.
|
||||
for (var obj of testManifest.tests) {
|
||||
var path = obj.path;
|
||||
for (let obj of testManifest.tests) {
|
||||
let path = obj.path;
|
||||
// Note that obj.disabled may be "". We still want to skip in that case.
|
||||
if ("disabled" in obj) {
|
||||
dump("TEST-SKIPPED | " + path + " | " + obj.disabled + "\n");
|
||||
continue;
|
||||
}
|
||||
if (params.testRoot != "tests" && params.testRoot !== undefined) {
|
||||
name = params.baseurl + "/" + params.testRoot + "/" + path;
|
||||
let name = params.baseurl + "/" + params.testRoot + "/" + path;
|
||||
links[name] = {"test": {"url": name, "expected": obj.expected, "uses-unsafe-cpows": obj["uses-unsafe-cpows"]}};
|
||||
} else {
|
||||
name = params.testPrefix + path;
|
||||
let name = params.testPrefix + path;
|
||||
paths.push({"test": {"url": name, "expected": obj.expected, "uses-unsafe-cpows": obj["uses-unsafe-cpows"]}});
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ function parseTestManifest(testManifest, params, callback) {
|
|||
}
|
||||
|
||||
function getTestManifest(url, params, callback) {
|
||||
var req = new XMLHttpRequest();
|
||||
let req = new XMLHttpRequest();
|
||||
req.open("GET", url);
|
||||
req.onload = function() {
|
||||
if (req.readyState == 4) {
|
||||
|
|
@ -74,11 +74,9 @@ function getTestManifest(url, params, callback) {
|
|||
filtered version of testList
|
||||
*/
|
||||
function filterTests(filter, testList, runOnly) {
|
||||
|
||||
var filteredTests = [];
|
||||
var removedTests = [];
|
||||
var runtests = {};
|
||||
var excludetests = {};
|
||||
let filteredTests = [];
|
||||
let runtests = {};
|
||||
let excludetests = {};
|
||||
|
||||
if (filter == null) {
|
||||
return testList;
|
||||
|
|
@ -98,20 +96,22 @@ function filterTests(filter, testList, runOnly) {
|
|||
}
|
||||
}
|
||||
|
||||
var testRoot = config.testRoot || "tests";
|
||||
// eslint-disable-next-line no-undef
|
||||
let testRoot = config.testRoot || "tests";
|
||||
// Start with testList, and put everything that's in 'runtests' in
|
||||
// filteredTests.
|
||||
if (Object.keys(runtests).length) {
|
||||
for (var i = 0; i < testList.length; i++) {
|
||||
for (let i = 0; i < testList.length; i++) {
|
||||
let testpath;
|
||||
if ((testList[i] instanceof Object) && ("test" in testList[i])) {
|
||||
var testpath = testList[i].test.url;
|
||||
testpath = testList[i].test.url;
|
||||
} else {
|
||||
var testpath = testList[i];
|
||||
testpath = testList[i];
|
||||
}
|
||||
var tmppath = testpath.replace(/^\//, "");
|
||||
for (var f in runtests) {
|
||||
let tmppath = testpath.replace(/^\//, "");
|
||||
for (let f in runtests) {
|
||||
// Remove leading /tests/ if exists
|
||||
file = f.replace(/^\//, "");
|
||||
let file = f.replace(/^\//, "");
|
||||
file = file.replace(/^tests\//, "");
|
||||
|
||||
// Match directory or filename, testList has <testroot>/<path>
|
||||
|
|
@ -131,18 +131,19 @@ function filterTests(filter, testList, runOnly) {
|
|||
return filteredTests;
|
||||
}
|
||||
|
||||
var refilteredTests = [];
|
||||
for (var i = 0; i < filteredTests.length; i++) {
|
||||
var found = false;
|
||||
let refilteredTests = [];
|
||||
for (let i = 0; i < filteredTests.length; i++) {
|
||||
let found = false;
|
||||
let testpath;
|
||||
if ((filteredTests[i] instanceof Object) && ("test" in filteredTests[i])) {
|
||||
var testpath = filteredTests[i].test.url;
|
||||
testpath = filteredTests[i].test.url;
|
||||
} else {
|
||||
var testpath = filteredTests[i];
|
||||
testpath = filteredTests[i];
|
||||
}
|
||||
var tmppath = testpath.replace(/^\//, "");
|
||||
for (var f in excludetests) {
|
||||
let tmppath = testpath.replace(/^\//, "");
|
||||
for (let f in excludetests) {
|
||||
// Remove leading /tests/ if exists
|
||||
file = f.replace(/^\//, "");
|
||||
let file = f.replace(/^\//, "");
|
||||
file = file.replace(/^tests\//, "");
|
||||
|
||||
// Match directory or filename, testList has <testroot>/<path>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
/* global SpecialPowers */
|
||||
|
||||
var gTestURL = "";
|
||||
|
||||
function addPermissions() {
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@
|
|||
* 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/. */
|
||||
|
||||
// Note that the server script itself already defines Cc, Ci, and Cr for us,
|
||||
// and because they're constants it's not safe to redefine them. Scope leakage
|
||||
// sucks.
|
||||
// We expect these to be defined in the global scope by runtest.py.
|
||||
/* global __LOCATION__, _PROFILE_PATH, _SERVER_PORT, _SERVER_ADDR, _DISPLAY_RESULTS,
|
||||
_TEST_PREFIX */
|
||||
// Defined by xpcshell
|
||||
/* global quit */
|
||||
|
||||
/* import-globals-from ../../netwerk/test/httpserver/httpd.js */
|
||||
|
||||
// Disable automatic network detection, so tests work correctly when
|
||||
// not connected to a network.
|
||||
// eslint-disable-next-line mozilla/use-services
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
ios.manageOfflineStatus = false;
|
||||
|
|
@ -20,6 +25,18 @@ var server; // for use in the shutdown handler, if necessary
|
|||
//
|
||||
// HTML GENERATION
|
||||
//
|
||||
/* global A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BASE,
|
||||
BASEFONT, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON,
|
||||
CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD,
|
||||
DEL, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT,
|
||||
FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6,
|
||||
HEAD, HR, HTML, I, IFRAME, IMG, INPUT, INS,
|
||||
ISINDEX, KBD, LABEL, LEGEND, LI, LINK, MAP, MENU,
|
||||
META, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTGROUP,
|
||||
OPTION, P, PARAM, PRE, Q, S, SAMP, SCRIPT,
|
||||
SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB,
|
||||
SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD,
|
||||
TITLE, TR, TT, U, UL, VAR */
|
||||
var tags = ["A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", "B", "BASE",
|
||||
"BASEFONT", "BDO", "BIG", "BLOCKQUOTE", "BODY", "BR", "BUTTON",
|
||||
"CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", "DD",
|
||||
|
|
@ -547,9 +564,9 @@ function jsonArrayOfTestFiles(links) {
|
|||
* Produce a normal directory listing.
|
||||
*/
|
||||
function regularListing(metadata, response) {
|
||||
var [links, count] = list(metadata.path,
|
||||
metadata.getProperty("directory"),
|
||||
false);
|
||||
var [links] = list(metadata.path,
|
||||
metadata.getProperty("directory"),
|
||||
false);
|
||||
response.write(
|
||||
HTML(
|
||||
HEAD(
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@
|
|||
* 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/. */
|
||||
|
||||
// Defined by Marionette.
|
||||
/* global __webDriverArguments */
|
||||
const flavor = __webDriverArguments[0].flavor;
|
||||
const url = __webDriverArguments[0].testUrl;
|
||||
|
||||
// eslint-disable-next-line mozilla/use-services
|
||||
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator);
|
||||
let win = wm.getMostRecentWindow("navigator:browser");
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@ function test() {
|
|||
ok(true, "timeout ran");
|
||||
finish();
|
||||
}
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(done, 500);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ add_task(async function() {
|
|||
yield BrowserTestUtils.browserLoaded(b);
|
||||
}
|
||||
})());
|
||||
let expected = "Expected all promised browsers to have loaded.";
|
||||
for (const browser of browsers) {
|
||||
await isDOMLoaded(browser);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@ function test() {
|
|||
finish();
|
||||
}
|
||||
waitForExplicitFinish();
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(end, 40000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ function test() {
|
|||
finish();
|
||||
}
|
||||
waitForExplicitFinish();
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(message, 20000);
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(end, 40000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
function test() {
|
||||
let {Promise} = ChromeUtils.import("resource://gre/modules/Promise.jsm");
|
||||
let {Promise} = ChromeUtils.import("resource://gre/modules/Promise.jsm", {});
|
||||
ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
let decoder = new TextDecoder();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ function test() {
|
|||
|
||||
// this will throw an exception if we are not running with privileges
|
||||
try {
|
||||
// eslint-disable-next-line no-unused-vars, mozilla/use-services
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@ function test() {
|
|||
finish();
|
||||
}
|
||||
waitForExplicitFinish();
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(end, 40000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ function test() {
|
|||
ok(OpenBrowserWindow(), "opened browser window");
|
||||
// and didn't close it!
|
||||
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(done, 10000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ module.exports = {
|
|||
"privateNoteIntentionalCrash": false,
|
||||
"registerCleanupFunction": false,
|
||||
"requestLongerTimeout": false,
|
||||
"setExpectedFailuresForSelfTest": false,
|
||||
"todo": false,
|
||||
"todo_is": false,
|
||||
"todo_isnot": false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue