Bug 1330014 - Remove extra lines that eslint --fix adds for no-useless-return. r?standard8 draft
authorJared Wein <jwein@mozilla.com>
Tue, 10 Jan 2017 12:08:32 -0500
changeset 460671 ab792a9276fda112726c43aa8be48c5332aca672
parent 460670 37e74728e91d48157869d918e8f72d45e5917ca4
child 460693 8acf9c22296736826b874ba295c6d894380110a1
push id41457
push userbmo:jaws@mozilla.com
push dateFri, 13 Jan 2017 15:56:17 +0000
reviewersstandard8
bugs1330014
milestone53.0a1
Bug 1330014 - Remove extra lines that eslint --fix adds for no-useless-return. r?standard8 MozReview-Commit-ID: Be36laqLQQ2
services/common/rest.js
services/common/tests/unit/test_hawkclient.js
services/common/tests/unit/test_hawkrequest.js
services/fxaccounts/tests/xpcshell/test_client.js
services/sync/modules/addonutils.js
services/sync/modules/engines.js
services/sync/modules/userapi.js
services/sync/tps/extensions/tps/resource/tps.jsm
--- a/services/common/rest.js
+++ b/services/common/rest.js
@@ -97,17 +97,17 @@ RESTRequest.prototype = {
   _logName: "Services.Common.RESTRequest",
 
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsIBadCertListener2,
     Ci.nsIInterfaceRequestor,
     Ci.nsIChannelEventSink
   ]),
 
-  /** * Public API: ***/
+  /** Public API: **/
 
   /**
    * A constant boolean that indicates whether this object will automatically
    * utf-8 encode request bodies passed as an object. Used for feature detection
    * so, eg, loop can use the same source code for old and new Firefox versions.
    */
   willUTF8EncodeObjectRequests: true,
 
@@ -288,17 +288,17 @@ RESTRequest.prototype = {
     this.channel.cancel(Cr.NS_BINDING_ABORTED);
 
     if (this.timeoutTimer) {
       // Clear the abort timer now that the channel is done.
       this.timeoutTimer.clear();
     }
   },
 
-  /** * Implementation stuff ***/
+  /** Implementation stuff **/
 
   dispatch: function dispatch(method, data, onComplete, onProgress) {
     if (this.status != this.NOT_SENT) {
       throw "Request has already been sent!";
     }
 
     this.method = method;
     if (onComplete) {
@@ -407,17 +407,17 @@ RESTRequest.prototype = {
     if (!this.onComplete) {
       this._log.error("Unexpected error: onComplete not defined in " +
                       "abortTimeout.");
       return;
     }
     this.onComplete(error);
   },
 
-  /** * nsIStreamListener ***/
+  /** nsIStreamListener **/
 
   onStartRequest: function onStartRequest(channel) {
     if (this.status == this.ABORTED) {
       this._log.trace("Not proceeding with onStartRequest, request was aborted.");
       return;
     }
 
     try {
@@ -568,23 +568,23 @@ RESTRequest.prototype = {
       this.onComplete(ex);
       this.onComplete = this.onProgress = null;
       return;
     }
 
     this.delayTimeout();
   },
 
-  /** * nsIInterfaceRequestor ***/
+  /** nsIInterfaceRequestor **/
 
   getInterface(aIID) {
     return this.QueryInterface(aIID);
   },
 
-  /** * nsIBadCertListener2 ***/
+  /** nsIBadCertListener2 **/
 
   notifyCertProblem: function notifyCertProblem(socketInfo, sslStatus, targetHost) {
     this._log.warn("Invalid HTTPS certificate encountered!");
     // Suppress invalid HTTPS certificate warnings in the UI.
     // (The request will still fail.)
     return true;
   },
 
@@ -596,17 +596,17 @@ RESTRequest.prototype = {
   shouldCopyOnRedirect: function shouldCopyOnRedirect(oldChannel, newChannel, flags) {
     let isInternal = !!(flags & Ci.nsIChannelEventSink.REDIRECT_INTERNAL);
     let isSameURI  = newChannel.URI.equals(oldChannel.URI);
     this._log.debug("Channel redirect: " + oldChannel.URI.spec + ", " +
                     newChannel.URI.spec + ", internal = " + isInternal);
     return isInternal && isSameURI;
   },
 
-  /** * nsIChannelEventSink ***/
+  /** nsIChannelEventSink **/
   asyncOnChannelRedirect:
     function asyncOnChannelRedirect(oldChannel, newChannel, flags, callback) {
 
     let oldSpec = (oldChannel && oldChannel.URI) ? oldChannel.URI.spec : "<undefined>";
     let newSpec = (newChannel && newChannel.URI) ? newChannel.URI.spec : "<undefined>";
     this._log.debug("Channel redirect: " + oldSpec + ", " + newSpec + ", " + flags);
 
     try {
--- a/services/common/tests/unit/test_hawkclient.js
+++ b/services/common/tests/unit/test_hawkclient.js
@@ -307,17 +307,16 @@ add_task(function* test_retry_request_on
         return;
       }
 
       // Second time through, timestamp should be corrected by client
       do_check_true(delta < MINUTE_MS);
       let message = "i love you!!!";
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.bodyOutputStream.write(message, message.length);
-
     }
   });
 
   let client = new HawkClient(server.baseURI);
   function getOffset() {
     return client.localtimeOffsetMsec;
   }
 
@@ -456,17 +455,16 @@ add_task(function* test_401_then_500() {
       }
 
       // Second time through, timestamp should be corrected by client
       // And fail on the client
       do_check_true(delta < MINUTE_MS);
       let message = "Cannot get ye flask.";
       response.setStatusLine(request.httpVersion, 500, "Internal server error");
       response.bodyOutputStream.write(message, message.length);
-
     }
   });
 
   let client = new HawkClient(server.baseURI);
   function getOffset() {
     return client.localtimeOffsetMsec;
   }
 
--- a/services/common/tests/unit/test_hawkrequest.js
+++ b/services/common/tests/unit/test_hawkrequest.js
@@ -70,17 +70,16 @@ add_test(function test_intl_accept_langu
         setLanguagePref(languages[testCount]);
         return;
       }
 
       // We've checked all the entries in languages[]. Cleanup and move on.
       do_print("Checked " + testCount + " languages. Removing checkLanguagePref as pref observer.");
       Services.prefs.removeObserver("intl.accept_languages", checkLanguagePref);
       run_next_test();
-
     });
   }
 });
 
 add_test(function test_hawk_authenticated_request() {
   let onProgressCalled = false;
   let postData = {your: "data"};
 
--- a/services/fxaccounts/tests/xpcshell/test_client.js
+++ b/services/fxaccounts/tests/xpcshell/test_client.js
@@ -274,36 +274,32 @@ add_task(function* test_signIn() {
       let jsonBody = JSON.parse(body);
 
       if (jsonBody.email == unicodeUsername) {
         do_check_eq("", request._queryString);
         do_check_eq(jsonBody.authPW, "08b9d111196b8408e8ed92439da49206c8ecfbf343df0ae1ecefcd1e0174a8b6");
         response.setStatusLine(request.httpVersion, 200, "OK");
         response.bodyOutputStream.write(sessionMessage_noKey,
                                         sessionMessage_noKey.length);
-
       } else if (jsonBody.email == "you@example.com") {
         do_check_eq("keys=true", request._queryString);
         do_check_eq(jsonBody.authPW, "93d20ec50304d496d0707ec20d7e8c89459b6396ec5dd5b9e92809c5e42856c7");
         response.setStatusLine(request.httpVersion, 200, "OK");
         response.bodyOutputStream.write(sessionMessage_withKey,
                                         sessionMessage_withKey.length);
-
       } else if (jsonBody.email == "You@example.com") {
         // Error trying to sign in with a wrong capitalization
         response.setStatusLine(request.httpVersion, 400, "Bad request");
         response.bodyOutputStream.write(errorMessage_wrongCap,
                                         errorMessage_wrongCap.length);
-
       } else {
         // Error trying to sign in to nonexistent account
         response.setStatusLine(request.httpVersion, 400, "Bad request");
         response.bodyOutputStream.write(errorMessage_notExistent,
                                         errorMessage_notExistent.length);
-
       }
     },
   });
 
   // Login without retrieving optional keys
   let client = new FxAccountsClient(server.baseURI);
   let result = yield client.signIn(unicodeUsername, 'bigsecret');
   do_check_eq(FAKE_SESSION_TOKEN, result.sessionToken);
@@ -349,17 +345,16 @@ add_task(function* test_signOut() {
         response.setStatusLine(request.httpVersion, 200, "OK");
         response.bodyOutputStream.write(signoutMessage, signoutMessage.length);
         return;
       }
 
       // Error trying to sign out of nonexistent account
       response.setStatusLine(request.httpVersion, 400, "Bad request");
       response.bodyOutputStream.write(errorMessage, errorMessage.length);
-
     },
   });
 
   let client = new FxAccountsClient(server.baseURI);
   let result = yield client.signOut("FakeSession");
   do_check_eq(typeof result, "object");
 
   // Trigger error path
@@ -388,17 +383,16 @@ add_task(function* test_recoveryEmailSta
         response.setStatusLine(request.httpVersion, 200, "OK");
         response.bodyOutputStream.write(emailStatus, emailStatus.length);
         return;
       }
 
       // Second call gets an error trying to query a nonexistent account
       response.setStatusLine(request.httpVersion, 400, "Bad request");
       response.bodyOutputStream.write(errorMessage, errorMessage.length);
-
     },
   });
 
   let client = new FxAccountsClient(server.baseURI);
   let result = yield client.recoveryEmailStatus(FAKE_SESSION_TOKEN);
   do_check_eq(result.verified, true);
 
   // Trigger error path
@@ -417,17 +411,16 @@ add_task(function* test_recoveryEmailSta
   let server = httpd_setup({
     "/recovery_email/status": function(request, response) {
       do_check_true(request.hasHeader("Authorization"));
       // if there is a query string then it will have a reason
       do_check_eq("reason=push", request._queryString);
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.bodyOutputStream.write(emailStatus, emailStatus.length);
-
     },
   });
 
   let client = new FxAccountsClient(server.baseURI);
   let result = yield client.recoveryEmailStatus(FAKE_SESSION_TOKEN, {
     reason: "push",
   });
   do_check_eq(result.verified, true);
@@ -447,17 +440,16 @@ add_task(function* test_resendVerificati
         response.setStatusLine(request.httpVersion, 200, "OK");
         response.bodyOutputStream.write(emptyMessage, emptyMessage.length);
         return;
       }
 
       // Second call gets an error trying to query a nonexistent account
       response.setStatusLine(request.httpVersion, 400, "Bad request");
       response.bodyOutputStream.write(errorMessage, errorMessage.length);
-
     },
   });
 
   let client = new FxAccountsClient(server.baseURI);
   let result = yield client.resendVerificationEmail(FAKE_SESSION_TOKEN);
   do_check_eq(JSON.stringify(result), emptyMessage);
 
   // Trigger error path
@@ -570,17 +562,16 @@ add_task(function* test_signCertificate(
         response.setStatusLine(request.httpVersion, 200, "OK");
         response.bodyOutputStream.write(certSignMessage, certSignMessage.length);
         return;
       }
 
       // Second attempt, trigger error
       response.setStatusLine(request.httpVersion, 400, "Bad request");
       response.bodyOutputStream.write(errorMessage, errorMessage.length);
-
     },
   });
 
   let client = new FxAccountsClient(server.baseURI);
   let result = yield client.signCertificate(FAKE_SESSION_TOKEN, JSON.stringify({foo: "bar"}), 600);
   do_check_eq("baz", result.bar);
 
   // Account doesn't exist
--- a/services/sync/modules/addonutils.js
+++ b/services/sync/modules/addonutils.js
@@ -488,17 +488,16 @@ AddonUtilsInternal.prototype = {
       AddonManager.addAddonListener(listener);
     }
 
     this._log.info("Updating userDisabled flag: " + addon.id + " -> " + value);
     addon.userDisabled = !!value;
 
     if (!addon.appDisabled) {
       cb(null, addon);
-
     }
     // Else the listener will handle invoking the callback.
   },
 
 };
 
 XPCOMUtils.defineLazyGetter(this, "AddonUtils", function() {
   return new AddonUtilsInternal();
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -245,17 +245,16 @@ Tracker.prototype = {
           this.stopTracking();
           this._isTracking = false;
         }
         return;
       case "nsPref:changed":
         if (data == PREFS_BRANCH + "engine." + this.engine.prefName) {
           this.onEngineEnabledChanged(this.engine.enabled);
         }
-
     }
   }
 };
 
 
 
 /**
  * The Store serves as the interface between Sync and stored data.
--- a/services/sync/modules/userapi.js
+++ b/services/sync/modules/userapi.js
@@ -130,23 +130,20 @@ UserAPI10Client.prototype = {
     if (error) {
       cb(error, null);
       return;
     }
 
     let body = request.response.body;
     if (body == "0") {
       cb(null, false);
-
     } else if (body == "1") {
       cb(null, true);
-
     } else {
       cb(new Error("Unknown response from server: " + body), null);
-
     }
   },
 
   _onWeaveNode: function _onWeaveNode(cb, request, error) {
     if (error) {
       cb.network = true;
       cb(error, null);
       return;
@@ -173,17 +170,16 @@ UserAPI10Client.prototype = {
       case 404:
         error.notFound = true;
         break;
       default:
         error.message = "Unexpected response code: " + response.status;
     }
 
     cb(error, null);
-
   },
 
   _onChangePassword: function _onChangePassword(cb, request, error) {
     this._log.info("Password change response received: " +
                    request.response.status);
     if (error) {
       cb(error);
       return;
@@ -213,12 +209,11 @@ UserAPI10Client.prototype = {
       cb(null, response.body);
       return;
     }
 
     error = new Error("Could not create user.");
     error.body = response.body;
 
     cb(error, null);
-
   },
 };
 Object.freeze(UserAPI10Client.prototype);
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -567,20 +567,18 @@ var TPS = {
       throw (e);
     }
   },
 
   MozmillEndTestListener: function TPS__MozmillEndTestListener(obj) {
     Logger.logInfo("mozmill endTest: " + JSON.stringify(obj));
     if (obj.failed > 0) {
       this.DumpError('mozmill test failed, name: ' + obj.name + ', reason: ' + JSON.stringify(obj.fails));
-
     } else if ('skipped' in obj && obj.skipped) {
       this.DumpError('mozmill test failed, name: ' + obj.name + ', reason: ' + obj.skipped_reason);
-
     } else {
       Utils.namedTimer(function() {
         this.FinishAsyncOperation();
       }, 2000, this, "postmozmilltest");
     }
   },
 
   MozmillSetTestListener: function TPS__MozmillSetTestListener(obj) {
@@ -880,17 +878,16 @@ var TPS = {
       this.shouldValidateBookmarks = false;
 
       // Always give Sync an extra tick to initialize. If we waited for the
       // service:ready event, this is required to ensure all handlers have
       // executed.
       Utils.nextTick(this._executeTestPhase.bind(this, file, phase, settings));
     } catch (e) {
       this.DumpError("RunTestPhase failed", e);
-
     }
   },
 
   /**
    * Executes a single test phase.
    *
    * This is called by RunTestPhase() after the environment is validated.
    */
@@ -943,17 +940,16 @@ var TPS = {
       Weave.Svc.Prefs.set("client.name", this.phases[this._currentPhase]);
 
       this._interceptSyncTelemetry();
 
       // start processing the test actions
       this._currentAction = 0;
     } catch (e) {
       this.DumpError("_executeTestPhase failed", e);
-
     }
   },
 
   /**
    * Override sync telemetry functions so that we can detect errors generating
    * the sync ping, and count how many pings we report.
    */
   _interceptSyncTelemetry() {