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
This commit is contained in:
Jared Wein 2018-02-08 13:35:53 -05:00
parent b433816cb9
commit 9788800512
22 changed files with 39 additions and 39 deletions

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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() {

View File

@ -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");
}
}

View File

@ -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) {

View File

@ -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 " +

View File

@ -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();
}

View File

@ -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);

View File

@ -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) {

View File

@ -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");

View File

@ -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;

View File

@ -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);

View File

@ -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);
});

View File

@ -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;

View File

@ -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]]);
}

View File

@ -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;

View File

@ -420,7 +420,7 @@
if (handler != "") {
var fn = new Function("event", handler);
var returned = fn(event);
if (returned == false)
if (!returned)
noCancel = false;
}

View File

@ -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;
}

View File

@ -114,7 +114,7 @@ add_task(testWithAPI(async function(browser) {
}
const PERM = "extensions.webextPermissionPrompts";
if (Services.prefs.getBoolPref(PERM, false) == false) {
if (!Services.prefs.getBoolPref(PERM, false)) {
await SpecialPowers.pushPrefEnv({clear: [[PERM]]});
await check(false, `mozAddonManager.permissionPromptsEnabled is false when ${PERM} is unset`);
}

View File

@ -84,7 +84,7 @@ function writeRelativePointer(aId, aName) {
function run_test() {
// pointer files only work with unpacked directories
if (Services.prefs.getBoolPref("extensions.alwaysUnpack") == false)
if (!Services.prefs.getBoolPref("extensions.alwaysUnpack"))
return;
do_test_pending();