Bug 1328805 - Enable the no-cond-assign rule for eslint and fix the six resulting errors mostly by wrapping the assignment with parentheses to explicitly state that the assignment is intentional with exception for advanced.js where assignment was not intended. r=mossop

MozReview-Commit-ID: EZytfzGoMLR

--HG--
extra : rebase_source : 6d64988ba720f172c188214c1ffbef87d093c79c
This commit is contained in:
Jared Wein 2017-01-05 01:03:08 -05:00
parent f598aa2509
commit a937f60d4f
7 changed files with 10 additions and 8 deletions

View File

@ -228,7 +228,7 @@ var gAdvancedPane = {
* sync its new value to the gfx.direct2d.disabled pref too.
*/
updateHardwareAcceleration() {
if (AppConstants.platform = "win") {
if (AppConstants.platform == "win") {
var fromPref = document.getElementById("layers.acceleration.disabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;

View File

@ -60,6 +60,9 @@ module.exports = {
// Use [] instead of Array()
// "no-array-constructor": "error",
// Disallow assignment operators in conditional statements
"no-cond-assign": "error",
// Disallow the use of debugger
"no-debugger": "error",

View File

@ -1016,7 +1016,7 @@ var SubprocessMonitor = {
// We first iterate the table to check if summaries exist for rowPids,
// if yes, update them and delete the pid's summary or else hide the row
// for recycling it. Start at row 1 instead of 0 (to skip the header row).
for (let i = 1, row; row = resultTable.rows[i]; i++) {
for (let i = 1, row; (row = resultTable.rows[i]); i++) {
let rowPid = row.dataset.pid;
let summary = summaries[rowPid];
if (summary) {

View File

@ -341,7 +341,7 @@ function dbOK(expectedRows) {
},
handleResult(results) {
let row = null;
while (row = results.getNextRow()) {
while ((row = results.getNextRow())) {
actualRows.push(cols.map(c => row.getResultByName(c)));
}
},

View File

@ -84,8 +84,7 @@ HierarchicalClustering.prototype = {
}
// merge the next two closest clusters until none of them are close enough
let next = null, i = 0;
for (; next = this.closestClusters(clusters, distances, neighbors); i++) {
for (let next = null, i = 0; (next = this.closestClusters(clusters, distances, neighbors)); i++) {
if (snapshotCallback && (i % snapshotGap) == 0) {
snapshotCallback(clusters);
}

View File

@ -457,8 +457,8 @@ var snapshotFormatters = {
let contents;
if (entry.message.length > 0 && entry.message[0] == "#") {
// This is a failure ID. See nsIGfxInfo.idl.
let m;
if (m = /#BLOCKLIST_FEATURE_FAILURE_BUG_(\d+)/.exec(entry.message)) {
let m = /#BLOCKLIST_FEATURE_FAILURE_BUG_(\d+)/.exec(entry.message);
if (m) {
let bugSpan = $.new("span");
bugSpan.textContent = strings.GetStringFromName("blocklistedBug") + "; ";

View File

@ -72,7 +72,7 @@ function getFileSize(aFile) {
let size = 0;
let entries = aFile.directoryEntries.QueryInterface(AM_Ci.nsIDirectoryEnumerator);
let entry;
while (entry = entries.nextFile)
while ((entry = entries.nextFile))
size += getFileSize(entry);
entries.close();
return size;