Bug 1207499 - Part 6: Remove use of expression closure from netwerk/. r=jduell
authorTooru Fujisawa <arai_a@mac.com>
Wed, 23 Sep 2015 18:42:18 +0900
changeset 265264 5e9d7516ce42571ec7242e2039ecc4c334bf307a
parent 265263 31b39f0a34c1723786315158e9b74be8da187205
child 265265 63b57083408fdb3dea78119526bf65cefbefc9f8
push id65891
push userarai_a@mac.com
push dateWed, 30 Sep 2015 16:36:04 +0000
treeherdermozilla-inbound@10194aec7255 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs1207499
milestone44.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 1207499 - Part 6: Remove use of expression closure from netwerk/. r=jduell
netwerk/test/browser/browser_NetUtil.js
netwerk/test/httpserver/test/test_registerdirectory.js
netwerk/test/unit/test_bug894586.js
--- a/netwerk/test/browser/browser_NetUtil.js
+++ b/netwerk/test/browser/browser_NetUtil.js
@@ -37,17 +37,17 @@ function test_asyncFetchBadCert() {
 
     // Now try again with a channel whose notificationCallbacks doesn't suprress errors
     let channel = NetUtil.newChannel({
       uri: "https://untrusted.example.com",
       loadUsingSystemPrincipal: true});
     channel.notificationCallbacks = {
       QueryInterface: XPCOMUtils.generateQI([Ci.nsIProgressEventSink,
                                              Ci.nsIInterfaceRequestor]),
-      getInterface: function (aIID) this.QueryInterface(aIID),
+      getInterface: function (aIID) { return this.QueryInterface(aIID); },
       onProgress: function () {},
       onStatus: function () {}
     };
     NetUtil.asyncFetch(channel, function (aInputStream, aStatusCode, aRequest) {
       ok(!Components.isSuccessCode(aStatusCode), "request failed");
       ok(aRequest instanceof Ci.nsIHttpChannel, "request is an nsIHttpChannel");
 
       // Now try a valid request
--- a/netwerk/test/httpserver/test/test_registerdirectory.js
+++ b/netwerk/test/httpserver/test/test_registerdirectory.js
@@ -40,17 +40,17 @@ function checkFile(ch, cx, status, data)
 {
   do_check_eq(ch.responseStatus, 200);
   do_check_true(ch.requestSucceeded);
 
   var actualFile = serverBasePath.clone();
   actualFile.append("test_registerdirectory.js");
   do_check_eq(ch.getResponseHeader("Content-Length"),
               actualFile.fileSize.toString());
-  do_check_eq(data.map(function(v) String.fromCharCode(v)).join(""),
+  do_check_eq(data.map(v => String.fromCharCode(v)).join(""),
               fileContents(actualFile));
 }
 
 XPCOMUtils.defineLazyGetter(this, "tests", function() {
   return [
 
 /***********************
  * without a base path *
--- a/netwerk/test/unit/test_bug894586.js
+++ b/netwerk/test/unit/test_bug894586.js
@@ -13,42 +13,65 @@ function ProtocolHandler() {
   this.uri = Cc["@mozilla.org/network/simple-uri;1"].
                createInstance(Ci.nsIURI);
   this.uri.spec = this.scheme + ":dummy";
   this.uri.QueryInterface(Ci.nsIMutable).mutable = false;
 }
 
 ProtocolHandler.prototype = {
   /** nsIProtocolHandler */
-  get scheme() "x-bug894586",
-  get defaultPort() -1,
-  get protocolFlags() Ci.nsIProtocolHandler.URI_NORELATIVE |
-                      Ci.nsIProtocolHandler.URI_NOAUTH |
-                      Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE |
-                      Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
-                      Ci.nsIProtocolHandler.URI_NON_PERSISTABLE |
-                      Ci.nsIProtocolHandler.URI_SYNC_LOAD_IS_OK,
-  newURI: function(aSpec, aOriginCharset, aBaseURI) this.uri,
+  get scheme() {
+    return "x-bug894586";
+  },
+  get defaultPort() {
+    return -1;
+  },
+  get protocolFlags() {
+    return Ci.nsIProtocolHandler.URI_NORELATIVE |
+           Ci.nsIProtocolHandler.URI_NOAUTH |
+           Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE |
+           Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
+           Ci.nsIProtocolHandler.URI_NON_PERSISTABLE |
+           Ci.nsIProtocolHandler.URI_SYNC_LOAD_IS_OK;
+  },
+  newURI: function(aSpec, aOriginCharset, aBaseURI) {
+    return this.uri;
+  },
   newChannel2: function(aURI, aLoadInfo) {
     this.loadInfo = aLoadInfo;
     return this;
   },
-  newChannel: function(aURI) this,
-  allowPort: function(port, scheme) port != -1,
+  newChannel: function(aURI) {
+    return this;
+  },
+  allowPort: function(port, scheme) {
+    return port != -1;
+  },
 
   /** nsIChannel */
-  get originalURI() this.uri,
-  get URI() this.uri,
+  get originalURI() {
+    return this.uri;
+  },
+  get URI() {
+    return this.uri;
+  },
   owner: null,
   notificationCallbacks: null,
-  get securityInfo() null,
-  get contentType() "text/css",
-  set contentType(val) void(0),
+  get securityInfo() {
+    return null;
+  },
+  get contentType() {
+    return "text/css";
+  },
+  set contentType(val) {
+  },
   contentCharset: "UTF-8",
-  get contentLength() -1,
+  get contentLength() {
+    return -1;
+  },
   set contentLength(val) {
     throw Components.Exception("Setting content length", NS_ERROR_NOT_IMPLEMENTED);
   },
   open: function() {
     var file = do_get_file("test_bug894586.js", false);
     do_check_true(file.exists());
     var url = Services.io.newFileURI(file);
     return Services.io.newChannelFromURI2(url,
@@ -77,19 +100,23 @@ ProtocolHandler.prototype = {
                                Cr.NS_ERROR_NOT_AVAILABLE);
   },
   get contentDispositionHeader() {
     throw Components.Exception("No header",
                                Cr.NS_ERROR_NOT_AVAILABLE);
   },
 
   /** nsIRequest */
-  get name() this.uri.spec,
-  isPending: function() false,
-  get status() Cr.NS_OK,
+  get name() {
+    return this.uri.spec;
+  },
+  isPending: () => false,
+  get status() {
+    return Cr.NS_OK;
+  },
   cancel: function(status) {},
   loadGroup: null,
   loadFlags: Ci.nsIRequest.LOAD_NORMAL |
              Ci.nsIRequest.INHIBIT_CACHING |
              Ci.nsIRequest.LOAD_BYPASS_CACHE,
 
   /** nsIFactory */
   createInstance: function(aOuter, aIID) {