Bug 1329017 - Enable the no-useless-return rule for eslint and use eslint --fix to autofix the errors. r=standard8 draft
authorJared Wein <jwein@mozilla.com>
Fri, 06 Jan 2017 12:09:28 -0500
changeset 457411 1df2b81badfe556928f6424c8990e4b3fde7056f
parent 457410 77eebb6c80cd5249b9a43bbcdefdaaa9d9845d1e
child 541452 bee51164934626e0fc8d3560e702a9531e46ff6d
push id40743
push userjwein@mozilla.com
push dateSat, 07 Jan 2017 21:35:53 +0000
reviewersstandard8
bugs1329017
milestone53.0a1
Bug 1329017 - Enable the no-useless-return rule for eslint and use eslint --fix to autofix the errors. r=standard8 MozReview-Commit-ID: 2MhpvzUDgtK
browser/base/content/abouthome/aboutHome.js
browser/base/content/browser-data-submission-info-bar.js
browser/base/content/test/general/browser_bookmark_popup.js
browser/base/content/test/general/browser_bug356571.js
browser/base/content/test/general/browser_contextmenu.js
browser/base/content/test/newtab/head.js
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js
browser/components/extensions/test/browser/browser_ext_tabs_sendMessage.js
browser/components/places/content/sidebarUtils.js
browser/components/places/tests/browser/browser_bookmarksProperties.js
browser/components/preferences/blocklists.js
browser/components/preferences/in-content/main.js
browser/components/search/test/browser_426329.js
browser/components/uitour/UITour.jsm
browser/extensions/pocket/content/pocket-content-process.js
browser/modules/ContentSearch.jsm
browser/modules/LaterRun.jsm
toolkit/.eslintrc.js
toolkit/components/contextualidentity/ContextualIdentityService.jsm
toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js
toolkit/components/passwordmgr/test/test_prompt_async.html
toolkit/components/perfmonitoring/tests/browser/head.js
toolkit/components/places/tests/history/test_remove.js
toolkit/components/satchel/test/test_form_autocomplete.html
toolkit/components/satchel/test/test_form_autocomplete_with_list.html
toolkit/components/viewsource/content/viewSourceUtils.js
toolkit/components/workerloader/tests/utils_mainthread.js
toolkit/components/workerloader/tests/worker_handler.js
toolkit/content/tests/widgets/popup_shared.js
toolkit/identity/Identity.jsm
toolkit/mozapps/extensions/LightweightThemeManager.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/nsBlocklistService.js
toolkit/mozapps/extensions/test/xpcshell/test_undothemeuninstall.js
toolkit/mozapps/preferences/changemp.js
toolkit/mozapps/update/nsUpdateService.js
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -287,17 +287,16 @@ function loadSnippets() {
       loadCompleted();
     };
     try {
       xhr.open("GET", updateURL, true);
       xhr.send(null);
     } catch (ex) {
       showSnippets();
       loadCompleted();
-      return;
     }
   } else {
     showSnippets();
     loadCompleted();
   }
 }
 
 /**
--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -99,17 +99,16 @@ var gDataNotificationInfoBar = {
   observe(subject, topic, data) {
     switch (topic) {
       case "datareporting:notify-data-policy:request":
         let request = subject.wrappedJSObject.object;
         try {
           this._displayDataPolicyInfoBar(request);
         } catch (ex) {
           request.onUserNotifyFailed(ex);
-          return;
         }
         break;
 
       case "datareporting:notify-data-policy:close":
         // If this observer fires, it means something else took care of
         // responding. Therefore, we don't need to do anything. So, we
         // act like we took action and clear state.
         this._actionTaken = true;
--- a/browser/base/content/test/general/browser_bookmark_popup.js
+++ b/browser/base/content/test/general/browser_bookmark_popup.js
@@ -91,17 +91,16 @@ add_task(function* panel_shown_for_once_
     shouldAutoClose: true,
     isBookmarkRemoved: false,
   });
 });
 
 add_task(function* panel_shown_once_for_slow_doubleclick_on_new_bookmark_star_and_autocloses() {
   todo(false, "bug 1250267, may need to add some tracking state to " +
               "browser-places.js for this.");
-  return;
 
   /*
   yield test_bookmarks_popup({
     isNewBookmark: true,
     *popupShowFn() {
       EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
       yield new Promise(resolve => setTimeout(resolve, 300));
       EventUtils.synthesizeMouse(bookmarkStar, 10, 10, window);
--- a/browser/base/content/test/general/browser_bug356571.js
+++ b/browser/base/content/test/general/browser_bug356571.js
@@ -57,17 +57,17 @@ var gProgressListener = {
       ok(gBrowser.tabs.length == kURIs.length, "Correctly opened all expected tabs");
       finishTest();
     }
   }
 }
 
 function test() {
   todo(false, "temp. disabled");
-  return; /* FIXME */
+  /* FIXME */
   /*
   waitForExplicitFinish();
   // Wait for all tabs to finish loading
   gBrowser.addTabsProgressListener(gProgressListener);
   loadOneOrMoreURIs(kURIs.join("|"));
   */
 }
 
--- a/browser/base/content/test/general/browser_contextmenu.js
+++ b/browser/base/content/test/general/browser_contextmenu.js
@@ -369,17 +369,16 @@ add_task(function* test_image_in_iframe(
           "context-viewframeinfo",     true], null]
   );
 });
 
 add_task(function* test_textarea() {
   // Disabled since this is seeing spell-check-enabled
   // instead of spell-add-dictionaries-main
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-textarea",
     ["context-undo",                false,
      "---",                         null,
      "context-cut",                 true,
      "context-copy",                true,
      "context-paste",               null,
@@ -393,17 +392,16 @@ add_task(function* test_textarea() {
       skipFocusChange: true,
     }
   );
   */
 });
 
 add_task(function* test_textarea_spellcheck() {
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-textarea",
     ["*chubbiness",         true, // spelling suggestion
      "spell-add-to-dictionary", true,
      "---",                 null,
      "context-undo",        false,
      "---",                 null,
@@ -433,17 +431,16 @@ add_task(function* test_textarea_spellch
 });
 
 add_task(function* test_plaintext2() {
   yield test_contextmenu("#test-text", plainTextItems);
 });
 
 add_task(function* test_undo_add_to_dictionary() {
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-textarea",
     ["spell-undo-add-to-dictionary", true,
      "---",                 null,
      "context-undo",        false,
      "---",                 null,
      "context-cut",         true,
@@ -467,17 +464,16 @@ add_task(function* test_undo_add_to_dict
       }
     }
   );
   */
 });
 
 add_task(function* test_contenteditable() {
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-contenteditable",
     ["spell-no-suggestions", false,
      "spell-add-to-dictionary", true,
      "---",                 null,
      "context-undo",        false,
      "---",                 null,
@@ -721,17 +717,16 @@ add_task(function* test_imagelink() {
      "context-setDesktopBackground", true,
      "context-viewimageinfo",        true
     ]
   );
 });
 
 add_task(function* test_select_input_text() {
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-select-input-text",
     ["context-undo",         false,
      "---",                  null,
      "context-cut",          true,
      "context-copy",         true,
      "context-paste",        null, // ignore clipboard state
@@ -754,17 +749,16 @@ add_task(function* test_select_input_tex
       }
     }
   );
   */
 });
 
 add_task(function* test_select_input_text_password() {
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-select-input-text-type-password",
     ["context-undo",        false,
      "---",                 null,
      "context-cut",         true,
      "context-copy",        true,
      "context-paste",       null, // ignore clipboard state
@@ -873,17 +867,16 @@ add_task(function* test_srcdoc() {
      "context-viewsource",   true,
      "context-viewinfo",     true
     ]
   );
 });
 
 add_task(function* test_input_spell_false() {
   todo(false, "spell checker tests are failing, bug 1246296");
-  return;
 
   /*
   yield test_contextmenu("#test-contenteditable-spellcheck-false",
     ["context-undo",        false,
      "---",                 null,
      "context-cut",         true,
      "context-copy",        true,
      "context-paste",       null, // ignore clipboard state
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -486,17 +486,16 @@ function whenSearchInitDone() {
       let eventName = "ContentSearchService";
       content.addEventListener(eventName, function onEvent(event) {
         if (event.detail.type == "State") {
           content.removeEventListener(eventName, onEvent);
           let resolver = function() {
             // Wait for the search controller to receive the event, then resolve.
             if (content.gSearch._contentSearchController.defaultEngine) {
               resolve();
-              return;
             }
           }
           content.setTimeout(resolver, 0);
         }
       });
     });
   });
 }
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -912,17 +912,16 @@ const CustomizableWidgets = [
       let doc = aEvent.target.ownerDocument;
       let container = doc.getElementById("PanelUI-feeds");
       let gotView = doc.defaultView.FeedHandler.buildFeedList(container, true);
 
       // For no feeds or only a single one, don't show the panel.
       if (!gotView) {
         aEvent.preventDefault();
         aEvent.stopPropagation();
-        return;
       }
     },
     onCreated(node) {
       let win = node.ownerGlobal;
       let selectedBrowser = win.gBrowser.selectedBrowser;
       let feeds = selectedBrowser && selectedBrowser.feeds;
       if (!feeds || !feeds.length) {
         node.setAttribute("disabled", "true");
--- a/browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js
@@ -117,17 +117,16 @@ add_task(function* test_pinned() {
         browser.test.assertEq(tabId, tab.id, "Check tab id");
         browser.test.log("onUpdate: " + JSON.stringify(changeInfo));
         if ("pinned" in changeInfo) {
           browser.test.assertTrue(changeInfo.pinned, "Check changeInfo.pinned");
           browser.tabs.onUpdated.removeListener(onUpdated);
           // Remove created tab.
           browser.tabs.remove(tabId);
           browser.test.notifyPass("finish");
-          return;
         }
       });
       browser.tabs.update(tab.id, {pinned: true});
     });
   });
 });
 
 add_task(function* test_unpinned() {
@@ -139,17 +138,16 @@ add_task(function* test_unpinned() {
         browser.test.assertEq(tabId, tab.id, "Check tab id");
         browser.test.log("onUpdate: " + JSON.stringify(changeInfo));
         if ("pinned" in changeInfo) {
           browser.test.assertFalse(changeInfo.pinned, "Check changeInfo.pinned");
           browser.tabs.onUpdated.removeListener(onUpdated);
           // Remove created tab.
           browser.tabs.remove(tabId);
           browser.test.notifyPass("finish");
-          return;
         }
       });
       browser.tabs.update(tab.id, {pinned: false});
     });
   });
 });
 
 add_task(function* test_url() {
@@ -162,17 +160,16 @@ add_task(function* test_url() {
         browser.test.log("onUpdate: " + JSON.stringify(changeInfo));
         if ("url" in changeInfo) {
           browser.test.assertEq("about:blank", changeInfo.url,
                                 "Check changeInfo.url");
           browser.tabs.onUpdated.removeListener(onUpdated);
           // Remove created tab.
           browser.tabs.remove(tabId);
           browser.test.notifyPass("finish");
-          return;
         }
       });
       browser.tabs.update(tab.id, {url: "about:blank"});
     });
   });
 });
 
 add_task(function* test_title() {
--- a/browser/components/extensions/test/browser/browser_ext_tabs_sendMessage.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_sendMessage.js
@@ -77,17 +77,17 @@ add_task(function* tabsSendMessageReply(
           if (msg == "respond-now") {
             respond(msg);
           } else if (msg == "respond-soon") {
             setTimeout(() => { respond(msg); }, 0);
             return true;
           } else if (msg == "respond-promise") {
             return Promise.resolve(msg);
           } else if (msg == "respond-never") {
-            return;
+            return undefined;
           } else if (msg == "respond-error") {
             return Promise.reject(new Error(msg));
           } else if (msg == "throw-error") {
             throw new Error(msg);
           }
         });
 
         browser.runtime.onMessage.addListener((msg, sender, respond) => {
--- a/browser/components/places/content/sidebarUtils.js
+++ b/browser/components/places/content/sidebarUtils.js
@@ -37,17 +37,16 @@ var SidebarUtils = {
     var isContainer = tbo.view.isContainer(cell.row);
     var openInTabs = isContainer &&
                      (aEvent.button == 1 ||
                       (aEvent.button == 0 && modifKey)) &&
                      PlacesUtils.hasChildURIs(tbo.view.nodeForTreeIndex(cell.row));
 
     if (aEvent.button == 0 && isContainer && !openInTabs) {
       tbo.view.toggleOpenState(cell.row);
-      return;
     } else if (!mouseInGutter && openInTabs &&
             aEvent.originalTarget.localName == "treechildren") {
       tbo.view.selection.select(cell.row);
       PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent, aTree);
     } else if (!mouseInGutter && !isContainer &&
              aEvent.originalTarget.localName == "treechildren") {
       // Clear all other selection since we're loading a link now. We must
       // do this *before* attempting to load the link since openURL uses
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -116,17 +116,16 @@ gTests.push({
             is(tree.view.selection.count, 1,
                "We have selected a tag from the autocomplete popup");
             info("About to focus the autocomplete results tree");
             tree.focus();
             EventUtils.synthesizeKey("VK_RETURN", {}, self.window);
             break;
           default:
             ok(false, "unknown event: " + aEvent.type);
-            return;
         }
       }
     };
     tagsField.popup.addEventListener("popupshown", popupListener, true);
     tagsField.popup.addEventListener("popuphidden", popupListener, true);
 
     // Open tags autocomplete popup.
     info("About to focus the tagsField");
@@ -218,17 +217,16 @@ gTests.push({
             is(tree.view.selection.count, 1,
                "We have selected a tag from the autocomplete popup");
             info("About to focus the autocomplete results tree");
             tree.focus();
             EventUtils.synthesizeKey("VK_ESCAPE", {}, self.window);
             break;
           default:
             ok(false, "unknown event: " + aEvent.type);
-            return;
         }
       }
     };
     tagsField.popup.addEventListener("popupshown", popupListener, true);
     tagsField.popup.addEventListener("popuphidden", popupListener, true);
 
     // Open tags autocomplete popup.
     info("About to focus the tagsField");
--- a/browser/components/preferences/blocklists.js
+++ b/browser/components/preferences/blocklists.js
@@ -82,23 +82,16 @@ var gBlocklistManager = {
     let blocklistsText = document.getElementById("blocklistsText");
     while (blocklistsText.hasChildNodes()) {
       blocklistsText.removeChild(blocklistsText.firstChild);
     }
     blocklistsText.appendChild(document.createTextNode(params.introText));
 
     document.title = params.windowTitle;
 
-    let treecols = document.getElementsByTagName("treecols")[0];
-    treecols.addEventListener("click", event => {
-      if (event.target.nodeName != "treecol" || event.button != 0) {
-        return;
-      }
-    });
-
     this._loadBlockLists();
   },
 
   uninit() {},
 
   onListSelected() {
     for (let list of this._blockLists) {
       list.selected = false;
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -192,17 +192,16 @@ var gMainPane = {
             return;
           }
 
           // Revert the checkbox in case we didn't quit
           revertCheckbox();
           return;
         case CONFIRM_RESTART_PROMPT_RESTART_LATER:
           createOrRemoveSpecialDevEditionFile();
-          return;
       }
     }
   },
 
   onGetStarted(aEvent) {
     if (AppConstants.MOZ_DEV_EDITION) {
       const Cc = Components.classes, Ci = Components.interfaces;
       let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
--- a/browser/components/search/test/browser_426329.js
+++ b/browser/components/search/test/browser_426329.js
@@ -150,17 +150,16 @@ add_task(function* testAltReturn() {
   });
 
   is(gBrowser.tabs.length, preTabNo + 1, "Alt+Return key added new tab");
   is(gBrowser.currentURI.spec, expectedURL(searchBar.value), "testAltReturn opened correct search page");
 });
 
 // Shift key has no effect for now, so skip it
 add_task(function* testShiftAltReturn() {
-  return;
   /*
   yield* prepareTest();
 
   let url = expectedURL(searchBar.value);
 
   let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, url);
   EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true, altKey: true });
   yield newTabPromise;
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -1946,17 +1946,16 @@ this.UITour = {
       log.error("startSubTour: No feature option specified");
       return;
     }
 
     if (aFeature == "readinglist") {
       ReaderParent.showReaderModeInfoPanel(browser);
     } else {
       log.error("startSubTour: Unknown feature option specified");
-      return;
     }
   },
 
   addNavBarWidget(aTarget, aMessageManager, aCallbackID) {
     if (aTarget.node) {
       log.error("addNavBarWidget: can't add a widget already present:", aTarget);
       return;
     }
@@ -2026,17 +2025,16 @@ this.UITour = {
         for (let engine of engines) {
           if (engine.identifier == aID) {
             Services.search.defaultEngine = engine;
             resolve();
             return;
           }
         }
         reject("selectSearchEngine could not find engine with given ID");
-        return;
       });
     });
   },
 
   notify(eventName, params) {
     let winEnum = Services.wm.getEnumerator("navigator:browser");
     while (winEnum.hasMoreElements()) {
       let window = winEnum.getNext();
--- a/browser/extensions/pocket/content/pocket-content-process.js
+++ b/browser/extensions/pocket/content/pocket-content-process.js
@@ -40,15 +40,13 @@ AboutPocketChildListener.prototype = {
   receiveMessage: function receiveMessage(message) {
     switch (message.name) {
       case "PocketShuttingDown":
         this.onShutdown();
         break;
       default:
         break;
     }
-
-    return;
   }
 };
 
 const listener = new AboutPocketChildListener();
 listener.onStartup();
--- a/browser/modules/ContentSearch.jsm
+++ b/browser/modules/ContentSearch.jsm
@@ -251,17 +251,16 @@ this.ContentSearch = {
       let params = {
         postData: submission.postData,
         inBackground: Services.prefs.getBoolPref("browser.tabs.loadInBackground"),
       };
       win.openUILinkIn(submission.uri.spec, where, params);
     }
     win.BrowserSearch.recordSearchInTelemetry(engine, data.healthReportKey,
                                               { selection: data.selection });
-    return;
   },
 
   getSuggestions: Task.async(function* (engineName, searchString, browser) {
     let engine = Services.search.getEngineByName(engineName);
     if (!engine) {
       throw new Error("Unknown engine name: " + engineName);
     }
 
--- a/browser/modules/LaterRun.jsm
+++ b/browser/modules/LaterRun.jsm
@@ -59,17 +59,16 @@ let LaterRun = {
       // We need to store seconds in order to fit within int prefs.
       Preferences.set(kProfileCreationTime, Math.floor(Date.now() / 1000));
     }
     this.sessionCount++;
 
     if (this.hoursSinceInstall > kSelfDestructHoursLimit ||
         this.sessionCount > kSelfDestructSessionLimit) {
       this.selfDestruct();
-      return;
     }
   },
 
   // The enabled, hoursSinceInstall and sessionCount properties mirror the
   // preferences system, and are here for convenience.
   get enabled() {
     return Preferences.get(kEnabledPref, false);
   },
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -197,16 +197,19 @@ module.exports = {
     }],
 
     // No using variables before defined
     // "no-use-before-define": ["error", "nofunc"],
 
     // Disallow unnecessary .call() and .apply()
     "no-useless-call": "error",
 
+    // Disallow redundant return statements
+    "no-useless-return": "error",
+
     // No using with
     "no-with": "error",
 
     // Require object-literal shorthand with ES6 method syntax
     "object-shorthand": ["error", "always", { "avoidQuotes": true }],
 
     // No spacing inside rest or spread expressions
     "rest-spread-spacing": "error",
--- a/toolkit/components/contextualidentity/ContextualIdentityService.jsm
+++ b/toolkit/components/contextualidentity/ContextualIdentityService.jsm
@@ -236,17 +236,16 @@ function _ContextualIdentityService(path
         this._lastUserContextId = data.lastUserContextId;
 
         this._dataReady = true;
       } finally {
         inputStream.close();
       }
     } catch (error) {
       this.loadError(error);
-      return;
     }
   },
 
   getIdentities() {
     this.ensureDataReady();
     return Cu.cloneInto(this._identities.filter(info => info.public), {});
   },
 
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js
@@ -8,17 +8,17 @@ add_task(function* tabsSendMessageReply(
       if (msg == "respond-now") {
         respond(msg);
       } else if (msg == "respond-soon") {
         setTimeout(() => { respond(msg); }, 0);
         return true;
       } else if (msg == "respond-promise") {
         return Promise.resolve(msg);
       } else if (msg == "respond-never") {
-        return;
+        return undefined;
       } else if (msg == "respond-error") {
         return Promise.reject(new Error(msg));
       } else if (msg == "throw-error") {
         throw new Error(msg);
       }
     });
 
     browser.runtime.onMessage.addListener((msg, sender, respond) => {
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -46,21 +46,18 @@
                         throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
                 return this;
             },
 
             observe(subject, topic, data) {
                 if (topic === "domwindowopened") {
                     this.windowsOpen++;
                     this.windowsRegistered++;
-                    return;
-                }
-                if (topic === "domwindowclosed") {
+                } else if (topic === "domwindowclosed") {
                     this.windowsOpen--;
-                    return;
                 }
             },
 
             shutdown() {
                 var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                                                .getService(Ci.nsIObserverService);
                 observerService.removeObserver(this, "domwindowopened");
                 observerService.removeObserver(this, "domwindowclosed");
--- a/toolkit/components/perfmonitoring/tests/browser/head.js
+++ b/toolkit/components/perfmonitoring/tests/browser/head.js
@@ -125,17 +125,16 @@ function AlertListener(accept, {register
       throw new Error("Listener was unregistered");
     }
     let result = accept(...args);
     if (!result) {
       return;
     }
     this.result = result;
     this.triggered = true;
-    return;
   };
   this.triggered = false;
   this.result = null;
   this._unregistered = false;
   this._unregister = unregister;
   registerCleanupFunction(() => {
     this.unregister();
   });
--- a/toolkit/components/places/tests/history/test_remove.js
+++ b/toolkit/components/places/tests/history/test_remove.js
@@ -128,17 +128,16 @@ add_task(function* test_remove_single() 
         yield remover("Testing History.remove() with a single URI in an array", x => [x], options);
         yield remover("Testing History.remove() with a single string url in an array", x => [x.spec], options);
         yield remover("Testing History.remove() with a single string guid in an array", x => [do_get_guid_for_uri(x)], options);
       }
     }
   } finally {
     yield PlacesTestUtils.clearHistory();
   }
-  return;
 });
 
 // Test removing a list of pages
 add_task(function* test_remove_many() {
   const SIZE = 10;
 
   yield PlacesTestUtils.clearHistory();
   yield PlacesUtils.bookmarks.eraseEverything();
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -1018,17 +1018,16 @@ function runTest() {
         checkMenuEntries([], testNum);
         input.blur();
         SimpleTest.finish();
         return;
 
     default:
         ok(false, "Unexpected invocation of test #" + testNum);
         SimpleTest.finish();
-        return;
   }
 }
 
 function addEntry(name, value) {
   updateFormHistory({ op : "add", fieldname : name, value }, runTest);
 }
 
 // Runs the next test when scroll event occurs
--- a/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
@@ -474,17 +474,16 @@ function runTest() {
       doKey("down");
       checkForm("");
       doKey("return");
       break;
 
     default:
       ok(false, "Unexpected invocation of test #" + testNum);
       SimpleTest.finish();
-      return;
     }
 }
 
 function waitForMenuChange(expectedCount) {
     notifyMenuChanged(expectedCount, null, runTest);
 }
 
 function checkMenuEntries(expectedValues, testNumber) {
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -330,17 +330,16 @@ var gViewSourceUtils = {
           var pageLoader = webShell.QueryInterface(this.mnsIWebPageDescriptor);
           pageLoader.loadPage(data.pageDescriptor, this.mnsIWebPageDescriptor.DISPLAY_AS_SOURCE);
         }
       }
     } catch (ex) {
       // we failed loading it with the external editor.
       Components.utils.reportError(ex);
       this.handleCallBack(aCallBack, false, data);
-      return;
     }
   },
 
   // Default callback - opens the internal viewer if the external editor failed
   internalViewerFallback(result, data) {
     if (!result) {
       this._openInInternalViewer(data.url, data.pageDescriptor, data.doc, data.lineNumber);
     }
--- a/toolkit/components/workerloader/tests/utils_mainthread.js
+++ b/toolkit/components/workerloader/tests/utils_mainthread.js
@@ -23,12 +23,11 @@ function worker_handler(worker) {
     case "info":
       SimpleTest.info(msg.data.description);
       return;
     case "finish":
       SimpleTest.finish();
       return;
     default:
       SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data));
-      return;
     }
   };
 }
--- a/toolkit/components/workerloader/tests/worker_handler.js
+++ b/toolkit/components/workerloader/tests/worker_handler.js
@@ -23,12 +23,11 @@ function worker_handler(worker) {
     case "info":
       SimpleTest.info(msg.data.description);
       return;
     case "finish":
       SimpleTest.finish();
       return;
     default:
       SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data));
-      return;
     }
   };
 }
--- a/toolkit/content/tests/widgets/popup_shared.js
+++ b/toolkit/content/tests/widgets/popup_shared.js
@@ -58,17 +58,16 @@ function startPopupTests(tests) {
 
 function finish() {
   if (window.opener) {
     window.close();
     window.opener.SimpleTest.finish();
     return;
   }
   SimpleTest.finish();
-  return;
 }
 
 function ok(condition, message) {
   if (window.opener)
     window.opener.SimpleTest.ok(condition, message);
   else
     SimpleTest.ok(condition, message);
 }
--- a/toolkit/identity/Identity.jsm
+++ b/toolkit/identity/Identity.jsm
@@ -194,17 +194,16 @@ IDService.prototype = {
           // current provisioning flow.  We only do this here on error.
           self.RP._generateAssertion(rp.origin, aIdentity, function gotAssertion(err, assertion) {
             if (err) {
               rp.doError(err);
               return;
             }
             self.RP._doLogin(rp, rpLoginOptions, assertion);
             self.RP._cleanUpProvisionFlow(aRPId, aProvId);
-            return;
           });
         });
       });
     });
   },
 
   // methods for chrome and add-ons
 
--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
@@ -880,17 +880,16 @@ function _persistProgressListener(succes
   this.onStateChange    = function(aWebProgress, aRequest, aStateFlags, aStatus) {
     if (aRequest &&
         aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
         aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
       try {
         if (aRequest.QueryInterface(Ci.nsIHttpChannel).requestSucceeded) {
           // success
           successCallback();
-          return;
         }
       } catch (e) { }
       // failure
     }
   };
 }
 
 AddonManagerPrivate.registerProvider(LightweightThemeManager, [
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -2056,17 +2056,16 @@ var gHeader = {
 
   focusSearchBox() {
     this._search.focus();
   },
 
   onKeyPress(aEvent) {
     if (String.fromCharCode(aEvent.charCode) == "/") {
       this.focusSearchBox();
-      return;
     }
   },
 
   get shouldShowNavButtons() {
     var docshellItem = window.QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIWebNavigation)
                              .QueryInterface(Ci.nsIDocShellTreeItem);
 
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -1936,17 +1936,16 @@ function removeAsync(aFile) {
       if (info.isDir)
         yield OS.File.removeDir(aFile.path);
       else
         yield OS.File.remove(aFile.path);
     } catch (e) {
       if (!(e instanceof OS.File.Error) || !e.becauseNoSuchFile)
         throw e;
       // The file has already gone away
-      return;
     }
   });
 }
 
 /**
  * Recursively removes a directory or file fixing permissions when necessary.
  *
  * @param  aFile
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -931,17 +931,16 @@ Blocklist.prototype = {
       if (populateCertBlocklist) {
         gCertBlocklistService.saveEntries();
       }
       if (this._gfxEntries.length > 0) {
         this._notifyObserversBlocklistGFX();
       }
     } catch (e) {
       LOG("Blocklist::_loadBlocklistFromFile: Error constructing blocklist " + e);
-      return;
     }
   },
 
   _processItemNodes(itemNodes, itemName, handler) {
     var result = [];
     for (var i = 0; i < itemNodes.length; ++i) {
       var blocklistElement = itemNodes.item(i);
       if (!(blocklistElement instanceof Ci.nsIDOMElement) ||
--- a/toolkit/mozapps/extensions/test/xpcshell/test_undothemeuninstall.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_undothemeuninstall.js
@@ -349,17 +349,17 @@ add_task(function* canUndoUninstallDisab
 
   t1.uninstall();
   yield promiseRestartManager();
 });
 
 // Tests that uninstalling an enabled lightweight theme offers the option to undo
 add_task(function* uninstallLWTOffersUndo() {
   // skipped since lightweight themes don't support undoable uninstall yet
-  return;
+
   /*
   LightweightThemeManager.currentTheme = dummyLWTheme("theme1");
 
   let [ t1, d ] = yield promiseAddonsByIDs(["theme1@personas.mozilla.org",
                                             "default@tests.mozilla.org"]);
 
   do_check_neq(d, null);
   do_check_false(d.isActive);
--- a/toolkit/mozapps/preferences/changemp.js
+++ b/toolkit/mozapps/preferences/changemp.js
@@ -191,18 +191,16 @@ function setPasswordStrength() {
   }
 
   if ( pwstrength > 100 ) {
     pwstrength = 100;
   }
 
   var mymeter = document.getElementById('pwmeter');
   mymeter.value = pwstrength;
-
-  return;
 }
 
 function checkPasswords() {
   var pw1 = document.getElementById('pw1').value;
   var pw2 = document.getElementById('pw2').value;
   var ok = document.documentElement.getButton("accept");
 
   var oldpwbox = document.getElementById("oldpw");
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -2077,17 +2077,16 @@ UpdateService.prototype = {
       um.activeUpdate = update;
 
       // Done with this update. Clean it up.
       cleanupActiveUpdate();
     } else if (status == STATE_PENDING_ELEVATE) {
       let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
                      createInstance(Ci.nsIUpdatePrompt);
       prompter.showUpdateElevationRequired();
-      return;
     } else {
       // If there was an I/O error it is assumed that the patch is not invalid
       // and it is set to pending so an attempt to apply it again will happen
       // when the application is restarted.
       if (update.state == STATE_FAILED && update.errorCode) {
         if (handleUpdateFailure(update, update.errorCode)) {
           return;
         }