mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1786197 - Turn on ESLint rule for prefer-boolean-length-check for docshell. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D155168
This commit is contained in:
parent
c83937cb5a
commit
b4cf869f32
@ -478,7 +478,6 @@ module.exports = {
|
||||
{
|
||||
files: [
|
||||
"dom/**",
|
||||
"docshell/**",
|
||||
"editor/libeditor/tests/**",
|
||||
"editor/spellchecker/tests/test_bug338427.html",
|
||||
"gfx/**",
|
||||
|
@ -33,7 +33,7 @@ var TESTS = [
|
||||
},
|
||||
check(markers) {
|
||||
markers = sanitizeMarkers(markers);
|
||||
ok(markers.length > 0, "markers were returned");
|
||||
ok(!!markers.length, "markers were returned");
|
||||
console.log(markers);
|
||||
info(JSON.stringify(markers.filter(m => m.name == "Paint")));
|
||||
ok(
|
||||
@ -65,7 +65,7 @@ var TESTS = [
|
||||
},
|
||||
check(markers) {
|
||||
markers = sanitizeMarkers(markers);
|
||||
ok(markers.length > 0, "markers were returned");
|
||||
ok(!!markers.length, "markers were returned");
|
||||
ok(
|
||||
!markers.some(m => m.name == "Reflow"),
|
||||
"markers doesn't include Reflow"
|
||||
@ -95,7 +95,7 @@ var TESTS = [
|
||||
},
|
||||
check(markers) {
|
||||
markers = sanitizeMarkers(markers);
|
||||
ok(markers.length > 0, "markers were returned");
|
||||
ok(!!markers.length, "markers were returned");
|
||||
ok(
|
||||
!markers.some(m => m.name == "Reflow"),
|
||||
"markers doesn't include Reflow"
|
||||
|
@ -33,7 +33,7 @@ var TESTS = [
|
||||
let jsMarkers = markers.filter(
|
||||
m => m.name == "Javascript" && m.causeName
|
||||
);
|
||||
ok(jsMarkers.length > 0, "Got some Javascript markers");
|
||||
ok(!!jsMarkers.length, "Got some Javascript markers");
|
||||
is(
|
||||
jsMarkers[0].stack.functionDisplayName,
|
||||
"do_xhr",
|
||||
@ -63,7 +63,7 @@ if (
|
||||
markers = markers.filter(
|
||||
m => m.name == "Javascript" && m.causeName == "promise callback"
|
||||
);
|
||||
ok(markers.length > 0, "Found a Javascript marker");
|
||||
ok(!!markers.length, "Found a Javascript marker");
|
||||
|
||||
let frame = markers[0].stack;
|
||||
ok(frame.asyncParent !== null, "Parent frame has async parent");
|
||||
@ -98,7 +98,7 @@ if (
|
||||
markers = markers.filter(
|
||||
m => m.name == "Javascript" && m.causeName == "promise callback"
|
||||
);
|
||||
ok(markers.length > 0, "Found a Javascript marker");
|
||||
ok(!!markers.length, "Found a Javascript marker");
|
||||
|
||||
let frame = markers[0].stack;
|
||||
ok(frame.asyncParent !== null, "Parent frame has async parent");
|
||||
|
@ -51,7 +51,7 @@ var TESTS = [
|
||||
},
|
||||
check(markers) {
|
||||
markers = markers.filter(m => m.name == "Reflow");
|
||||
ok(markers.length > 0, "Reflow marker includes stack");
|
||||
ok(!!markers.length, "Reflow marker includes stack");
|
||||
ok(markers[0].stack.functionDisplayName == "forceSyncReflow");
|
||||
},
|
||||
},
|
||||
@ -70,7 +70,7 @@ var TESTS = [
|
||||
},
|
||||
check(markers) {
|
||||
markers = markers.filter(m => m.name == "DOMEvent");
|
||||
ok(markers.length > 0, "DOMEvent marker includes stack");
|
||||
ok(!!markers.length, "DOMEvent marker includes stack");
|
||||
ok(
|
||||
markers[0].stack.functionDisplayName == "testSendingEvent",
|
||||
"testSendingEvent is on the stack"
|
||||
@ -86,7 +86,7 @@ var TESTS = [
|
||||
},
|
||||
check(markers) {
|
||||
markers = markers.filter(m => m.name == "ConsoleTime");
|
||||
ok(markers.length > 0, "ConsoleTime marker includes stack");
|
||||
ok(!!markers.length, "ConsoleTime marker includes stack");
|
||||
ok(
|
||||
markers[0].stack.functionDisplayName == "testConsoleTime",
|
||||
"testConsoleTime is on the stack"
|
||||
@ -113,7 +113,7 @@ if (
|
||||
},
|
||||
check(markers) {
|
||||
markers = markers.filter(m => m.name == "ConsoleTime");
|
||||
ok(markers.length > 0, "Promise marker includes stack");
|
||||
ok(!!markers.length, "Promise marker includes stack");
|
||||
ok(
|
||||
markers[0].stack.functionDisplayName == "testConsoleTime",
|
||||
"testConsoleTime is on the stack"
|
||||
|
@ -127,13 +127,11 @@ function doPageNavigation(params) {
|
||||
? params.eventsToListenFor
|
||||
: ["pageshow"];
|
||||
gExpectedEvents =
|
||||
typeof params.eventsToListenFor == "undefined" ||
|
||||
eventsToListenFor.length == 0
|
||||
typeof params.eventsToListenFor == "undefined" || !eventsToListenFor.length
|
||||
? undefined
|
||||
: params.expectedEvents;
|
||||
gUnexpectedEvents =
|
||||
typeof params.eventsToListenFor == "undefined" ||
|
||||
eventsToListenFor.length == 0
|
||||
typeof params.eventsToListenFor == "undefined" || !eventsToListenFor.length
|
||||
? undefined
|
||||
: params.unexpectedEvents;
|
||||
let preventBFCache =
|
||||
@ -149,15 +147,15 @@ function doPageNavigation(params) {
|
||||
);
|
||||
if (navigation.length > 1) {
|
||||
throw new Error(`Can't specify both ${navigation[0]} and ${navigation[1]}`);
|
||||
} else if (navigation.length == 0 && !waitOnly) {
|
||||
} else if (!navigation.length && !waitOnly) {
|
||||
throw new Error(
|
||||
"Must specify back or forward or gotoIndex or reload or uri"
|
||||
);
|
||||
}
|
||||
if (params.onNavComplete && eventsToListenFor.length == 0) {
|
||||
if (params.onNavComplete && !eventsToListenFor.length) {
|
||||
throw new Error("Can't use onNavComplete when eventsToListenFor == []");
|
||||
}
|
||||
if (params.preventBFCache && eventsToListenFor.length == 0) {
|
||||
if (params.preventBFCache && !eventsToListenFor.length) {
|
||||
throw new Error("Can't use preventBFCache when eventsToListenFor == []");
|
||||
}
|
||||
if (params.preventBFCache && waitOnly) {
|
||||
@ -168,7 +166,7 @@ function doPageNavigation(params) {
|
||||
"Must specify onNavComplete when specifying waitForEventsOnly"
|
||||
);
|
||||
}
|
||||
if (waitOnly && navigation.length > 0) {
|
||||
if (waitOnly && navigation.length) {
|
||||
throw new Error(
|
||||
"Can't specify a navigation type when using waitForEventsOnly"
|
||||
);
|
||||
@ -202,7 +200,7 @@ function doPageNavigation(params) {
|
||||
|
||||
// If the test explicitly sets .eventsToListenFor to [], don't wait for any
|
||||
// events.
|
||||
gFinalEvent = eventsToListenFor.length == 0;
|
||||
gFinalEvent = !eventsToListenFor.length;
|
||||
|
||||
// Add observers as needed.
|
||||
let observers = new Map();
|
||||
@ -307,7 +305,7 @@ function doPageNavigation(params) {
|
||||
|
||||
// If we're listening for events and there is an .onNavComplete callback,
|
||||
// wait for all events to occur, and then call doPageNavigation_complete().
|
||||
if (eventsToListenFor.length > 0 && params.onNavComplete) {
|
||||
if (eventsToListenFor.length && params.onNavComplete) {
|
||||
waitForTrue(
|
||||
function() {
|
||||
return gFinalEvent;
|
||||
@ -487,7 +485,7 @@ function pageEventListener(
|
||||
|
||||
// If there are explicitly no expected events, but we receive one, it's an
|
||||
// error.
|
||||
if (gExpectedEvents.length == 0) {
|
||||
if (!gExpectedEvents.length) {
|
||||
ok(false, "Unexpected event (" + event.type + ") occurred");
|
||||
return;
|
||||
}
|
||||
@ -556,7 +554,7 @@ function pageEventListener(
|
||||
}
|
||||
|
||||
// If we're out of expected events, let doPageNavigation() return.
|
||||
if (gExpectedEvents.length == 0) {
|
||||
if (!gExpectedEvents.length) {
|
||||
waitForNextPaint(function() {
|
||||
gFinalEvent = true;
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ class Listener {
|
||||
|
||||
async firstAddress() {
|
||||
let all = await this.addresses();
|
||||
if (all.length > 0) {
|
||||
if (all.length) {
|
||||
return all[0];
|
||||
}
|
||||
return undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user