From fae54d109842c3093ef0d889b2f58ebf3a72698a Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Sun, 24 Sep 2023 10:38:56 +0000 Subject: [PATCH] Bug 1596056 - Enable ESLint on reftest harness files (manual fixes). r=tnikkel Depends on D189058 Differential Revision: https://phabricator.services.mozilla.com/D189059 --- .eslintignore | 2 ++ layout/tools/reftest/globals.jsm | 1 + layout/tools/reftest/manifest.jsm | 2 +- layout/tools/reftest/reftest-content.js | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index c47dd6dce6fe..72c9cc975fad 100644 --- a/.eslintignore +++ b/.eslintignore @@ -24,6 +24,8 @@ # Also ignore reftest - specially crafted to produce expected output. **/reftest/ **/reftests/ +# Don't ignore the reftest harness files. +!/layout/tools/reftest/ # Exclude expected objdirs. obj*/ diff --git a/layout/tools/reftest/globals.jsm b/layout/tools/reftest/globals.jsm index b74a29e5b336..05109eb2d4a7 100644 --- a/layout/tools/reftest/globals.jsm +++ b/layout/tools/reftest/globals.jsm @@ -162,6 +162,7 @@ for (let [key, val] of Object.entries({ dumpedConditionSandbox: false, }, })) { + // eslint-disable-next-line mozilla/reject-global-this this[key] = val; EXPORTED_SYMBOLS.push(key); } diff --git a/layout/tools/reftest/manifest.jsm b/layout/tools/reftest/manifest.jsm index 8ad813c9ea62..3dbf03cd2224 100644 --- a/layout/tools/reftest/manifest.jsm +++ b/layout/tools/reftest/manifest.jsm @@ -682,7 +682,7 @@ function BuildConditionSandbox(aURL) { sandbox.swgl = g.windowUtils.layerManagerType.startsWith( "WebRender (Software" ); - sandbox.layersOMTC = g.windowUtils.layerManagerRemote == true; + sandbox.layersOMTC = !!g.windowUtils.layerManagerRemote; // Shortcuts for widget toolkits. sandbox.Android = xr.OS == "Android"; diff --git a/layout/tools/reftest/reftest-content.js b/layout/tools/reftest/reftest-content.js index 48cd27612baf..91a03e20faa7 100644 --- a/layout/tools/reftest/reftest-content.js +++ b/layout/tools/reftest/reftest-content.js @@ -535,13 +535,13 @@ function WaitForTestEnd( var operationInProgress = false; function OperationInProgress() { - if (operationInProgress != false) { + if (operationInProgress) { LogWarning("Nesting atomic operations?"); } operationInProgress = true; } function OperationCompleted() { - if (operationInProgress != true) { + if (!operationInProgress) { LogWarning("Mismatched OperationInProgress/OperationCompleted calls?"); } operationInProgress = false;