Bug 1330791 - Enable the no-useless-call eslint rule for /services and fix associated errors. r=markh
☠☠ backed out by e34a208d8ac2 ☠ ☠
authorJared Wein <jwein@mozilla.com>
Thu, 12 Jan 2017 18:08:10 -0500
changeset 377086 4902107b75682b0a3dff7092be2247e300bb573c
parent 377085 5b2b2be2e389d364a58a8c8356e1913edeeb34b1
child 377087 a5fe483288dba9c1c3ad594b712f063c4eccc798
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1330791
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1330791 - Enable the no-useless-call eslint rule for /services and fix associated errors. r=markh MozReview-Commit-ID: Ixd7jk5G5CB
services/.eslintrc.js
services/cloudsync/CloudSyncEventSource.jsm
services/fxaccounts/tests/browser/browser_device_connected.js
services/sync/modules/addonsreconciler.js
services/sync/tests/unit/test_clients_engine.js
--- a/services/.eslintrc.js
+++ b/services/.eslintrc.js
@@ -16,11 +16,10 @@ module.exports = {
     "no-ex-assign": "warn",
     "no-func-assign": "warn",
     "no-native-reassign": "warn",
     "no-nested-ternary": "warn",
     "no-octal": "warn",
     "no-redeclare": "warn",
     "no-unreachable": "warn",
     "no-unsafe-finally": "warn",
-    "no-useless-call": "warn"
   }
 };
--- a/services/cloudsync/CloudSyncEventSource.jsm
+++ b/services/cloudsync/CloudSyncEventSource.jsm
@@ -49,17 +49,17 @@ EventSource.prototype = {
 
   emit(type, arg) {
     if (!this.listeners.has(type)) {
       return;
     }
     CommonUtils.nextTick(
       function() {
         for (let listener of this.listeners.get(type)) {
-          listener.call(undefined, arg);
+          listener(arg);
         }
       },
       this
     );
   },
 };
 
 this.EventSource = EventSource;
--- a/services/fxaccounts/tests/browser/browser_device_connected.js
+++ b/services/fxaccounts/tests/browser/browser_device_connected.js
@@ -7,17 +7,17 @@ const { MockRegistrar } =
   Cu.import("resource://testing-common/MockRegistrar.jsm", {});
 
 const StubAlertsService = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService, Ci.nsISupports]),
 
   showAlertNotification(image, title, text, clickable, cookie, clickCallback) {
     // We can't simulate a click on the alert popup,
     // so instead we call the click listener ourselves directly
-    clickCallback.observe.call(clickCallback, null, "alertclickcallback", null);
+    clickCallback.observe(null, "alertclickcallback", null);
   }
 }
 
 add_task(function*() {
   gBrowser.selectedBrowser.loadURI("about:robots");
   yield waitForDocLoadComplete();
 
   MockRegistrar.register("@mozilla.org/alerts-service;1", StubAlertsService);
--- a/services/sync/modules/addonsreconciler.js
+++ b/services/sync/modules/addonsreconciler.js
@@ -482,17 +482,17 @@ AddonsReconciler.prototype = {
    *        The new state of the add-on. From this.addons.
    */
   _addChange: function _addChange(date, change, state) {
     this._log.info("Change recorded for " + state.id);
     this._changes.push([date, change, state.id]);
 
     for (let listener of this._listeners) {
       try {
-        listener.changeListener.call(listener, date, change, state);
+        listener.changeListener(date, change, state);
       } catch (ex) {
         this._log.warn("Exception calling change listener", ex);
       }
     }
   },
 
   /**
    * Obtain the set of changes to add-ons since the date passed.
--- a/services/sync/tests/unit/test_clients_engine.js
+++ b/services/sync/tests/unit/test_clients_engine.js
@@ -1076,17 +1076,17 @@ add_task(async function test_upload_afte
     _("First sync. 2 records downloaded.");
     strictEqual(engine.lastRecordUpload, 0);
     engine._sync();
 
     _("Send tab to client");
     engine.sendCommand("displayURI", ["https://example.com", engine.localID, "Yak Herders Anonymous"], deviceBID);
 
     const oldUploadOutgoing = SyncEngine.prototype._uploadOutgoing;
-    SyncEngine.prototype._uploadOutgoing = () => engine._onRecordsWritten.call(engine, [], [deviceBID]);
+    SyncEngine.prototype._uploadOutgoing = () => engine._onRecordsWritten([], [deviceBID]);
     engine._sync();
 
     let collection = server.getCollection("foo", "clients");
     let deviceBPayload = JSON.parse(JSON.parse(collection.payload(deviceBID)).ciphertext);
     compareCommands(deviceBPayload.commands, [{
       command: "displayURI", args: ["https://deviceclink.com", deviceCID, "Device C link"]
     }], "Should be the same because the upload failed");
 
@@ -1176,17 +1176,17 @@ add_task(async function test_keep_cleare
   }), now - 10));
 
   try {
     _("First sync. Download remote and our record.");
     strictEqual(engine.lastRecordUpload, 0);
 
     let collection = server.getCollection("foo", "clients");
     const oldUploadOutgoing = SyncEngine.prototype._uploadOutgoing;
-    SyncEngine.prototype._uploadOutgoing = () => engine._onRecordsWritten.call(engine, [], [deviceBID]);
+    SyncEngine.prototype._uploadOutgoing = () => engine._onRecordsWritten([], [deviceBID]);
     let commandsProcessed = 0;
     engine._handleDisplayURIs = (uris) => { commandsProcessed = uris.length };
 
     engine._sync();
     engine.processIncomingCommands(); // Not called by the engine.sync(), gotta call it ourselves
     equal(commandsProcessed, 2, "We processed 2 commands");
 
     let localRemoteRecord = JSON.parse(JSON.parse(collection.payload(engine.localID)).ciphertext);