Bug 1329014 - Enable the no-extra-bind rule and use eslint --fix to autofix the errors. r=standard8

MozReview-Commit-ID: BwK94W2mHXS

--HG--
extra : rebase_source : a905658829084d3a4018df81f51bb210ef1e645b
This commit is contained in:
Jared Wein 2017-01-05 16:43:29 -05:00
parent 5f011d137e
commit f64146d9d7
24 changed files with 39 additions and 36 deletions

View File

@ -308,7 +308,7 @@
if (getErrorCode() == "weakCryptoUsed" || getErrorCode() == "sslv3Used") {
setupAdvancedButton(getErrorCode() == "weakCryptoUsed");
}
}.bind(this), true, true);
}, true, true);
var event = new CustomEvent("AboutNetErrorLoad", {bubbles:true});
document.dispatchEvent(event);

View File

@ -293,8 +293,8 @@ function GetBookmarksResource(aProfileFolder) {
if (gotErrors) {
throw new Error("The migration included errors.");
}
}.bind(this)).then(() => aCallback(true),
() => aCallback(false));
}).then(() => aCallback(true),
() => aCallback(false));
}
};
}

View File

@ -328,7 +328,7 @@ SearchStrings.prototype = {
FormHistory.update(changes);
}
}
}.bind(this), aCallback));
}, aCallback));
}
};

View File

@ -135,5 +135,5 @@ function nextChangeNotificationPromise(aNewURL, testMessage) {
return TestUtils.topicObserved("newtab-url-changed", function observer(aSubject, aData) { // jshint unused:false
Assert.equal(aData, aNewURL, testMessage);
return true;
}.bind(this));
});
}

View File

@ -91,7 +91,7 @@ add_task(function* webchannel_broadcast() {
NewTabWebChannel.off("foo", test_message);
resolve(msg.target);
}
}.bind(this));
});
});
let countingReplyPromise = new Promise(resolve => {
@ -102,7 +102,7 @@ add_task(function* webchannel_broadcast() {
NewTabWebChannel.off("reply", test_message);
resolve(msg.target);
}
}.bind(this));
});
});
let countingUnloadPromise = new Promise(resolve => {
@ -147,7 +147,7 @@ add_task(function* webchannel_switch() {
return new Promise(resolve => {
NewTabWebChannel.once("foo", function(name, msg) {
resolve(msg.target);
}.bind(this));
});
});
}

View File

@ -48,5 +48,5 @@ function nextChangeNotificationPromise(aNewURL, testMessage) {
return TestUtils.topicObserved("newtab-url-changed", function observer(aSubject, aData) { // jshint unused:false
Assert.equal(aData, aNewURL, testMessage);
return true;
}.bind(this));
});
}

View File

@ -1161,7 +1161,7 @@ BrowserGlue.prototype = {
if (willPrompt) {
Services.tm.mainThread.dispatch(function() {
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
}, Ci.nsIThread.DISPATCH_NORMAL);
}
}

View File

@ -1318,7 +1318,7 @@ this.UITour = {
["score", rating],
["flowid", aOptions.flowId]
]));
}.bind(this));
});
// Add it to the container.
ratingContainer.appendChild(ratingElement);

View File

@ -450,7 +450,7 @@ this.SocialService = {
getProvider: function getProvider(origin, onDone) {
schedule((function() {
onDone(SocialServiceInternal.providers[origin] || null);
}).bind(this));
}));
},
// Returns an unordered array of installed providers

View File

@ -78,6 +78,9 @@ module.exports = {
// No duplicate cases in switch statements
"no-duplicate-case": "error",
// Disallow unnecessary calls to .bind()
"no-extra-bind": "error",
// No labels
"no-labels": "error",

View File

@ -760,7 +760,7 @@ this.CrashManager.prototype = Object.freeze({
entries.sort((a, b) => { return a.date - b.date; });
return entries;
}.bind(this));
});
},
_getStore() {

View File

@ -2097,7 +2097,7 @@ this.DownloadCopySaver.prototype = {
}
}.bind(copySaver),
onStopRequest: function(aRequest, aContext, aStatusCode) {
onStopRequest(aRequest, aContext, aStatusCode) {
try {
backgroundFileSaver.onStopRequest(aRequest, aContext,
aStatusCode);
@ -2109,14 +2109,14 @@ this.DownloadCopySaver.prototype = {
backgroundFileSaver.finish(Cr.NS_OK);
}
}
}.bind(copySaver),
},
onDataAvailable: function(aRequest, aContext, aInputStream,
onDataAvailable(aRequest, aContext, aInputStream,
aOffset, aCount) {
backgroundFileSaver.onDataAvailable(aRequest, aContext,
aInputStream, aOffset,
aCount);
}.bind(copySaver),
},
});
// We should check if we have been canceled in the meantime, after

View File

@ -361,7 +361,7 @@ function promiseStartLegacyDownload(aSourceUrl, aOptions) {
// Start the actual download process.
persist.savePrivacyAwareURI(sourceURI, null, null, 0, null, null, targetFile,
isPrivate);
}.bind(this)).then(null, do_report_unexpected_exception);
}).then(null, do_report_unexpected_exception);
return deferred.promise;
}
@ -429,7 +429,7 @@ function promiseStartExternalHelperAppServiceDownload(aSourceUrl) {
aOffset, aCount);
},
});
}.bind(this)).then(null, do_report_unexpected_exception);
}).then(null, do_report_unexpected_exception);
return deferred.promise;
}

View File

@ -1380,7 +1380,7 @@ function reorderChildren(parent, orderedChildrenGuids, options) {
{ orphanAnno: PlacesSyncUtils.bookmarks.SYNC_PARENT_ANNO });
return children;
}.bind(this))
})
);
}

View File

@ -621,7 +621,7 @@ var TransactionsManager = {
TransactionsHistory.clearRedoEntries();
else
throw new Error("either aUndoEntries or aRedoEntries should be true");
}.bind(this));
});
this._transactEnqueuer.alsoWaitFor(promise);
return promise;

View File

@ -1838,7 +1838,7 @@ this.PlacesUtils = {
break;
}
return item;
}.bind(this);
};
const QUERY_STR =
`/* do not warn (bug no): cannot use an index */
@ -2273,7 +2273,7 @@ var Keywords = {
// In any case, notify about the new keyword.
yield notifyKeywordChange(url.href, keyword, source);
}.bind(this))
})
);
},
@ -2311,7 +2311,7 @@ var Keywords = {
// Notify bookmarks about the removal.
yield notifyKeywordChange(url.href, "", source);
}.bind(this))) ;
}));
}
};

View File

@ -1998,7 +1998,7 @@ UnifiedComplete.prototype = {
yield SwitchToTabStorage.initDatabase(conn);
return conn;
}.bind(this)).then(null, ex => {
}).then(null, ex => {
dump("Couldn't get database handle: " + ex + "\n");
Cu.reportError(ex);
});

View File

@ -911,7 +911,7 @@ AboutReader.prototype = {
item.classList.add("selected");
callback(option.value);
}.bind(this), true);
}, true);
if (option.value === initialValue)
item.classList.add("selected");

View File

@ -1911,7 +1911,7 @@ var Impl = {
// TODO: We are keeping this behaviour for now but it will be removed as soon as
// bug 1127907 lands.
Services.obs.notifyObservers(null, "gather-telemetry", null);
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL);
}), Ci.nsIThread.DISPATCH_NORMAL);
break;
case "application-background":

View File

@ -253,7 +253,7 @@ IdentityProviderService.prototype = {
// sandbox.
log("genKeyPair: generated keypair for provisioning flow with id:", aProvId);
provFlow.caller.doGenKeyPairCallback(provFlow.kp.serializedPublicKey);
}.bind(this));
});
},
/**

View File

@ -51,7 +51,7 @@ this.ProfileAge.prototype = {
return this.computeAndPersistCreated(times)
.then(function onSuccess(created) {
return created;
}.bind(this));
});
}
return this.getTimes()

View File

@ -60,7 +60,7 @@ RokuApp.prototype = {
if (callback) {
callback({ state: "unknown" });
}
}).bind(this), false);
}), false);
xhr.send(null);
},
@ -91,13 +91,13 @@ RokuApp.prototype = {
if (callback) {
callback(xhr.status === 200);
}
}).bind(this), false);
}), false);
xhr.addEventListener("error", (function() {
if (callback) {
callback(false);
}
}).bind(this), false);
}), false);
xhr.send(null);
},
@ -114,13 +114,13 @@ RokuApp.prototype = {
if (callback) {
callback(xhr.status === 200);
}
}).bind(this), false);
}), false);
xhr.addEventListener("error", (function() {
if (callback) {
callback(false);
}
}).bind(this), false);
}), false);
xhr.send(null);
},

View File

@ -80,7 +80,7 @@ var SimpleServiceDiscovery = {
} else if (name.startsWith("ST")) {
service.target = row.substr(4).trim();
}
}.bind(this));
});
if (service.location && service.target) {
service.location = this._forceTrailingSlash(service.location);

View File

@ -3491,7 +3491,7 @@ var gDetailView = {
if (aCallback)
aCallback();
}).bind(this);
});
xhr.onerror = function(aEvent) {
Cu.reportError("Error " + aEvent.target.status +
" occurred while receiving " + this._addon.optionsURL);