Bug 1561435 - Fix linting errors for netwerk/, r=standard8
authorVictor Porof <vporof@mozilla.com>
Fri, 21 Jun 2019 13:55:36 -0700
changeset 481401 9d81554c410bd0b5d0f384fc5ceb3117bc7f5ced
parent 481400 d9a6985d5acd2cdd1c8e582868a5975473a78794
child 481402 17cf3eb8f0ee8ad657ccc77a34df7877a09ad13b
push id36243
push uservporof@mozilla.com
push dateFri, 05 Jul 2019 14:04:25 +0000
treeherdermozilla-central@041abaa4aa85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1561435
milestone69.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 1561435 - Fix linting errors for netwerk/, r=standard8 # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35920
netwerk/test/httpserver/test/head_utils.js
netwerk/test/httpserver/test/test_async_response_sending.js
netwerk/test/httpserver/test/test_host.js
netwerk/test/httpserver/test/test_seizepower.js
netwerk/test/httpserver/test/test_sjs_state.js
netwerk/test/unit/test_304_responses.js
netwerk/test/unit/test_MIME_params.js
netwerk/test/unit/test_protocolproxyservice.js
--- a/netwerk/test/httpserver/test/head_utils.js
+++ b/netwerk/test/httpserver/test/head_utils.js
@@ -381,19 +381,19 @@ function RawTest(host, port, data, respo
   }
   if (!(data instanceof Array)) {
     data = [data];
   }
   if (data.length <= 0) {
     throw new Error("bad data length");
   }
 
-  // eslint-disable-next-line no-control-regex
   if (
     !data.every(function(v) {
+      // eslint-disable-next-line no-control-regex
       return /^[\x00-\xff]*$/.test(v);
     })
   ) {
     throw new Error("bad data contained non-byte-valued character");
   }
 
   this.host = host;
   this.port = port;
--- a/netwerk/test/httpserver/test/test_async_response_sending.js
+++ b/netwerk/test/httpserver/test/test_async_response_sending.js
@@ -17,16 +17,17 @@
  */
 
 gThreadManager = Cc["@mozilla.org/thread-manager;1"].createInstance();
 
 function run_test() {
   do_test_pending();
   tests.push(function testsComplete(_) {
     dumpn(
+      // eslint-disable-next-line no-useless-concat
       "******************\n" + "* TESTS COMPLETE *\n" + "******************"
     );
     do_test_finished();
   });
 
   runNextTest();
 }
 
@@ -522,16 +523,17 @@ function CustomPipe(name) {
         this._notify();
       }
     },
 
     //
     // see nsIAsyncInputStream.closeWithStatus
     //
     closeWithStatus: function closeWithStatus(status) {
+      // eslint-disable-next-line no-useless-concat
       dumpn("*** [" + this.name + "].closeWithStatus" + "(" + status + ")");
 
       if (!Components.isSuccessCode(self._status)) {
         dumpn(
           "*** ignoring second closure of [input " +
             this.name +
             "] " +
             "(status " +
@@ -924,17 +926,17 @@ function CustomPipe(name) {
       } else {
         Assert.ok(
           this._writable >= this._writableAmounts[0],
           "writable amounts value greater than writable data?"
         );
         Assert.equal(
           this._writable,
           sum(this._writableAmounts),
-          "total writable amount not equal to sum of writable " + "increments"
+          "total writable amount not equal to sum of writable increments"
         );
         actualWritten = this._writableAmounts.shift();
       }
 
       var bytes = str
         .substring(0, actualWritten)
         .split("")
         .map(function(v) {
@@ -1488,16 +1490,17 @@ CopyTest.prototype = {
    */
   _waitForWrittenData: function _waitForWrittenData() {
     dumpn("*** _waitForWrittenData (" + this.name + ")");
 
     var self = this;
     var outputWrittenWatcher = {
       onInputStreamReady: function onInputStreamReady(input) {
         dumpn(
+          // eslint-disable-next-line no-useless-concat
           "*** outputWrittenWatcher.onInputStreamReady" + "(" + input.name + ")"
         );
 
         if (self._allDataWritten) {
           do_throw(
             "ruh-roh!  why are we getting notified of more data " +
               "after we should have received all of it?"
           );
@@ -1560,19 +1563,17 @@ CopyTest.prototype = {
   },
 
   /**
    * Indicates this test is complete, does the final data-received and copy
    * status comparisons, and calls the test-completion function provided when
    * this test was first created.
    */
   _testComplete: function _testComplete() {
-    dumpn(
-      "*** CopyTest(" + this.name + ") complete!  " + "On to the next test..."
-    );
+    dumpn("*** CopyTest(" + this.name + ") complete!  On to the next test...");
 
     try {
       Assert.ok(this._allDataWritten, "expect all data written now!");
       Assert.ok(this._copyingFinished, "expect copying finished now!");
 
       Assert.equal(
         this._actualStatus,
         this._expectedStatus,
--- a/netwerk/test/httpserver/test/test_host.js
+++ b/netwerk/test/httpserver/test/test_host.js
@@ -249,17 +249,17 @@ var test, data;
 var tests = [];
 
 // HTTP/1.0 request, to ensure we see our default scheme/host/port
 
 function http10Request(request, response) {
   writeDetails(request, response);
   response.setStatusLine("1.0", 200, "TEST PASSED");
 }
-data = "GET /http/1.0-request HTTP/1.0\r\n" + "\r\n";
+data = "GET /http/1.0-request HTTP/1.0\r\n\r\n";
 function check10(aData) {
   let iter = LineIterator(aData);
 
   // Status-Line
   Assert.equal(iter.next().value, "HTTP/1.0 200 TEST PASSED");
 
   skipHeaders(iter);
 
@@ -276,38 +276,41 @@ function check10(aData) {
 
   expectLines(iter, body);
 }
 test = new RawTest("localhost", PORT, data, check10);
 tests.push(test);
 
 // HTTP/1.1 request, no Host header, expect a 400 response
 
+// eslint-disable-next-line no-useless-concat
 data = "GET /http/1.1-request HTTP/1.1\r\n" + "\r\n";
 test = new RawTest("localhost", PORT, data, check400);
 tests.push(test);
 
 // HTTP/1.1 request, wrong host, expect a 400 response
 
 data =
+  // eslint-disable-next-line no-useless-concat
   "GET /http/1.1-request HTTP/1.1\r\n" + "Host: not-localhost\r\n" + "\r\n";
 test = new RawTest("localhost", PORT, data, check400);
 tests.push(test);
 
 // HTTP/1.1 request, wrong host/right port, expect a 400 response
 
 data =
   "GET /http/1.1-request HTTP/1.1\r\n" +
   "Host: not-localhost:4444\r\n" +
   "\r\n";
 test = new RawTest("localhost", PORT, data, check400);
 tests.push(test);
 
 // HTTP/1.1 request, Host header has host but no port, expect a 400 response
 
+// eslint-disable-next-line no-useless-concat
 data = "GET /http/1.1-request HTTP/1.1\r\n" + "Host: 127.0.0.1\r\n" + "\r\n";
 test = new RawTest("localhost", PORT, data, check400);
 tests.push(test);
 
 // HTTP/1.1 request, Request-URI has wrong port, expect a 400 response
 
 data =
   "GET http://127.0.0.1/http/1.1-request HTTP/1.1\r\n" +
@@ -336,16 +339,17 @@ tests.push(test);
 
 // HTTP/1.1 request, correct Host header, expect handler's response
 
 function http11goodHost(request, response) {
   writeDetails(request, response);
   response.setStatusLine("1.1", 200, "TEST PASSED");
 }
 data =
+  // eslint-disable-next-line no-useless-concat
   "GET /http/1.1-good-host HTTP/1.1\r\n" + "Host: localhost:4444\r\n" + "\r\n";
 function check11goodHost(aData) {
   let iter = LineIterator(aData);
 
   // Status-Line
   Assert.equal(iter.next().value, "HTTP/1.1 200 TEST PASSED");
 
   skipHeaders(iter);
@@ -368,16 +372,17 @@ tests.push(test);
 
 // HTTP/1.1 request, Host header is secondary identity
 
 function http11ipHost(request, response) {
   writeDetails(request, response);
   response.setStatusLine("1.1", 200, "TEST PASSED");
 }
 data =
+  // eslint-disable-next-line no-useless-concat
   "GET /http/1.1-ip-host HTTP/1.1\r\n" + "Host: 127.0.0.1:4444\r\n" + "\r\n";
 function check11ipHost(aData) {
   let iter = LineIterator(aData);
 
   // Status-Line
   Assert.equal(iter.next().value, "HTTP/1.1 200 TEST PASSED");
 
   skipHeaders(iter);
@@ -556,16 +561,17 @@ data =
   "GET is-this-the-real-life-is-this-just-fantasy HTTP/1.1\r\n" +
   "Host: localhost:4444\r\n" +
   "\r\n";
 test = new RawTest("localhost", PORT, data, check400);
 tests.push(test);
 
 // HTTP/1.1 request, a malformed Host header
 
+// eslint-disable-next-line no-useless-concat
 data = "GET /http/1.1-request HTTP/1.1\r\n" + "Host: la la la\r\n" + "\r\n";
 test = new RawTest("localhost", PORT, data, check400);
 tests.push(test);
 
 // HTTP/1.1 request, a malformed Host header but absolute URI, 5.2 sez fine
 
 data =
   "GET http://localhost:4444/http/1.1-good-host HTTP/1.1\r\n" +
--- a/netwerk/test/httpserver/test/test_seizepower.js
+++ b/netwerk/test/httpserver/test/test_seizepower.js
@@ -145,35 +145,40 @@ XPCOMUtils.defineLazyGetter(this, "tests
     new RawTest("localhost", PORT, data0, checkRawData),
     new RawTest("localhost", PORT, data1, checkTooLate),
     new RawTest("localhost", PORT, data2, checkExceptions),
     new RawTest("localhost", PORT, data3, checkAsyncSeizure),
     new RawTest("localhost", PORT, data4, checkSeizeAfterAsync),
   ];
 });
 
+// eslint-disable-next-line no-useless-concat
 var data0 = "GET /raw-data HTTP/1.0\r\n" + "\r\n";
 function checkRawData(data) {
   Assert.equal(data, "Raw data!");
 }
 
+// eslint-disable-next-line no-useless-concat
 var data1 = "GET /called-too-late HTTP/1.0\r\n" + "\r\n";
 function checkTooLate(data) {
   Assert.equal(LineIterator(data).next().value, "too-late passed");
 }
 
+// eslint-disable-next-line no-useless-concat
 var data2 = "GET /exceptions HTTP/1.0\r\n" + "\r\n";
 function checkExceptions(data) {
   Assert.equal("exceptions test passed", data);
 }
 
+// eslint-disable-next-line no-useless-concat
 var data3 = "GET /async-seizure HTTP/1.0\r\n" + "\r\n";
 function checkAsyncSeizure(data) {
   Assert.equal(data, "async seizure passed");
 }
 
+// eslint-disable-next-line no-useless-concat
 var data4 = "GET /seize-after-async HTTP/1.0\r\n" + "\r\n";
 function checkSeizeAfterAsync(data) {
   Assert.equal(
     LineIterator(data).next().value,
     "HTTP/1.0 200 async seizure pass"
   );
 }
--- a/netwerk/test/httpserver/test/test_sjs_state.js
+++ b/netwerk/test/httpserver/test/test_sjs_state.js
@@ -76,54 +76,61 @@ function pathHandler(request, response) 
 
 /** *************
  * BEGIN TESTS *
  ***************/
 
 XPCOMUtils.defineLazyGetter(this, "tests", function() {
   return [
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state1.sjs?" + "newShared=newShared&newPrivate=newPrivate",
       null,
       start_initial,
       null
     ),
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state1.sjs?" + "newShared=newShared2&newPrivate=newPrivate2",
       null,
       start_overwrite,
       null
     ),
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state1.sjs?" + "newShared=&newPrivate=newPrivate3",
       null,
       start_remove,
       null
     ),
     new Test(URL + "/path-handler", null, start_handler, null),
     new Test(URL + "/path-handler", null, start_handler_again, null),
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state2.sjs?" + "newShared=newShared4&newPrivate=newPrivate4",
       null,
       start_other_initial,
       null
     ),
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state2.sjs?" + "newShared=",
       null,
       start_other_remove_ignore,
       null
     ),
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state2.sjs?" + "newShared=newShared5&newPrivate=newPrivate5",
       null,
       start_other_set_new,
       null
     ),
     new Test(
+      // eslint-disable-next-line no-useless-concat
       URL + "/state1.sjs?" + "newShared=done!&newPrivate=",
       null,
       start_set_remove_original,
       null
     ),
   ];
 });
 
--- a/netwerk/test/unit/test_304_responses.js
+++ b/netwerk/test/unit/test_304_responses.js
@@ -83,16 +83,17 @@ add_test(function test_304_stored_in_cac
     baseURI + existingCached304,
     "disk",
     Ci.nsICacheStorage.OPEN_NORMALLY,
     null,
     function(entryStatus, cacheEntry) {
       cacheEntry.setMetaDataElement("request-method", "GET");
       cacheEntry.setMetaDataElement(
         "response-head",
+        // eslint-disable-next-line no-useless-concat
         "HTTP/1.1 304 Not Modified\r\n" + "\r\n"
       );
       cacheEntry.metaDataReady();
       cacheEntry.close();
 
       var chan = make_channel(baseURI + existingCached304);
 
       // make it a custom conditional request
--- a/netwerk/test/unit/test_MIME_params.js
+++ b/netwerk/test/unit/test_MIME_params.js
@@ -290,16 +290,17 @@ var tests = [
       " filename*11111111111111111111111111111111111111111111111111111111111=1",
     "attachment",
     "0",
     /* "attachment", "basic" */
   ],
 
   // check underflow
   [
+    // eslint-disable-next-line no-useless-concat
     "attachment; filename=basic; filename*0*=UTF-8''0;\r\n" + " filename*-1=1",
     "attachment",
     "0",
     /* "attachment", "basic" */
   ],
 
   // check mixed token/quoted-string
   [
--- a/netwerk/test/unit/test_protocolproxyservice.js
+++ b/netwerk/test/unit/test_protocolproxyservice.js
@@ -916,16 +916,17 @@ function myipaddress2_callback(pi) {
   Assert.notEqual(pi.host, "127.0.0.1");
   Assert.notEqual(pi.host, "::1");
 
   run_failed_script_test();
 }
 
 function run_failed_script_test() {
   // test to make sure we go direct with invalid PAC
+  // eslint-disable-next-line no-useless-concat
   var pac = "data:text/plain," + "\nfor(;\n";
 
   var channel = NetUtil.newChannel({
     uri: "http://www.mozilla.org/",
     loadUsingSystemPrincipal: true,
   });
   prefs.setIntPref("network.proxy.type", 2);
   prefs.setCharPref("network.proxy.autoconfig_url", pac);