Bug 1656291 - Enable all ESLint rules on xhtml test files in toolkit/components/{ctypes|osfile|places|workerloader} r=Standard8

Depends on D85626

Differential Revision: https://phabricator.services.mozilla.com/D85627
This commit is contained in:
Sonia Singla
2020-09-04 06:22:43 +00:00
parent 974c007f72
commit 8889fa4b30
4 changed files with 36 additions and 46 deletions

View File

@@ -564,14 +564,6 @@ module.exports = {
},
{
files: [
"toolkit/components/ctypes/tests/chrome/test_ctypes.xhtml",
"toolkit/components/osfile/tests/mochi/test_osfile_back.xhtml",
"toolkit/components/osfile/tests/mochi/test_osfile_comms.xhtml",
"toolkit/components/osfile/tests/mochi/test_osfile_front.xhtml",
"toolkit/components/places/tests/chrome/browser_disableglobalhistory.xhtml",
"toolkit/components/places/tests/chrome/test_browser_disableglobalhistory.xhtml",
"toolkit/components/places/tests/chrome/test_favicon_annotations.xhtml",
"toolkit/components/workerloader/tests/test_loading.xhtml",
"toolkit/content/tests/chrome/bug263683_window.xhtml",
"toolkit/content/tests/chrome/bug304188_window.xhtml",
"toolkit/content/tests/chrome/bug331215_window.xhtml",

View File

@@ -16,8 +16,8 @@
<![CDATA[
const {ctypes} = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test");
CTYPES_UNICODE_LIB = ctypes.libraryName("jsctyp\u00E8s-t\u00EB\u00DFt");
const CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test");
const CTYPES_UNICODE_LIB = ctypes.libraryName("jsctyp\u00E8s-t\u00EB\u00DFt");
/*
* input: string of the url where we are running from
@@ -29,15 +29,12 @@
if (jar) {
return extractJarToTmp(jar);
} else {
return getLocalDir(path);
}
return getLocalDir(path);
}
function getLocalDir(path) {
let dir = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("CurWorkD", Ci.nsIFile);
let dir = SpecialPowers.Services.dirsvc.get("CurWorkD", Ci.nsIFile);
path = location.pathname;
path = path.slice("content/".length,
-1 * "/test_ctypes.xhtml".length);
@@ -97,7 +94,7 @@
SimpleTest.finish();
}
worker.postMessage({dir: dir.path, os: Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS});
worker.postMessage({dir: dir.path, os: Services.appinfo.OS});
}
function onunload()

View File

@@ -28,37 +28,38 @@ let test = function test() {
worker.onerror = function onerror(error) {
SimpleTest.ok(false, "received error "+error);
}
worker.onmessage = function onmessage(msg) {
Cu.forceShrinkingGC();
switch (msg.data.kind) {
case "is":
SimpleTest.ok(msg.data.outcome, msg.data.description +
" ("+ msg.data.a + " ==? " + msg.data.b + ")" );
return;
case "isnot":
SimpleTest.ok(msg.data.outcome, msg.data.description +
" ("+ msg.data.a + " !=? " + msg.data.b + ")" );
return;
case "ok":
SimpleTest.ok(msg.data.condition, msg.data.description);
return;
case "info":
SimpleTest.info(msg.data.description);
return;
case "finish":
SimpleTest.finish();
return;
case "value":
SimpleTest.ok(true, "test_osfile_comms.xhtml: Received value " + JSON.stringify(msg.data.value));
let type = eval(msg.data.typename);
let check = eval(msg.data.check);
let value = msg.data.value;
let deserialized = type.fromMsg(value);
check(deserialized, "Main thread test: ");
return;
worker.onmessage = function onmessage(msg) {
Cu.forceShrinkingGC();
switch (msg.data.kind) {
case "is":
SimpleTest.ok(msg.data.outcome, msg.data.description +
" ("+ msg.data.a + " ==? " + msg.data.b + ")" );
return;
case "isnot":
SimpleTest.ok(msg.data.outcome, msg.data.description +
" ("+ msg.data.a + " !=? " + msg.data.b + ")" );
return;
case "ok":
SimpleTest.ok(msg.data.condition, msg.data.description);
return;
case "info":
SimpleTest.info(msg.data.description);
return;
case "finish":
SimpleTest.finish();
return;
case "value":
SimpleTest.ok(true, "test_osfile_comms.xhtml: Received value " + JSON.stringify(msg.data.value));
// eslint-disable-next-line no-eval
let type = eval(msg.data.typename);
// eslint-disable-next-line no-eval
let check = eval(msg.data.check);
let value = msg.data.value;
let deserialized = type.fromMsg(value);
check(deserialized, "Main thread test: ");
return;
default:
SimpleTest.ok(false, "test_osfile_comms.xhtml: wrong message "+JSON.stringify(msg.data));
return;
}
};
worker.postMessage(0)

View File

@@ -14,7 +14,7 @@
<script type="text/javascript">
Cu.import("resource://testing-common/ContentTask.jsm");
const { ContentTask } = ChromeUtils.import("resource://testing-common/ContentTask.jsm");
ContentTask.setTestScope(window.arguments[0].wrappedJSObject);
function expectUseGlobalHistory(id, expected) {