Bug 1257246: Update toolkit for eslint 2. r?Gijs draft
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 05 Apr 2016 11:33:48 -0700
changeset 348977 062abafff0d957909ce94f8921af6fefa1912ab9
parent 348976 7351159479d51bbbc884024e4c12e3fcb14aa6c4
child 348978 e1ffa0d658fc93583f4b75c303eb767c76b29952
push id14979
push userdtownsend@mozilla.com
push dateFri, 08 Apr 2016 17:33:22 +0000
reviewersGijs
bugs1257246
milestone48.0a1
Bug 1257246: Update toolkit for eslint 2. r?Gijs Most of this is fixing functions that in some cases return a value but then can also run to completion without returning anything. ESLint 2 catches this where previous versions didn't. Unless there was an obvious other choice I just made these functions return undefined at the end which is effectively what already happens. MozReview-Commit-ID: KHYdAkRvhVr
toolkit/components/aboutmemory/content/aboutMemory.js
toolkit/components/addoncompat/RemoteAddonsParent.jsm
toolkit/components/asyncshutdown/AsyncShutdown.jsm
toolkit/components/ctypes/tests/unit/head.js
toolkit/components/microformats/Microformats.js
toolkit/components/microformats/microformat-shiv.js
toolkit/components/narrate/.eslintrc
toolkit/components/passwordmgr/LoginManagerParent.jsm
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
toolkit/components/perfmonitoring/PerformanceStats.jsm
toolkit/components/places/PlacesBackups.jsm
toolkit/components/places/tests/queries/test_async.js
toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
toolkit/components/places/tests/queries/test_redirects.js
toolkit/components/printing/content/printUtils.js
toolkit/components/reader/ReaderMode.jsm
toolkit/components/satchel/AutoCompleteE10S.jsm
toolkit/components/satchel/test/unit/test_history_api.js
toolkit/components/telemetry/TelemetryController.jsm
toolkit/components/telemetry/TelemetrySession.jsm
toolkit/components/telemetry/TelemetryStorage.jsm
toolkit/components/viewsource/content/viewSource.js
toolkit/content/browser-content.js
toolkit/content/tests/browser/browser_findbar.js
toolkit/content/tests/browser/head.js
toolkit/content/widgets/browser.xml
toolkit/content/widgets/findbar.xml
toolkit/content/widgets/remote-browser.xml
toolkit/identity/IdentityProvider.jsm
toolkit/modules/BrowserUtils.jsm
toolkit/modules/Finder.jsm
toolkit/modules/Log.jsm
toolkit/modules/tests/browser/browser_WebRequest.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -1161,17 +1161,17 @@ TreeNode.prototype = {
 
   toString: function() {
     switch (this._units) {
       case UNITS_BYTES:            return formatBytes(this._amount);
       case UNITS_COUNT:
       case UNITS_COUNT_CUMULATIVE: return formatInt(this._amount);
       case UNITS_PERCENTAGE:       return formatPercentage(this._amount);
       default:
-        assertInput(false, "bad units in TreeNode.toString");
+        throw "Invalid memory report(s): bad units in TreeNode.toString";
     }
   }
 };
 
 // Sort TreeNodes first by size, then by name.  The latter is important for the
 // about:memory tests, which need a predictable ordering of reporters which
 // have the same amount.
 TreeNode.compareAmounts = function(aA, aB) {
--- a/toolkit/components/addoncompat/RemoteAddonsParent.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsParent.jsm
@@ -81,16 +81,17 @@ var NotificationTracker = {
                .getService(Ci.nsIMessageBroadcaster);
     ppmm.broadcastAsyncMessage("Addons:ChangeNotification", {path: path, count: tracked._count});
   },
 
   receiveMessage: function(msg) {
     if (msg.name == "Addons:GetNotifications") {
       return this._paths;
     }
+    return undefined;
   }
 };
 NotificationTracker.init();
 
 // An interposition is an object with three properties: methods,
 // getters, and setters. See multiprocessShims.js for an explanation
 // of how these are used. The constructor here just allows one
 // interposition to inherit members from another.
@@ -131,16 +132,17 @@ var ContentPolicyParent = {
   },
 
   receiveMessage: function (aMessage) {
     switch (aMessage.name) {
       case "Addons:ContentPolicy:Run":
         return this.shouldLoad(aMessage.data, aMessage.objects);
         break;
     }
+    return undefined;
   },
 
   shouldLoad: function(aData, aObjects) {
     for (let policyCID of this._policies.values()) {
       let policy;
       try {
         policy = Cc[policyCID].getService(Ci.nsIContentPolicy);
       } catch (e) {
@@ -228,26 +230,28 @@ var AboutProtocolParent = {
   receiveMessage: function (msg) {
     switch (msg.name) {
       case "Addons:AboutProtocol:GetURIFlags":
         return this.getURIFlags(msg);
       case "Addons:AboutProtocol:OpenChannel":
         return this.openChannel(msg);
         break;
     }
+    return undefined;
   },
 
   getURIFlags: function(msg) {
     let uri = BrowserUtils.makeURI(msg.data.uri);
     let contractID = msg.data.contractID;
     let module = Cc[contractID].getService(Ci.nsIAboutModule);
     try {
       return module.getURIFlags(uri);
     } catch (e) {
       Cu.reportError(e);
+      return undefined;
     }
   },
 
   // We immediately read all the data out of the channel here and
   // return it to the child.
   openChannel: function(msg) {
     function wrapGetInterface(cpow) {
       return {
@@ -276,16 +280,17 @@ var AboutProtocolParent = {
       let stream = channel.open2();
       let data = NetUtil.readInputStreamToString(stream, stream.available(), {});
       return {
         data: data,
         contentType: channel.contentType
       };
     } catch (e) {
       Cu.reportError(e);
+      return undefined;
     }
   },
 };
 AboutProtocolParent.init();
 
 var ComponentRegistrarInterposition = new Interposition("ComponentRegistrarInterposition");
 
 ComponentRegistrarInterposition.methods.registerFactory =
--- a/toolkit/components/asyncshutdown/AsyncShutdown.jsm
+++ b/toolkit/components/asyncshutdown/AsyncShutdown.jsm
@@ -214,24 +214,24 @@ try {
   // Ignore errors
 }
 Services.prefs.addObserver(PREF_DEBUG_LOG, function() {
   DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
 }, false);
 
 function debug(msg, error=null) {
   if (DEBUG_LOG) {
-    return log(msg, "DEBUG: ", error);
+    log(msg, "DEBUG: ", error);
   }
 }
 function warn(msg, error = null) {
-  return log(msg, "WARNING: ", error);
+  log(msg, "WARNING: ", error);
 }
 function fatalerr(msg, error = null) {
-  return log(msg, "FATAL ERROR: ", error);
+  log(msg, "FATAL ERROR: ", error);
 }
 
 // Utility function designed to get the current state of execution
 // of a blocker.
 // We are a little paranoid here to ensure that in case of evaluation
 // error we do not block the AsyncShutdown.
 function safeGetState(fetchState) {
   if (!fetchState) {
--- a/toolkit/components/ctypes/tests/unit/head.js
+++ b/toolkit/components/ctypes/tests/unit/head.js
@@ -69,17 +69,18 @@ function structural_check_eq(a, b) {
   let asource, bsource;
   try {
     asource = a.toSource();
     bsource = b.toSource();
     finished = true;
   } catch (x) {
   }
   if (finished) {
-    return do_check_eq(asource, bsource);
+    do_check_eq(asource, bsource);
+    return;
   }
 
   // 2. Otherwise, perform slower comparison
 
   try {
     structural_check_eq_aux(a, b);
     result = true;
   } catch (x) {
--- a/toolkit/components/microformats/Microformats.js
+++ b/toolkit/components/microformats/Microformats.js
@@ -396,32 +396,34 @@ this.Microformats = {
         /* (we'll do it later) */
         if (!Microformats.matchClass(propnode, "value")) {
           s = collapseWhitespace(s);
         }
         if (s.length > 0) {
           return s;
         }
       }
+      return undefined;
     },
     /**
      * Used to specifically retrieve a date in a microformat node.
      * After getting the default text, it normalizes it to an ISO8601 date.
      *
      * @param  propnode   The DOMNode to check
      * @param  parentnode The parent node of the property. If it is a subproperty,
      *                    this is the parent property node. If it is not, this is the
      *                    microformat node.
      * @return A string with the normalized date.
      */
     dateTimeGetter: function(propnode, parentnode) {
       var date = Microformats.parser.textGetter(propnode, parentnode);
       if (date) {
         return Microformats.parser.normalizeISO8601(date);
       }
+      return undefined;
     },
     /**
      * Used to specifically retrieve a URI in a microformat node. This includes
      * looking at an href/img/object/area to get the fully qualified URI.
      *
      * @param  propnode   The DOMNode to check
      * @param  parentnode The parent node of the property. If it is a subproperty,
      *                    this is the parent property node. If it is not, this is the
@@ -904,16 +906,17 @@ this.Microformats = {
             error += "Required property " + Microformats[mfname].required[i] + " not specified\n";
           }
         }
         if (error.length > 0) {
           throw(error);
         }
         return true;
       }
+      return undefined;
     },
     /* This function normalizes an ISO8601 date by adding punctuation and */
     /* ensuring that hours and seconds have values */
     normalizeISO8601: function normalizeISO8601(string)
     {
       var dateArray = string.match(/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(?:([-+Z])(?:(\d\d)(?::?(\d\d))?)?)?)?)?)?/);
 
       var dateString;
@@ -1376,16 +1379,17 @@ var hCard_definition = {
               family_name[0] = fns[0];
             } else {
               given_name[0] = fns[0];
               family_name[0] = fns[1];
             }
             return {"given-name" : given_name, "family-name" : family_name};
           }
         }
+        return undefined;
       }
     },
     "nickname" : {
       plural: true,
       virtual: true,
       /* Implied "nickname" Optimization */
       /* http://microformats.org/wiki/hcard#Implied_.22nickname.22_Optimization */
       virtualGetter: function(mfnode) {
@@ -1632,16 +1636,17 @@ var hCalendar_definition = {
         var value = Microformats.parser.textGetter(mfnode);
         var rrule;
         rrule = value.split(';');
         for (let i=0; i < rrule.length; i++) {
           if (rrule[i].match(property)) {
             return rrule[i].split('=')[1];
           }
         }
+        return undefined;
       }
     }
   }
 };
 
 Microformats.add("hCalendar", hCalendar_definition);
 
 this.geo = function geo(node, validate) {
@@ -1690,16 +1695,17 @@ geo.prototype.toString = function() {
       }
     }
     if (s) {
       return s;
     } else {
       return this.latitude + ", " + this.longitude;
     }
   }
+  return undefined;
 }
 
 var geo_definition = {
   mfObject: geo,
   className: "geo",
   required: ["latitude","longitude"],
   properties: {
     "latitude" : {
@@ -1712,16 +1718,17 @@ var geo_definition = {
         if (value.match(';')) {
           latlong = value.split(';');
           if (latlong[0]) {
             if (!isNaN(latlong[0])) {
               return parseFloat(latlong[0]);
             }
           }
         }
+        return undefined;
       }
     },
     "longitude" : {
       datatype: "float",
       virtual: true,
       /* This will only be called in the virtual case */
       virtualGetter: function(mfnode) {
         var value = Microformats.parser.textGetter(mfnode);
@@ -1729,16 +1736,17 @@ var geo_definition = {
         if (value.match(';')) {
           latlong = value.split(';');
           if (latlong[1]) {
             if (!isNaN(latlong[1])) {
               return parseFloat(latlong[1]);
             }
           }
         }
+        return undefined;
       }
     }
   },
   validate: function(node) {
     var latitude = Microformats.parser.getMicroformatProperty(node, "geo", "latitude");
     var longitude = Microformats.parser.getMicroformatProperty(node, "geo", "longitude");
     if (latitude != undefined) {
       if (!isFinite(latitude) || (latitude > 360) || (latitude < -360)) {
--- a/toolkit/components/microformats/microformat-shiv.js
+++ b/toolkit/components/microformats/microformat-shiv.js
@@ -1062,16 +1062,17 @@ var Microformats; // jshint ignore:line
                     return modules.text.parseText( this.document, out.join(' '), this.options.textFormat);
                 }
                 if(propertyType === 'u') {
                     return out.join('');
                 }
                 if(propertyType === 'dt') {
                     return modules.dates.concatFragments(out,this.options.dateFormat).toString(this.options.dateFormat);
                 }
+                return undefined;
             } else {
                 return null;
             }
         },
 
 
         /**
          * returns a single string of the 'title' attr from all
--- a/toolkit/components/narrate/.eslintrc
+++ b/toolkit/components/narrate/.eslintrc
@@ -27,16 +27,17 @@
     "consistent-return": 2,
     "curly": 2,
     "dot-location": [1, "property"],
     "dot-notation": 2,
     "eol-last": 2,
     "generator-star-spacing": [1, "after"],
     "indent": [1, 2, {"SwitchCase": 1}],
     "key-spacing": [1, {"beforeColon": false, "afterColon": true}],
+    "keyword-spacing": 1,
     "max-len": [1, 80, 2, {"ignoreUrls": true}],
     "max-nested-callbacks": [2, 3],
     "new-cap": [2, {"capIsNew": false}],
     "new-parens": 2,
     "no-array-constructor": 2,
     "no-cond-assign": 2,
     "no-control-regex": 2,
     "no-debugger": 2,
@@ -72,22 +73,20 @@
     "no-unneeded-ternary": 2,
     "no-unreachable": 2,
     "no-unused-vars": 2,
     "no-with": 2,
     "padded-blocks": [1, "never"],
     "quotes": [1, "double", "avoid-escape"],
     "semi": [1, "always"],
     "semi-spacing": [1, {"before": false, "after": true}],
-    "space-after-keywords": [1, "always"],
     "space-before-blocks": [1, "always"],
     "space-before-function-paren": [1, "never"],
     "space-in-parens": [1, "never"],
     "space-infix-ops": [1, {"int32Hint": true}],
-    "space-return-throw-case": 1,
     "space-unary-ops": [1, { "words": true, "nonwords": false }],
     "spaced-comment": [1, "always"],
     "strict": [2, "global"],
     "use-isnan": 2,
     "valid-typeof": 2,
     "yoda": 2
   }
 }
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -94,16 +94,18 @@ var LoginManagerParent = {
         break;
       }
 
       case "RemoteLogins:autoCompleteLogins": {
         this.doAutocompleteSearch(data, msg.target);
         break;
       }
     }
+
+    return undefined;
   },
 
   /**
    * Trigger a login form fill and send relevant data (e.g. logins and recipes)
    * to the child process (LoginManagerContent).
    */
   fillForm: Task.async(function* ({ browser, loginFormOrigin, login, inputElement }) {
     let recipes = [];
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -265,16 +265,17 @@ function getColumnByName(column) {
       return document.getElementById("timeCreatedCol");
     case "timeLastUsed":
       return document.getElementById("timeLastUsedCol");
     case "timePasswordChanged":
       return document.getElementById("timePasswordChangedCol");
     case "timesUsed":
       return document.getElementById("timesUsedCol");
   }
+  return undefined;
 }
 
 var lastSignonSortColumn = "hostname";
 var lastSignonSortAscending = true;
 
 function SignonColumnSort(column) {
   // clear out the sortDirection attribute on the old column
   var lastSortedCol = getColumnByName(lastSignonSortColumn);
--- a/toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
@@ -272,16 +272,18 @@ function* runTest() {
       ok(false, "Test " + save + " should not show a popup");
     };
     addPopupListener("popupshown", unexpectedPopup, false);
 
     hitEventLoop(function() {
       removePopupListener("popupshown", unexpectedPopup, false);
       tester.next();
     }, 100);
+
+    return undefined;
   }
 
   // We use this function when we're trying to prove that something doesn't
   // happen, but where if it did it would do so asynchronously. It isn't
   // perfect, but it's better than nothing.
   function spinEventLoop() {
     setTimeout(function() { tester.next(); }, 0);
   }
--- a/toolkit/components/perfmonitoring/PerformanceStats.jsm
+++ b/toolkit/components/perfmonitoring/PerformanceStats.jsm
@@ -645,16 +645,17 @@ PerformanceDataLeaf.prototype = {
       throw new TypeError();
     }
     for (let probeName of Object.keys(Probes)) {
       let probe = Probes[probeName];
       if (!probe.isEqual(this[probeName], to[probeName])) {
         return false;
       }
     }
+    return true;
   },
 
   /**
    * Compute the delta between two instances of `PerformanceData`.
    *
    * @param {PerformanceData|null} to. If `null`, assumed an instance of
    * `PerformanceData` in which all numeric values are 0.
    *
--- a/toolkit/components/places/PlacesBackups.jsm
+++ b/toolkit/components/places/PlacesBackups.jsm
@@ -204,16 +204,18 @@ this.PlacesBackups = {
           // Remove bogus backups in future dates.
           let filePath = aEntry.path;
           if (this.getDateForFile(filePath) > new Date()) {
             return OS.File.remove(filePath);
           } else {
             this._backupFiles.push(filePath);
           }
         }
+
+        return undefined;
       }.bind(this));
       iterator.close();
 
       this._backupFiles.sort((a, b) => {
         let aDate = this.getDateForFile(a);
         let bDate = this.getDateForFile(b);
         return bDate - aDate;
       });
--- a/toolkit/components/places/tests/queries/test_async.js
+++ b/toolkit/components/places/tests/queries/test_async.js
@@ -320,16 +320,17 @@ var DataHelper = {
           isFolder: true,
           parentGuid: dat.parentGuid,
           index: PlacesUtils.bookmarks.DEFAULT_INDEX,
           title: dat.title,
           isInQuery: true
         };
       default:
         do_throw("Unknown data type when populating DB: " + type);
+        return undefined;
       }
     });
   },
 
   /**
    * Returns a copy of aData, except that any properties that are undefined but
    * defined in aDefaults are set to the corresponding values in aDefaults.
    *
--- a/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
+++ b/toolkit/components/places/tests/queries/test_history_queries_titles_liveUpdate.js
@@ -30,16 +30,17 @@ var gTestData = [
 ];
 
 function searchNodeHavingUrl(aRoot, aUrl) {
   for (let i = 0; i < aRoot.childCount; i++) {
     if (aRoot.getChild(i).uri == aUrl) {
       return aRoot.getChild(i);
     }
   }
+  return undefined;
 }
 
 function newQueryWithOptions()
 {
   return [ PlacesUtils.history.getNewQuery(),
            PlacesUtils.history.getNewQueryOptions() ];
 }
 
--- a/toolkit/components/places/tests/queries/test_redirects.js
+++ b/toolkit/components/places/tests/queries/test_redirects.js
@@ -58,16 +58,17 @@ function check_results_callback(aSequenc
   });
 
   // Sort expectedData.
   function getFirstIndexFor(aEntry) {
     for (let i = 0; i < visits.length; i++) {
       if (visits[i].uri == aEntry.uri)
         return i;
     }
+    return undefined;
   }
   function comparator(a, b) {
     if (sortingMode == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)
       return b.lastVisit - a.lastVisit;
     else if (sortingMode == Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING)
       return b.visitCount - a.visitCount;
     else
       return getFirstIndexFor(a) - getFirstIndexFor(b);
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -149,16 +149,17 @@ var PrintUtils = {
                         .outerWindowID;
 
     let Deprecated = Components.utils.import("resource://gre/modules/Deprecated.jsm", {}).Deprecated;
     let msg = "PrintUtils.print is now deprecated. Please use PrintUtils.printWindow.";
     let url = "https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Printing";
     Deprecated.warning(msg, url);
 
     this.printWindow(windowID, browser);
+    return undefined;
   },
 
   /**
    * Initializes print preview.
    *
    * @param aListenerObj
    *        An object that defines the following functions:
    *
@@ -415,16 +416,17 @@ var PrintUtils = {
         }
 
         return listener.onStateChange(null, null,
                                       data.stateFlags,
                                       data.status);
         break;
       }
     }
+    return undefined;
   },
 
   setPrinterDefaultsForSelectedPrinter: function (aPSSVC, aPrintSettings)
   {
     if (!aPrintSettings.printerName)
       aPrintSettings.printerName = aPSSVC.defaultPrinterName;
 
     // First get any defaults from the printer
--- a/toolkit/components/reader/ReaderMode.jsm
+++ b/toolkit/components/reader/ReaderMode.jsm
@@ -440,11 +440,12 @@ this.ReaderMode = {
    * @rejects OS.File.Error
    */
   _ensureCacheDir: function () {
     let dir = OS.Path.join(OS.Constants.Path.profileDir, "readercache");
     return OS.File.exists(dir).then(exists => {
       if (!exists) {
         return OS.File.makeDir(dir);
       }
+      return undefined;
     });
   }
 };
--- a/toolkit/components/satchel/AutoCompleteE10S.jsm
+++ b/toolkit/components/satchel/AutoCompleteE10S.jsm
@@ -251,16 +251,17 @@ this.AutoCompleteE10S = {
       case "FormAutoComplete:Disconnect":
         // The controller stopped controlling the current input, so clear
         // any cached data.  This is necessary cause otherwise we'd clear data
         // only when starting a new search, but the next input could not support
         // autocomplete and it would end up inheriting the existing data.
         AutoCompleteE10SView.clearResults();
         break;
     }
+    return undefined;
   },
 
   handleEnter: function(aIsPopupSelection) {
     this.browser.messageManager.sendAsyncMessage(
       "FormAutoComplete:HandleEnter",
       { selectedIndex: this.popup.selectedIndex,
         isPopupSelection: aIsPopupSelection }
     );
--- a/toolkit/components/satchel/test/unit/test_history_api.js
+++ b/toolkit/components/satchel/test/unit/test_history_api.js
@@ -260,16 +260,17 @@ add_task(function* ()
 
   let processFirstResult = function processResults(results)
   {
     // Only handle the first result
     if (results.length > 0) {
       let result = results[0];
       return [result.timesUsed, result.firstUsed, result.lastUsed, result.guid];
     }
+    return undefined;
   }
 
   results = yield promiseSearchEntries(["timesUsed", "firstUsed", "lastUsed"],
                                        { fieldname: "field1", value: "value1" });
   let [timesUsed, firstUsed, lastUsed] = processFirstResult(results);
   do_check_eq(1, timesUsed);
   do_check_true(firstUsed > 0);
   do_check_true(lastUsed > 0);
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -790,16 +790,17 @@ var Impl = {
     case "profile-after-change":
       // profile-after-change is only registered for chrome processes.
       return this.setupTelemetry();
     case "app-startup":
       // app-startup is only registered for content processes.
       return this.setupContentTelemetry();
       break;
     }
+    return undefined;
   },
 
   get clientID() {
     return this._clientID;
   },
 
   /**
    * Get an object describing the current state of this module for AsyncShutdown diagnostics.
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -406,16 +406,17 @@ var TelemetryScheduler = {
         return this._onSchedulerTick();
         break;
       case "active":
         // User is back to work, restore the original tick interval.
         this._isUserIdle = false;
         return this._onSchedulerTick();
         break;
     }
+    return undefined;
   },
 
   /**
    * Performs a scheduler tick. This function manages Telemetry recurring operations.
    * @return {Promise} A promise, only used when testing, resolved when the scheduled
    *                   operation completes.
    */
   _onSchedulerTick: function() {
@@ -1879,16 +1880,17 @@ var Impl = {
       let options = {
         addClientId: true,
         addEnvironment: true,
         overwrite: true,
       };
       TelemetryController.addPendingPing(getPingType(payload), payload, options);
       break;
     }
+    return undefined;
   },
 
   /**
    * This tells TelemetrySession to uninitialize and save any pending pings.
    * @param testing Optional. If true, always saves the ping whether Telemetry
    *                can send pings or not, which is used for testing.
    */
   shutdownChromeProcess: function(testing = false) {
--- a/toolkit/components/telemetry/TelemetryStorage.jsm
+++ b/toolkit/components/telemetry/TelemetryStorage.jsm
@@ -660,16 +660,17 @@ var TelemetryStorageImpl = {
     yield this.savePingToFile(ping, filePath, /*overwrite*/ true, /*compressed*/ true);
 
     this._archivedPings.set(ping.id, {
       timestampCreated: creationDate.getTime(),
       type: ping.type,
     });
 
     Telemetry.getHistogramById("TELEMETRY_ARCHIVE_SESSION_PING_COUNT").add();
+    return undefined;
   }),
 
   /**
    * Load an archived ping from disk.
    *
    * @param {string} id The pings id.
    * @return {promise<object>} Promise that is resolved with the ping data.
    */
@@ -1021,16 +1022,17 @@ var TelemetryStorageImpl = {
 
     // Since there's no quota enforcing task running, start it.
     try {
       this._enforcePendingPingsQuotaTask = this._enforcePendingPingsQuota();
       yield this._enforcePendingPingsQuotaTask;
     } finally {
       this._enforcePendingPingsQuotaTask = null;
     }
+    return undefined;
   }),
 
   /**
    * Enforce a disk quota for the pending pings.
    * @return {Promise} Resolved when the quota check is complete.
    */
   _enforcePendingPingsQuota: Task.async(function*() {
     this._log.trace("_enforcePendingPingsQuota");
@@ -1397,16 +1399,17 @@ var TelemetryStorageImpl = {
 
     // Start the task to remove all pending pings. Also make sure to clear the task once done.
     try {
       this._removePendingPingsTask = this.removePendingPings();
       yield this._removePendingPingsTask;
     } finally {
       this._removePendingPingsTask = null;
     }
+    return undefined;
   }),
 
   removePendingPings: Task.async(function*() {
     this._log.trace("removePendingPings - removing all pending pings");
 
     // Wait on pending pings still being saved, so so we don't miss removing them.
     yield this.promisePendingPingSaves();
 
--- a/toolkit/components/viewsource/content/viewSource.js
+++ b/toolkit/components/viewsource/content/viewSource.js
@@ -312,16 +312,18 @@ ViewSourceChrome.prototype = {
     // We're using the modern API, which allows us to view the
     // source of documents from out of process browsers.
     let args = window.arguments[0];
 
     // viewPartialSource.js will take care of loading the content in partial mode.
     if (!args.partial) {
       this.loadViewSource(args);
     }
+
+    return undefined;
   },
 
   /**
    * This is the deprecated API for viewSource.xul, for old-timer consumers.
    * This API might eventually go away.
    */
   _loadViewSourceDeprecated(aArguments) {
     Deprecated.warning("The arguments you're passing to viewSource.xul " +
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -289,16 +289,17 @@ var PopupBlocking = {
     switch (ev.type) {
       case "DOMPopupBlocked":
         return this.onPopupBlocked(ev);
       case "pageshow":
         return this.onPageShow(ev);
       case "pagehide":
         return this.onPageHide(ev);
     }
+    return undefined;
   },
 
   onPopupBlocked: function(ev) {
     if (!this.popupData) {
       this.popupData = new Array();
       this.popupDataInternal = new Array();
     }
 
@@ -654,16 +655,17 @@ var FindBar = {
     let rv = sendSyncMessage("Findbar:Keypress", {
       fakeEvent: fakeEvent,
       shouldFastFind: fastFind.should
     });
     if (rv.indexOf(false) !== -1) {
       event.preventDefault();
       return false;
     }
+    return undefined;
   },
 
   _onMouseup(event) {
     if (this._findMode != this.FIND_NORMAL)
       sendAsyncMessage("Findbar:Mouseup");
   },
 };
 FindBar.init();
--- a/toolkit/content/tests/browser/browser_findbar.js
+++ b/toolkit/content/tests/browser/browser_findbar.js
@@ -114,21 +114,21 @@ add_task(function* test_tabwise_case_sen
 
 /**
  * Navigating from a web page (for example mozilla.org) to an internal page
  * (like about:addons) might trigger a change of browser's remoteness.
  * 'Remoteness change' means that rendering page content moves from child
  * process into the parent process or the other way around.
  * This test ensures that findbar properly handles such a change.
  */
-add_task(function * test_reinitialization_at_remoteness_change() {
+add_task(function* test_reinitialization_at_remoteness_change() {
   // This test only makes sence in e10s evironment.
   if (!gMultiProcessBrowser) {
     info("Skipping this test because of non-e10s environment.");
-    return true;
+    return;
   }
 
   info("Ensure findbar re-initialization at remoteness change.");
 
   // Load a remote page and trigger findbar construction.
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI);
   let browser = gBrowser.getBrowserForTab(tab);
   let findbar = gBrowser.getFindBar();
@@ -161,17 +161,17 @@ add_task(function * test_reinitializatio
 /**
  * Ensure that the initial typed characters aren't lost immediately after
  * opening the find bar.
  */
 add_task(function* () {
   // This test only makes sence in e10s evironment.
   if (!gMultiProcessBrowser) {
     info("Skipping this test because of non-e10s environment.");
-    return true;
+    return;
   }
 
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI);
   let browser = tab.linkedBrowser;
 
   ok(!gFindBarInitialized, "findbar isn't initialized yet");
 
   let findBar = gFindBar;
--- a/toolkit/content/tests/browser/head.js
+++ b/toolkit/content/tests/browser/head.js
@@ -6,18 +6,20 @@ XPCOMUtils.defineLazyModuleGetter(this, 
   "resource://gre/modules/Promise.jsm");
 
 /**
  * A wrapper for the findbar's method "close", which is not synchronous
  * because of animation.
  */
 function closeFindbarAndWait(findbar) {
   return new Promise((resolve) => {
-    if (findbar.hidden)
-      return resolve();
+    if (findbar.hidden) {
+      resolve();
+      return;
+    }
     findbar.addEventListener("transitionend", function cont(aEvent) {
       if (aEvent.propertyName != "visibility") {
         return;
       }
       findbar.removeEventListener("transitionend", cont);
       resolve();
     });
     findbar.close();
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -984,16 +984,17 @@
               break;
             case "AudioPlayback:Start":
               this.audioPlaybackStarted();
               break;
             case "AudioPlayback:Stop":
               this.audioPlaybackStopped();
               break;
           }
+          return undefined;
         ]]></body>
       </method>
 
       <method name="receiveMessage">
         <parameter name="aMessage"/>
         <body><![CDATA[
           return this._receiveMessage(aMessage);
         ]]></body>
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -786,16 +786,17 @@
 
             if (autostartFAYT)
               this._dispatchKeypressEvent(this._findField.inputField, aFakeEvent);
             else
               this._updateStatusUI(this.nsITypeAheadFind.FIND_FOUND);
 
             return false;
           }
+          return undefined;
         ]]></body>
       </method>
 
       <!-- See nsIMessageListener -->
       <method name="receiveMessage">
         <parameter name="aMessage"/>
         <body><![CDATA[
           if (aMessage.target != this._browser) {
@@ -806,16 +807,17 @@
               if (!this.hidden && this._findMode != this.FIND_NORMAL)
                 this.close();
               break;
 
             case "Findbar:Keypress":
               return this._onBrowserKeypress(aMessage.data.fakeEvent,
                                              aMessage.data.shouldFastFind);
           }
+          return undefined;
         ]]></body>
       </method>
 
       <method name="_updateBrowserWithState">
         <body><![CDATA[
           if (this._browser && this._browser.messageManager) {
             this._browser.messageManager.sendAsyncMessage("Findbar:UpdateState", {
               findMode: this._findMode
@@ -1105,16 +1107,17 @@
           this._findFailedString = null;
 
           // Ensure the stored SearchString is in sync with what we want to find
           if (this._findField.value != this._browser.finder.searchString)
             this._find(this._findField.value);
           else
             this._findAgain(aFindPrevious);
 
+          return undefined;
         ]]></body>
       </method>
 
 #ifdef XP_MACOSX
       <!--
         - Fetches the currently selected text and sets that as the text to search
         - next. This is a MacOS specific feature.
       -->
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -506,16 +506,17 @@
               this._manifestURI = aMessage.data.manifest;
               break;
 
             default:
               // Delegate to browser.xml.
               return this._receiveMessage(aMessage);
               break;
           }
+          return undefined;
         ]]></body>
       </method>
 
       <method name="enableDisableCommands">
         <parameter name="aAction"/>
         <parameter name="aEnabledLength"/>
         <parameter name="aEnabledCommands"/>
         <parameter name="aDisabledLength"/>
--- a/toolkit/identity/IdentityProvider.jsm
+++ b/toolkit/identity/IdentityProvider.jsm
@@ -75,16 +75,18 @@ IdentityProviderService.prototype = {
       return provFlow;
     }
 
     let err = "No provisioning flow found with id " + aProvId;
     log("ERROR:", err);
     if (typeof aErrBack === 'function') {
       aErrBack(err);
     }
+
+    return undefined;
   },
 
   shutdown: function RP_shutdown() {
     this.reset();
 
     if (this._sandboxConfigured) {
       // Tear down message manager listening on the hidden window
       Cu.import("resource://gre/modules/DOMIdentity.jsm");
--- a/toolkit/modules/BrowserUtils.jsm
+++ b/toolkit/modules/BrowserUtils.jsm
@@ -37,16 +37,17 @@ this.BrowserUtils = {
       return false;
     }
     //if already in safe mode restart in safe mode
     if (Services.appinfo.inSafeMode) {
       appStartup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
       return undefined;
     }
     appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
+    return undefined;
   },
 
   /**
    * urlSecurityCheck: JavaScript wrapper for checkLoadURIWithPrincipal
    * and checkLoadURIStrWithPrincipal.
    * If |aPrincipal| is not allowed to link to |aURL|, this function throws with
    * an error message.
    *
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -320,16 +320,17 @@ Finder.prototype = {
     }
 
     // The `_currentFound` and `_framesToCount` properties are only used for
     // internal bookkeeping between recursive calls.
     delete result._currentFound;
     delete result._framesToCount;
 
     this._notifyMatchesCount(result);
+    return undefined;
   },
 
   /**
    * Counts the number of matches for the searched word in the passed window's
    * content.
    * @param aWord
    *        the word to search for.
    * @param aMatchLimit
--- a/toolkit/modules/Log.jsm
+++ b/toolkit/modules/Log.jsm
@@ -345,17 +345,18 @@ Logger.prototype = {
    *          at the indicated level. If _message is included as a key, the
    *          value is used as the descriptive text for the message.
    */
   logStructured: function (action, params) {
     if (!action) {
       throw "An action is required when logging a structured message.";
     }
     if (!params) {
-      return this.log(this.level, undefined, {"action": action});
+      this.log(this.level, undefined, {"action": action});
+      return;
     }
     if (typeof(params) != "object") {
       throw "The params argument is required to be an object.";
     }
 
     let level = params._level;
     if (level) {
       let ulevel = level.toUpperCase();
@@ -570,16 +571,17 @@ BasicFormatter.prototype = {
         // There were no substitutions in the text, so format the entire params object
         let rest = this.parameterFormatter.format(message.params);
         if (rest !== null && rest != "{}") {
           textParts.push(rest);
         }
       }
       return textParts.join(': ');
     }
+    return undefined;
   },
 
   format: function BF_format(message) {
     return message.time + "\t" +
       message.loggerName + "\t" +
       message.levelDesc + "\t" +
       this.formatText(message);
   }
@@ -894,16 +896,17 @@ FileAppender.prototype = {
     if (this._file) {
       this._lastWritePromise = this._file.write(array);
     } else {
       this._lastWritePromise = this._getFile().then(_ => {
         this._fileReadyPromise = null;
         if (this._file) {
           return this._file.write(array);
         }
+        return undefined;
       });
     }
   },
 
   reset: function () {
     let fileClosePromise = this._file.close();
     return fileClosePromise.then(_ => {
       this._file = null;
@@ -937,16 +940,17 @@ BoundedFileAppender.prototype = {
         return FileAppender.prototype.doAppend.call(this, formatted);
       }
       this._removeFilePromise = this.reset();
     }
     this._removeFilePromise.then(_ => {
       this._removeFilePromise = null;
       this.doAppend(formatted);
     });
+    return undefined;
   },
 
   reset: function () {
     let fileClosePromise;
     if (this._fileReadyPromise) {
       // An attempt to open the file may still be in progress.
       fileClosePromise = this._fileReadyPromise.then(_ => {
         return this._file.close();
--- a/toolkit/modules/tests/browser/browser_WebRequest.js
+++ b/toolkit/modules/tests/browser/browser_WebRequest.js
@@ -46,16 +46,17 @@ function onBeforeRequest(details)
       let page1id = windowIDs.get(URL);
       ok(details.windowId != page1id, "sub-frame gets its own window ID");
       is(details.parentWindowId, page1id, "parent window id is correct");
     }
   }
   if (details.url.indexOf("_bad.") != -1) {
     return {cancel: true};
   }
+  return undefined;
 }
 
 var sendHeaders = [];
 
 function onBeforeSendHeaders(details)
 {
   info(`onBeforeSendHeaders ${details.url}`);
   if (details.url.startsWith(BASE)) {
@@ -65,16 +66,17 @@ function onBeforeSendHeaders(details)
     checkType(details);
 
     let id = windowIDs.get(details.url);
     is(id, details.windowId, "window ID same in onBeforeSendHeaders as onBeforeRequest");
   }
   if (details.url.indexOf("_redirect.") != -1) {
     return {redirectUrl: details.url.replace("_redirect.", "_good.")};
   }
+  return undefined;
 }
 
 var beforeRedirect = [];
 
 function onBeforeRedirect(details)
 {
   info(`onBeforeRedirect ${details.url} -> ${details.redirectUrl}`);
   checkType(details);