Bug 1207499 - Part 10: Remove use of expression closure from testing/. r=jmaher
authorTooru Fujisawa <arai_a@mac.com>
Wed, 23 Sep 2015 18:42:19 +0900
changeset 265382 679b74f654b00f0e028cf0356776561166a1d69f
parent 265381 d5b11364d743f976061a9d22c15826477e53baae
child 265383 56d7babc614789c15a3349af2f78b01e44dcafb5
push id29462
push usercbook@mozilla.com
push dateThu, 01 Oct 2015 10:39:47 +0000
treeherdermozilla-central@2c1fb007137d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
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 10: Remove use of expression closure from testing/. r=jmaher
testing/mochitest/browser-harness.xul
testing/mochitest/browser-test.js
testing/modules/AppInfo.jsm
testing/specialpowers/content/specialpowersAPI.js
testing/xpcshell/head.js
--- a/testing/mochitest/browser-harness.xul
+++ b/testing/mochitest/browser-harness.xul
@@ -119,23 +119,23 @@
       this.results = [];
       this.scope = null;
       this.duration = 0;
       this.unexpectedTimeouts = 0;
       this.lastOutputTime = 0;
     }
     browserTest.prototype = {
       get passCount() {
-        return this.results.filter(function (t) !t.info && !t.todo && t.pass).length;
+        return this.results.filter(t => !t.info && !t.todo && t.pass).length;
       },
       get todoCount() {
-        return this.results.filter(function (t) !t.info && t.todo && t.pass).length;
+        return this.results.filter(t => !t.info && t.todo && t.pass).length;
       },
       get failCount() {
-        return this.results.filter(function (t) !t.info && !t.pass).length;
+        return this.results.filter(t => !t.info && !t.pass).length;
       },
 
       addResult: function addResult(result) {
         this.lastOutputTime = Date.now();
         this.results.push(result);
 
         if (result.info) {
           if (result.msg) {
@@ -284,19 +284,19 @@
 
     function getHTMLLogFromTests(aTests) {
       if (!aTests.length)
         return "<div id=\"summary\" class=\"failure\">No tests to run." +
                  " Did you pass an invalid --test-path?</div>";
 
       var log = "";
 
-      var passCount = aTests.map(function (f) f.passCount).reduce(sum);
-      var failCount = aTests.map(function (f) f.failCount).reduce(sum);
-      var todoCount = aTests.map(function (f) f.todoCount).reduce(sum);
+      var passCount = aTests.map(f => f.passCount).reduce(sum);
+      var failCount = aTests.map(f => f.failCount).reduce(sum);
+      var todoCount = aTests.map(f => f.todoCount).reduce(sum);
       log += "<div id=\"summary\" class=\"";
       log += failCount != 0 ? "failure" :
                passCount == 0 ? "todo" : "success";
       log += "\">\n<p>Passed: " + passCount + "</p>\n" +
              "<p>Failed: " + failCount;
       if (failCount > 0)
         log += " <a href=\"javascript:scrollTo('ERROR0')\">NEXT ERROR</a>";
       log += "</p>\n" +
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -323,19 +323,19 @@ Tester.prototype = {
 
     // Make sure the window is raised before each test.
     this.SimpleTest.waitForFocus(aCallback);
   },
 
   finish: function Tester_finish(aSkipSummary) {
     this.Promise.Debugging.flushUncaughtErrors();
 
-    var passCount = this.tests.reduce(function(a, f) a + f.passCount, 0);
-    var failCount = this.tests.reduce(function(a, f) a + f.failCount, 0);
-    var todoCount = this.tests.reduce(function(a, f) a + f.todoCount, 0);
+    var passCount = this.tests.reduce((a, f) => a + f.passCount, 0);
+    var failCount = this.tests.reduce((a, f) => a + f.failCount, 0);
+    var todoCount = this.tests.reduce((a, f) => a + f.todoCount, 0);
 
     if (this.repeat > 0) {
       --this.repeat;
       this.currentTestIndex = -1;
       this.nextTest();
     }
     else{
       TabDestroyObserver.destroy();
--- a/testing/modules/AppInfo.jsm
+++ b/testing/modules/AppInfo.jsm
@@ -25,17 +25,19 @@ var APP_INFO = {
   inSafeMode: false,
   logConsoleErrors: true,
   OS: "XPCShell",
   XPCOMABI: "noarch-spidermonkey",
 
   invalidateCachesOnRestart() {},
 
   // nsIWinAppHelper
-  get userCanElevate() false,
+  get userCanElevate() {
+    return false;
+  },
 
   QueryInterface(iid) {
     let interfaces = [ Ci.nsIXULAppInfo, Ci.nsIXULRuntime ];
     if ("nsIWinAppHelper" in Ci)
       interfaces.push(Ci.nsIWinAppHelper);
     if (!interfaces.some(v => iid.equals(v)))
       throw Cr.NS_ERROR_NO_INTERFACE;
     return this;
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -602,17 +602,17 @@ SpecialPowersAPI.prototype = {
     let assert = json => {
       // An assertion has been done in a mochitest chrome script
       let {url, err, message, stack} = json;
 
       // Try to fetch a test runner from the mochitest
       // in order to properly log these assertions and notify
       // all usefull log observers
       let window = this.window.get();
-      let parentRunner, repr = function (o) o;
+      let parentRunner, repr = o => o;
       if (window) {
         window = window.wrappedJSObject;
         parentRunner = window.TestRunner;
         if (window.repr) {
           repr = window.repr;
         }
       }
 
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -229,17 +229,19 @@ function _do_quit() {
  */
 var _fakeIdleService = {
   get registrar() {
     delete this.registrar;
     return this.registrar =
       Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
   },
   contractID: "@mozilla.org/widget/idleservice;1",
-  get CID() this.registrar.contractIDToCID(this.contractID),
+  get CID() {
+    return this.registrar.contractIDToCID(this.contractID);
+  },
 
   activate: function FIS_activate()
   {
     if (!this.originalFactory) {
       // Save original factory.
       this.originalFactory =
         Components.manager.getClassObject(Components.classes[this.contractID],
                                           Components.interfaces.nsIFactory);
@@ -281,17 +283,19 @@ var _fakeIdleService = {
           aIID.equals(Components.interfaces.nsISupports)) {
         return this;
       }
       throw Components.results.NS_ERROR_NO_INTERFACE;
     }
   },
 
   // nsIIdleService
-  get idleTime() 0,
+  get idleTime() {
+    return 0;
+  },
   addIdleObserver: function () {},
   removeIdleObserver: function () {},
 
   QueryInterface: function(aIID) {
     // Useful for testing purposes, see test_get_idle.js.
     if (aIID.equals(Components.interfaces.nsIFactory)) {
       return this.factory;
     }