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
Родитель b433816cb9
Коммит 9788800512
22 изменённых файлов: 39 добавлений и 39 удалений

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

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

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

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

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

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