Bug 1786197 - Turn on ESLint rule for prefer-boolean-length-check for gfx. r=gfx-reviewers,nical

Differential Revision: https://phabricator.services.mozilla.com/D155170
This commit is contained in:
Mark Banner 2022-08-26 13:39:36 +00:00
Родитель 4f95e6b415
Коммит d86604e53c
7 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -478,7 +478,6 @@ module.exports = {
{
files: [
"dom/**",
"gfx/**",
"image/test/browser/browser_image.js",
"layout/**",
"mobile/android/**",

Просмотреть файл

@ -139,7 +139,7 @@ function convertTestData(testData) {
// because those don't contain any useful data.
function getLastNonemptyBucket(buckets) {
for (var i = buckets.length - 1; i >= 0; --i) {
if (buckets[i].scrollFrames.length > 0) {
if (buckets[i].scrollFrames.length) {
return buckets[i];
}
}
@ -269,7 +269,7 @@ function getLastApzcTree() {
ok(false, "expected to have compositor apz test data");
return null;
}
if (data.paints.length == 0) {
if (!data.paints.length) {
ok(false, "expected to have at least one compositor paint bucket");
return null;
}
@ -756,7 +756,7 @@ function getSnapshot(rect) {
// produces { "key": { "x": 0, "y": 0 }, "key2": [1, 2, true] }
function getQueryArgs() {
var args = {};
if (location.search.length > 0) {
if (location.search.length) {
var params = location.search.substr(1).split("&");
for (var p of params) {
var [k, v] = p.split("=");
@ -866,7 +866,7 @@ function hitInfoToString(hitInfo) {
strs.push(flag);
}
}
if (strs.length == 0) {
if (!strs.length) {
return "INVISIBLE";
}
strs.sort(function(a, b) {
@ -1070,7 +1070,7 @@ var ApzCleanup = {
_cleanups: [],
register(func) {
if (this._cleanups.length == 0) {
if (!this._cleanups.length) {
if (!window.isApzSubtest) {
SimpleTest.registerCleanupFunction(this.execute.bind(this));
} // else ApzCleanup.execute is called from runSubtestsSeriallyInFreshWindows
@ -1079,7 +1079,7 @@ var ApzCleanup = {
},
execute() {
while (this._cleanups.length > 0) {
while (this._cleanups.length) {
var func = this._cleanups.pop();
try {
func();

Просмотреть файл

@ -82,7 +82,7 @@ waitUntilApzStable().then(async () => {
}, { once: true });
target0.addEventListener("pointerup", (event) => {
ok(target0_events.length == 0, " should receive " + target0_events + " on target0");
ok(!target0_events.length, " should receive " + target0_events + " on target0");
// Wait until the event is done processing before we end the subtest,
// otherwise on Android the pointer events pref is flipped back to false
// and debug builds will assert.

Просмотреть файл

@ -51,7 +51,7 @@ async function test() {
// end the test at the right time.
body.addEventListener("touchend", function(e) {
dump(`Got touchend with ${e.touches.length} touches\n`);
if (e.touches.length == 0) {
if (!e.touches.length) {
resolve();
}
});

Просмотреть файл

@ -40,7 +40,7 @@ async function test() {
// end the test at the right time.
body.addEventListener("touchend", function(e) {
dump(`Got touchend with ${e.touches.length} touches\n`);
if (e.touches.length == 0) {
if (!e.touches.length) {
resolve();
}
});

Просмотреть файл

@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=982141
// Get the sequence number of the last paint on the compositor side.
// We do this before converting the APZ test data because the conversion
// loses the order of the paints.
ok(compositorTestData.paints.length > 0,
ok(!!compositorTestData.paints.length,
"expected at least one paint in compositor test data");
var lastCompositorPaint = compositorTestData.paints[compositorTestData.paints.length - 1];
var lastCompositorPaintSeqNo = lastCompositorPaint.sequenceNumber;

Просмотреть файл

@ -578,7 +578,7 @@ function getAsyncScrollOffsets(aPaintsToIgnore) {
if (rcd == null) {
continue;
}
if (rcd.children.length > 0) {
if (rcd.children.length) {
// The child may not be layerized in the first few paints, but once it is
// layerized, it should stay layerized.
childIsLayerized = true;
@ -654,7 +654,7 @@ async function test() {
var asyncScrollOffsets = getAsyncScrollOffsets(framesToSkip);
dump("Got scroll offsets: " + JSON.stringify(asyncScrollOffsets) + "\n");
var maxScrollParentLayerPixels = maxScroll;
while (asyncScrollOffsets.length > 0) {
while (asyncScrollOffsets.length) {
let offset = asyncScrollOffsets.shift();
switch (state) {
// 0 is the initial state, the scroll offset might be zero but should