Commit c8d331f4 authored by Jared Wein's avatar Jared Wein
Browse files

Bug 1436575 - Autofix errors from no-compare-against-boolean-literal. r=standard8

MozReview-Commit-ID: 66sXxnOWDgw

--HG--
extra : rebase_source : a0bf26e37a03a1e77476bdeedfc1af3ebec32f2a
parent 1225eda7
......@@ -200,7 +200,7 @@ function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets) {
*/
function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc,
aIsFromUserInput) {
var expectMove = (aIdOrNameOrAcc != false);
var expectMove = (!!aIdOrNameOrAcc);
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.
storePreviousPosAndOffset(aDocAcc.virtualCursor);
......@@ -260,7 +260,7 @@ function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc,
*/
function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
aIdOrNameOrAcc, aIsFromUserInput) {
var expectMove = (aIdOrNameOrAcc != false);
var expectMove = (!!aIdOrNameOrAcc);
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.storePreviousPosAndOffset(aDocAcc.virtualCursor);
SimpleTest.info(aDocAcc.virtualCursor.position);
......@@ -306,7 +306,7 @@ function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
*/
function moveVCCoordInvoker(aDocAcc, aX, aY, aIgnoreNoMatch,
aRule, aIdOrNameOrAcc) {
var expectMove = (aIdOrNameOrAcc != false);
var expectMove = (!!aIdOrNameOrAcc);
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.
storePreviousPosAndOffset(aDocAcc.virtualCursor);
......
......@@ -376,7 +376,7 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg) {
for (let colIdx = 0; colIdx < colsCount; colIdx++) {
var isColSelected = true;
for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
if (aCellsArray[rowIdx][colIdx] == false ||
if (!aCellsArray[rowIdx][colIdx] ||
aCellsArray[rowIdx][colIdx] == undefined) {
isColSelected = false;
break;
......@@ -416,7 +416,7 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg) {
for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
var isRowSelected = true;
for (let colIdx = 0; colIdx < colsCount; colIdx++) {
if (aCellsArray[rowIdx][colIdx] == false ||
if (!aCellsArray[rowIdx][colIdx] ||
aCellsArray[rowIdx][colIdx] == undefined) {
isRowSelected = false;
break;
......@@ -458,7 +458,7 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg) {
if (aCellsArray[rowIdx][colIdx] & kSpanned)
continue;
var isSelected = aCellsArray[rowIdx][colIdx] == true;
var isSelected = !!aCellsArray[rowIdx][colIdx];
is(acc.isCellSelected(rowIdx, colIdx), isSelected,
msg + "Wrong selection state of cell at " + rowIdx + " row and " +
colIdx + " column for " + prettyName(aIdentifier));
......@@ -515,7 +515,7 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg) {
var isSel = aCellsArray[rowIdx][colIdx];
if (isSel == undefined)
testStates(cell, 0, 0, STATE_SELECTABLE | STATE_SELECTED);
else if (isSel == true)
else if (isSel)
testStates(cell, STATE_SELECTED);
else
testStates(cell, STATE_SELECTABLE, 0, STATE_SELECTED);
......
......@@ -80,7 +80,7 @@
function onClickSeeDetails() {
let details = document.getElementById("errorDescriptionContainer");
if (details.hidden == true) {
if (details.hidden) {
details.removeAttribute("hidden");
} else {
details.setAttribute("hidden", "true");
......
......@@ -25,7 +25,7 @@ add_task(async function testTempPermissionOnReload() {
await reloaded;
await BrowserTestUtils.waitForCondition(() => {
return reloadButton.disabled == false;
return !reloadButton.disabled;
});
Assert.deepEqual(SitePermissions.get(uri, id, browser), {
......
......@@ -80,7 +80,7 @@ add_task(async function() {
let expectations = testcases[testcaseId];
Assert.ok(overlay.classList.contains("visible") == true,
Assert.ok(!!overlay.classList.contains("visible"),
`The expected visibility is correct in ${testcaseId}`);
Assert.ok(overlay.getAttribute("sizing") == expectations.sizing,
......
......@@ -31,7 +31,7 @@ this.EXPORTED_SYMBOLS = ["Policies"];
this.Policies = {
"block_about_config": {
onBeforeUIStartup(manager, param) {
if (param == true) {
if (param) {
manager.disallowFeature("about:config", true);
}
}
......@@ -47,7 +47,7 @@ this.Policies = {
"display_menu_bar": {
onBeforeUIStartup(manager, param) {
if (param == true) {
if (param) {
// This policy is meant to change the default behavior, not to force it.
// If this policy was alreay applied and the user chose to re-hide the
// menu bar, do not show it again.
......@@ -64,7 +64,7 @@ this.Policies = {
"display_bookmarks_toolbar": {
onBeforeUIStartup(manager, param) {
if (param == true) {
if (param) {
// This policy is meant to change the default behavior, not to force it.
// If this policy was alreay applied and the user chose to re-hide the
// bookmarks toolbar, do not show it again.
......@@ -81,7 +81,7 @@ this.Policies = {
"block_set_desktop_background": {
onBeforeUIStartup(manager, param) {
if (param == true) {
if (param) {
manager.disallowFeature("setDesktopBackground", true);
}
}
......@@ -89,7 +89,7 @@ this.Policies = {
"DisableFirefoxScreenshots": {
onBeforeAddons(manager, param) {
if (param == true) {
if (param) {
setAndLockPref("extensions.screenshots.disabled", true);
}
}
......
......@@ -314,7 +314,7 @@ PlacesController.prototype = {
*/
_canInsert: function PC__canInsert(isPaste) {
var ip = this._view.insertionPoint;
return ip != null && (isPaste || ip.isTag != true);
return ip != null && (isPaste || !ip.isTag);
},
/**
......
......@@ -935,7 +935,7 @@ var gMainPane = {
updateButtons(aButtonID, aPreferenceID) {
var button = document.getElementById(aButtonID);
var preference = Preferences.get(aPreferenceID);
button.disabled = preference.value != true;
button.disabled = !preference.value;
return undefined;
},
......@@ -3386,7 +3386,7 @@ FeedHandlerInfo.prototype = {
},
set alwaysAskBeforeHandling(aNewValue) {
if (aNewValue == true)
if (aNewValue)
Preferences.get(this._prefSelectedAction).value = "ask";
else
Preferences.get(this._prefSelectedAction).value = "reader";
......
......@@ -1074,7 +1074,7 @@ var gPrivacyPane = {
updateButtons(aButtonID, aPreferenceID) {
var button = document.getElementById(aButtonID);
var preference = Preferences.get(aPreferenceID);
button.disabled = preference.value != true;
button.disabled = !preference.value;
return undefined;
},
......
......@@ -251,7 +251,7 @@ function testDefaultArgs() {
getService(Ci.nsIBrowserHandler).defaultArgs;
is(defaultArgs, overrideArgs, "correct value returned by defaultArgs");
if (testCase.noMstoneChange === undefined || testCase.noMstoneChange != true) {
if (testCase.noMstoneChange === undefined || !testCase.noMstoneChange) {
let newMstone = Services.prefs.getCharPref(PREF_MSTONE);
is(originalMstone, newMstone, "preference " + PREF_MSTONE +
" should have been updated");
......
......@@ -155,7 +155,7 @@ this.UITour = {
// The pocket's urlbar page action button is pre-defined in the DOM.
// It would be hidden if toggled off from the urlbar.
let node = aDocument.getElementById("pocket-button-box");
if (node && node.hidden == false) {
if (node && !node.hidden) {
return node;
}
return aDocument.getElementById("pageAction-panel-pocket");
......@@ -221,7 +221,7 @@ this.UITour = {
// The bookmark's urlbar page action button is pre-defined in the DOM.
// It would be hidden if toggled off from the urlbar.
let node = aDocument.getElementById("star-button-box");
if (node && node.hidden == false) {
if (node && !node.hidden) {
return node;
}
return aDocument.getElementById("pageAction-panel-bookmark");
......
......@@ -520,7 +520,7 @@ this.WinTaskbarJumpList =
observe: function WTBJL_observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "nsPref:changed":
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
if (!!this._enabled && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
this._deleteActiveJumpList();
this._refreshPrefs();
this._updateTimer();
......
......@@ -94,7 +94,7 @@ function run_test() {
let ind = old_factories_inds[i];
registrar.unregisterFactory(factory.CID, factory);
if (ind == true) {
if (ind) {
let old_factory = old_factories[i];
registrar.registerFactory(old_factory.CID, factory.scheme, factory.contractID, old_factory.factory);
}
......
......@@ -83,7 +83,7 @@ add_task(function* () {
let allMenuItems = openContextMenuAndGetAllItems(inspector);
let deleteNode = allMenuItems.find(item => item.id === "node-menu-delete");
ok(deleteNode, "the popup menu has a delete menu item");
ok(deleteNode.disabled == false, "the delete menu item is not disabled");
ok(!deleteNode.disabled, "the delete menu item is not disabled");
let updated = inspector.once("inspector-updated");
info("Triggering 'Delete Node' and waiting for inspector to update");
......
......@@ -139,7 +139,7 @@ function initializeAutoCompletion(ctx, options = {}) {
let cycle = reverse => {
if (popup && popup.isOpen) {
cycleSuggestions(ed, reverse == true);
cycleSuggestions(ed, !!reverse);
return null;
}
......
......@@ -45,7 +45,7 @@ function* teardown({client}) {
function waitForNextTabNavigated(client) {
return new Promise(resolve => {
client.addListener("tabNavigated", function tabNavigatedListener(evt, pkt) {
if (pkt.state == "stop" && pkt.isFrameSwitching == false) {
if (pkt.state == "stop" && !pkt.isFrameSwitching) {
client.removeListener("tabNavigated", tabNavigatedListener);
resolve();
}
......
......@@ -20,7 +20,7 @@ function* testSteps()
for (let method of ["put", "add"]) {
for (let explicit of [true, false, undefined, "invalid"]) {
for (let existing of [true, false]) {
let speccedNoKey = (keypath == false || keypath == "missing") &&
let speccedNoKey = (!keypath || keypath == "missing") &&
!explicit;
// We can't do 'existing' checks if we use autogenerated key
......
......@@ -455,13 +455,13 @@ Bookmark.prototype = {
*/
async SetLoadInSidebar(loadInSidebar) {
let itemId = await PlacesUtils.promiseItemId(this.props.guid);
if (loadInSidebar == true)
if (loadInSidebar)
PlacesUtils.annotations.setItemAnnotation(itemId,
"bookmarkProperties/loadInSidebar",
true,
0,
PlacesUtils.annotations.EXPIRE_NEVER);
else if (loadInSidebar == false)
else if (!loadInSidebar)
PlacesUtils.annotations.removeItemAnnotation(itemId,
"bookmarkProperties/loadInSidebar");
},
......
......@@ -49,7 +49,7 @@
};
Tester.prototype.ok =
function(b, note) {
this.mm.sendAsyncMessage("testRemoteContentPrefs:ok", { test: [b != false, note] });
this.mm.sendAsyncMessage("testRemoteContentPrefs:ok", { test: [!!b, note] });
};
Tester.prototype.info =
function(note) {
......
......@@ -958,7 +958,7 @@ var Impl = {
let ret = {};
for (let processName in scalarsSnapshot) {
for (let name in scalarsSnapshot[processName]) {
if (name.startsWith("telemetry.test") && this._testing == false) {
if (name.startsWith("telemetry.test") && !this._testing) {
continue;
}
// Finally arrange the data in the returned object.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment