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

Bug 1436575 - Manually fix the errors from no-compare-against-boolean-literal...

Bug 1436575 - Manually fix the errors from no-compare-against-boolean-literal that the autofix couldn't change. r=standard8

MozReview-Commit-ID: 6NtfU76sPKv

--HG--
extra : rebase_source : 143891b98995658a5683e01631eba9f6a2bb7b6f
parent b433816c
......@@ -499,12 +499,12 @@
if (!aBrowser)
aBrowser = this.mCurrentBrowser;
if (aCallGlobalListeners != false &&
if (aCallGlobalListeners &&
aBrowser == this.mCurrentBrowser) {
callListeners(this.mProgressListeners, aArguments);
}
if (aCallTabsListeners != false) {
if (aCallTabsListeners) {
aArguments.unshift(aBrowser);
callListeners(this.mTabsProgressListeners, aArguments);
......
......@@ -39,7 +39,7 @@ this.Policies = {
"DisableAppUpdate": {
onBeforeAddons(manager, param) {
if (param == true) {
if (param) {
manager.disallowFeature("appUpdate");
}
}
......@@ -97,7 +97,7 @@ this.Policies = {
"DisableFirefoxStudies": {
onBeforeAddons(manager, param) {
if (param == true) {
if (param) {
manager.disallowFeature("Shield");
}
}
......@@ -105,7 +105,7 @@ this.Policies = {
"DisableFormHistory": {
onBeforeUIStartup(manager, param) {
if (param == true) {
if (param) {
setAndLockPref("browser.formfill.enable", false);
}
}
......
......@@ -26,7 +26,7 @@ BlocklistPrompt.prototype = {
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
// If nothing aborted, quit the app
if (cancelQuit.data == false) {
if (!cancelQuit.data) {
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
}
......
......@@ -258,7 +258,7 @@ NSSDialogs.prototype = {
this.viewCertDetails(certDetailsList[selectedIndex.value], ctx);
continue;
} else if (response.button == 0 /* buttons[0] */) {
if (response.rememberBox == true) {
if (response.rememberBox) {
let caud = ctx.QueryInterface(Ci.nsIClientAuthUserDecision);
if (caud) {
caud.rememberClientAuthCertificate = true;
......
......@@ -89,7 +89,7 @@ function testLoad() {
function testPlay(aEvent) {
video.removeEventListener("play", testPlay);
let playButton = getButtonByAttribute("class", "playButton");
ok(playButton.hasAttribute("paused") == false, "Play button is not paused");
ok(!playButton.hasAttribute("paused"), "Play button is not paused");
// Let the video play for 2 seconds, then pause it
chromeWin.setTimeout(function() {
......
......@@ -218,8 +218,8 @@ async function createFileInHome() {
let homeFile = fileInHomeDir();
let path = homeFile.path;
let fileCreated = await ContentTask.spawn(browser, path, createFile);
ok(fileCreated == false, "creating a file in home dir is not permitted");
if (fileCreated == true) {
ok(!fileCreated, "creating a file in home dir is not permitted");
if (fileCreated) {
// content process successfully created the file, now remove it
homeFile.remove(false);
}
......@@ -233,9 +233,9 @@ async function createTempFile() {
let path = fileInTempDir().path;
let fileCreated = await ContentTask.spawn(browser, path, createFile);
if (isMac()) {
ok(fileCreated == false, "creating a file in content temp is not permitted");
ok(!fileCreated, "creating a file in content temp is not permitted");
} else {
ok(fileCreated == true, "creating a file in content temp is permitted");
ok(!!fileCreated, "creating a file in content temp is permitted");
}
// now delete the file
let fileDeleted = await ContentTask.spawn(browser, path, deleteFile);
......@@ -243,15 +243,15 @@ async function createTempFile() {
// On macOS we do not allow file deletion - it is not needed by the content
// process itself, and macOS uses a different permission to control access
// so revoking it is easy.
ok(fileDeleted == false,
ok(!fileDeleted,
"deleting a file in content temp is not permitted");
let path = fileInTempDir().path;
let symlinkCreated = await ContentTask.spawn(browser, path, createSymlink);
ok(symlinkCreated == false,
ok(!symlinkCreated,
"created a symlink in content temp is not permitted");
} else {
ok(fileDeleted == true, "deleting a file in content temp is permitted");
ok(!!fileDeleted, "deleting a file in content temp is permitted");
}
}
......
......@@ -63,7 +63,7 @@ function mergeChanges(collection, localRecords, changes) {
return Object.values(records)
// Filter out deleted records.
.filter((record) => record.deleted != true)
.filter((record) => !record.deleted)
// Sort list by record id.
.sort((a, b) => {
if (a.id < b.id) {
......
......@@ -95,7 +95,7 @@ function execAsync(aStmt, aOptions, aResults) {
do_throw("handleResult invoked with 0 result rows!");
},
handleError(aError) {
if (errorCodeSeen != false)
if (errorCodeSeen)
do_throw("handleError called when we already had an error!");
errorCodeSeen = aError.result;
},
......@@ -107,7 +107,7 @@ function execAsync(aStmt, aOptions, aResults) {
do_throw("Expected " + resultsExpected + " rows of results but " +
"got " + resultsSeen + " rows!", caller);
if (errorCodeExpected == true && errorCodeSeen == false)
if (errorCodeExpected && !errorCodeSeen)
do_throw("Expected an error, but did not see one.", caller);
else if (errorCodeExpected != errorCodeSeen)
do_throw("Expected error code " + errorCodeExpected + " but got " +
......
......@@ -1399,7 +1399,7 @@ function switchToFrame(msg) {
sendSyncMessage("Marionette:switchedToFrame", {frameValue: null});
curContainer.frame = content;
if (msg.json.focus == true) {
if (msg.json.focus) {
curContainer.frame.focus();
}
......@@ -1464,7 +1464,7 @@ function switchToFrame(msg) {
sendSyncMessage("Marionette:switchedToFrame", {frameValue: null});
curContainer.frame = content;
if (msg.json.focus == true) {
if (msg.json.focus) {
curContainer.frame.focus();
}
......
......@@ -819,7 +819,7 @@ SpecialPowersAPI.prototype = {
: Ci.nsIPermissionManager.DENY_ACTION;
}
if (permission.remove == true)
if (permission.remove)
perm = Ci.nsIPermissionManager.UNKNOWN_ACTION;
if (originalValue == perm) {
......@@ -838,7 +838,7 @@ SpecialPowersAPI.prototype = {
var cleanupTodo = Object.assign({}, todo);
if (permission.remove == true)
if (permission.remove)
todo.op = "remove";
pendingPermissions.push(todo);
......
......@@ -406,7 +406,7 @@ var plNextPage = async function() {
doNextPage = true;
}
if (doNextPage == true) {
if (doNextPage) {
if (forceCC) {
var tccstart = new Date();
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
......@@ -540,7 +540,7 @@ function plWaitForPaintingCapturing() {
.getInterface(Components.interfaces.nsIDOMWindowUtils);
if (utils.isMozAfterPaintPending && useMozAfterPaint) {
if (gPaintListener == false)
if (!gPaintListener)
gPaintWindow.addEventListener("MozAfterPaint", plPaintedCapturing, true);
gPaintListener = true;
return;
......@@ -601,7 +601,7 @@ function waitForPainted() {
return;
}
if (gPaintListener == false)
if (!gPaintListener)
gPaintWindow.addEventListener("MozAfterPaint", plPainted, true);
gPaintListener = true;
}
......@@ -703,7 +703,7 @@ function plStop(force) {
function plStopAll(force) {
try {
if (force == false) {
if (!force) {
pageIndex = 0;
pageCycle = 1;
if (cycle < NUM_CYCLES - 1) {
......
......@@ -14,7 +14,7 @@ add_task(async function check_definition() {
Assert.equal(Services.appinfo.OS, OS.Constants.Sys.Name);
// check if using DEBUG build
if (Components.classes["@mozilla.org/xpcom/debug;1"].getService(Components.interfaces.nsIDebug2).isDebugBuild == true) {
if (Components.classes["@mozilla.org/xpcom/debug;1"].getService(Components.interfaces.nsIDebug2).isDebugBuild) {
Assert.ok(OS.Constants.Sys.DEBUG);
} else {
Assert.ok(typeof(OS.Constants.Sys.DEBUG) == "undefined");
......
......@@ -88,7 +88,7 @@ add_task(async function test_backButton_forwardButton() {
}
await BrowserTestUtils.waitForCondition(() => {
return forwardButton.disabled == false;
return !forwardButton.disabled;
});
let forwardPromise = BrowserTestUtils.browserStopped(aBrowser);
info("click the forward button");
......@@ -106,7 +106,7 @@ add_task(async function test_reloadButton() {
"formless_basic.html");
await BrowserTestUtils.waitForCondition(() => {
return reloadButton.disabled == false;
return !reloadButton.disabled;
});
EventUtils.synthesizeMouseAtCenter(reloadButton, {});
await loadPromise;
......
......@@ -62,7 +62,7 @@ function run_test() {
let args = Array(num).fill(null);
let tryAgain = true;
while (tryAgain == true) {
while (tryAgain) {
try {
info(`Calling with args: ${JSON.stringify(args)}`);
func.apply(s, args);
......
......@@ -152,7 +152,7 @@ add_task(async function test_recording() {
// Check serializing only opt-out events.
snapshot = Telemetry.snapshotEvents(OPTOUT, false);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
let filtered = expected.filter(e => e.optout == true);
let filtered = expected.filter(e => !!e.optout);
checkEvents(snapshot.parent, filtered);
});
......
......@@ -226,7 +226,7 @@ const Preferences = window.Preferences = (function() {
if (aTarget.hasAttribute("on" + aEventName)) {
const fn = new Function("event", aTarget.getAttribute("on" + aEventName));
const rv = fn.call(aTarget, event);
if (rv == false)
if (!rv)
cancel = true;
}
return !cancel;
......
......@@ -97,7 +97,7 @@ body > div > div {width: 1000px;height: 1000px;}\
continue;
}
let prefsChanged = (test.middlemousepastepref == false || test.middlemousepastepref == true);
let prefsChanged = "middlemousepastepref" in test;
if (prefsChanged) {
await pushPrefs([["middlemouse.paste", test.middlemousepastepref]]);
}
......
......@@ -231,7 +231,7 @@
if (aTarget.hasAttribute("on" + aEventName)) {
var fn = new Function("event", aTarget.getAttribute("on" + aEventName));
var rv = fn.call(aTarget, event);
if (rv == false)
if (!rv)
cancel = true;
}
return !cancel;
......@@ -486,7 +486,7 @@
if (aTarget.hasAttribute("on" + aEventName)) {
var fn = new Function("event", aTarget.getAttribute("on" + aEventName));
var rv = fn.call(aTarget, event);
if (rv == false)
if (!rv)
cancel = true;
}
return !cancel;
......
......@@ -420,7 +420,7 @@
if (handler != "") {
var fn = new Function("event", handler);
var returned = fn(event);
if (returned == false)
if (!returned)
noCancel = false;
}
......
......@@ -2116,7 +2116,7 @@ var gDiscoverView = {
notifyInitialized();
};
if (Services.prefs.getBoolPref(PREF_GETADDONS_CACHE_ENABLED) == false) {
if (!Services.prefs.getBoolPref(PREF_GETADDONS_CACHE_ENABLED)) {
setURL(url);
return;
}
......
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