Bug 1571567 - Fix no-fallthrough errors in /toolkit. r=MattN
☠☠ backed out by c1bdc57b9b3e ☠ ☠
authorJared Wein <jwein@mozilla.com>
Thu, 08 Aug 2019 01:38:50 +0000
changeset 486961 42df735c8556c6dc34316e95c4e308d8180d5af3
parent 486960 7d5fc57b28096f14440084d2ca245ccbf9fba8a4
child 486962 7ec086bb5bd5fd6a64263db4932417f0af8c4159
push id36411
push userrmaries@mozilla.com
push dateFri, 09 Aug 2019 03:49:20 +0000
treeherdermozilla-central@047e16b38566 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1571567
milestone70.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 1571567 - Fix no-fallthrough errors in /toolkit. r=MattN Differential Revision: https://phabricator.services.mozilla.com/D40746
toolkit/components/alerts/resources/content/alert.js
toolkit/components/antitracking/test/browser/antitracking_head.js
toolkit/components/captivedetect/CaptiveDetect.jsm
toolkit/components/normandy/actions/PreferenceRollbackAction.jsm
toolkit/components/normandy/actions/ShowHeartbeatAction.jsm
toolkit/components/passwordmgr/LoginHelper.jsm
toolkit/components/passwordmgr/storage-json.js
toolkit/components/passwordmgr/storage-mozStorage.js
toolkit/components/places/tests/queries/test_containersQueries_sorting.js
toolkit/components/resistfingerprinting/RFPHelper.jsm
toolkit/components/timermanager/UpdateTimerManager.jsm
toolkit/content/widgets/browser-custom-element.js
toolkit/modules/PopupNotifications.jsm
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/test/browser/head.js
toolkit/profile/content/profileSelection.js
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -46,16 +46,17 @@ function prefillAlertInfo() {
       if (window.arguments[12]) {
         let alertBox = document.getElementById("alertBox");
         alertBox.setAttribute("hasIcon", true);
 
         let icon = document.getElementById("alertIcon");
         icon.src = window.arguments[12];
       }
     }
+    // fall through
     case 12: {
       if (window.arguments[11]) {
         let alertBox = document.getElementById("alertBox");
         alertBox.setAttribute("hasOrigin", true);
 
         let hostPort = window.arguments[11];
         const ALERT_BUNDLE = Services.strings.createBundle(
           "chrome://alerts/locale/alert.properties"
@@ -90,50 +91,59 @@ function prefillAlertInfo() {
         );
         let openSettings = document.getElementById("openSettingsMenuItem");
         openSettings.setAttribute(
           "label",
           ALERT_BUNDLE.GetStringFromName("webActions.settings.label")
         );
       }
     }
+    // fall through
     case 11:
       gAlertListener = window.arguments[10];
+    // fall through
     case 10:
       gReplacedWindow = window.arguments[9];
+    // fall through
     case 9:
       gRequireInteraction = window.arguments[8];
+    // fall through
     case 8:
       if (window.arguments[7]) {
         document
           .getElementById("alertTitleLabel")
           .setAttribute("lang", window.arguments[7]);
         document
           .getElementById("alertTextLabel")
           .setAttribute("lang", window.arguments[7]);
       }
+    // fall through
     case 7:
       if (window.arguments[6]) {
         document.getElementById("alertNotification").style.direction =
           window.arguments[6];
       }
+    // fall through
     case 6:
       gOrigin = window.arguments[5];
+    // fall through
     case 5:
       gAlertCookie = window.arguments[4];
+    // fall through
     case 4:
       gAlertTextClickable = window.arguments[3];
       if (gAlertTextClickable) {
         document
           .getElementById("alertNotification")
           .setAttribute("clickable", true);
         document
           .getElementById("alertTextLabel")
           .setAttribute("clickable", true);
       }
+    // fall through
     case 3:
       if (window.arguments[2]) {
         document.getElementById("alertBox").setAttribute("hasBodyText", true);
         let bodyText = window.arguments[2];
         let bodyTextLabel = document.getElementById("alertTextLabel");
 
         if (bodyText.length > BODY_TEXT_LIMIT) {
           bodyTextLabel.setAttribute("tooltiptext", bodyText);
@@ -154,27 +164,30 @@ function prefillAlertInfo() {
           if (truncChar >= 0xdc00 && truncChar <= 0xdfff) {
             truncLength++;
           }
 
           bodyText = bodyText.substring(0, truncLength) + ellipsis;
         }
         bodyTextLabel.textContent = bodyText;
       }
+    // fall through
     case 2:
       document
         .getElementById("alertTitleLabel")
         .setAttribute("value", window.arguments[1]);
+    // fall through
     case 1:
       if (window.arguments[0]) {
         document.getElementById("alertBox").setAttribute("hasImage", true);
         document
           .getElementById("alertImage")
           .setAttribute("src", window.arguments[0]);
       }
+    // fall through
     case 0:
       break;
   }
 }
 
 function onAlertLoad() {
   const ALERT_DURATION_IMMEDIATE = 20000;
   let alertTextBox = document.getElementById("alertTextBox");
--- a/toolkit/components/antitracking/test/browser/antitracking_head.js
+++ b/toolkit/components/antitracking/test/browser/antitracking_head.js
@@ -504,16 +504,17 @@ this.AntiTracking = {
                       return;
                     }
 
                     ok(false, "Unknown message");
                   });
 
                   ifr.src = obj.nextPage;
                 });
+                break;
               case "navigate-topframe":
                 // pass-through
                 break;
               default:
                 ok(
                   false,
                   "Unexpected accessRemoval code passed: " + obj.accessRemoval
                 );
--- a/toolkit/components/captivedetect/CaptiveDetect.jsm
+++ b/toolkit/components/captivedetect/CaptiveDetect.jsm
@@ -204,17 +204,17 @@ function LoginObserver(captivePortalDete
     /*
      * Check if login activity is finished according to HTTP burst.
      */
     notify: function notify() {
       switch (state) {
         case LOGIN_OBSERVER_STATE_BURST:
           // Wait while network stays idle for a short period
           state = LOGIN_OBSERVER_STATE_VERIFY_NEEDED;
-        // Fall though to start polling timer
+        // Fall through to start polling timer
         case LOGIN_OBSERVER_STATE_IDLE:
         // Just fall through to perform a captive portal check.
         case LOGIN_OBSERVER_STATE_VERIFY_NEEDED:
           // Polling the canonical website since network stays idle for a while
           state = LOGIN_OBSERVER_STATE_VERIFYING;
           checkPageContent();
           break;
 
--- a/toolkit/components/normandy/actions/PreferenceRollbackAction.jsm
+++ b/toolkit/components/normandy/actions/PreferenceRollbackAction.jsm
@@ -59,16 +59,17 @@ class PreferenceRollbackAction extends B
         await PreferenceRollouts.update(rollout);
         TelemetryEvents.sendEvent(
           "unenroll",
           "preference_rollback",
           rolloutSlug,
           { reason: "rollback" }
         );
         TelemetryEnvironment.setExperimentInactive(rolloutSlug);
+        break;
       }
       case PreferenceRollouts.STATE_ROLLED_BACK: {
         // The rollout has already been rolled back, so nothing to do here.
         break;
       }
       case PreferenceRollouts.STATE_GRADUATED: {
         // graduated rollouts can't be rolled back
         TelemetryEvents.sendEvent(
--- a/toolkit/components/normandy/actions/ShowHeartbeatAction.jsm
+++ b/toolkit/components/normandy/actions/ShowHeartbeatAction.jsm
@@ -144,28 +144,30 @@ class ShowHeartbeatAction extends BaseAc
         if (await recipeStorage.getItem("lastShown")) {
           this.log.debug(
             `Heartbeat for "once" recipe ${
               recipe.id
             } has been shown before, skipping.`
           );
           return false;
         }
+        break;
       }
 
       case "nag": {
         // Show a heartbeat again only if the user has not interacted with it before
         if (await recipeStorage.getItem("lastInteraction")) {
           this.log.debug(
             `Heartbeat for "nag" recipe ${
               recipe.id
             } has already been interacted with, skipping.`
           );
           return false;
         }
+        break;
       }
 
       case "xdays": {
         // Show this heartbeat again if it  has been at least `repeatEvery` days since the last time it was shown.
         let lastShown = await gAllRecipeStorage.getItem("lastShown");
         if (lastShown) {
           lastShown = new Date(lastShown);
           const duration = new Date() - lastShown;
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -451,25 +451,25 @@ this.LoginHelper = {
         let newPassword = aNewLoginData.getProperty("password");
         if (newPassword != aOldStoredLogin.password) {
           newLogin.timePasswordChanged = Date.now();
         }
       }
 
       for (let prop of aNewLoginData.enumerator) {
         switch (prop.name) {
-          // nsILoginInfo
+          // nsILoginInfo (fall through)
           case "origin":
           case "httpRealm":
           case "formActionOrigin":
           case "username":
           case "password":
           case "usernameField":
           case "passwordField":
-          // nsILoginMetaInfo
+          // nsILoginMetaInfo (fall through)
           case "guid":
           case "timeCreated":
           case "timeLastUsed":
           case "timePasswordChanged":
           case "timesUsed":
             newLogin[prop.name] = prop.value;
             break;
 
--- a/toolkit/components/passwordmgr/storage-json.js
+++ b/toolkit/components/passwordmgr/storage-json.js
@@ -430,18 +430,18 @@ this.LoginManagerStorage_json.prototype 
                   wantedValue,
                   aOptions
                 )
               ) {
                 return false;
               }
               break;
             }
+          // Normal cases.
           // fall through
-          // Normal cases.
           case "httpRealm":
           case "id":
           case "usernameField":
           case "passwordField":
           case "encryptedUsername":
           case "encryptedPassword":
           case "guid":
           case "encType":
--- a/toolkit/components/passwordmgr/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/storage-mozStorage.js
@@ -557,18 +557,18 @@ LoginManagerStorage_mozStorage.prototype
                   "http://" + valueURI.displayHostPort;
               }
             } catch (ex) {
               // newURI will throw for some values (e.g. chrome://FirefoxAccounts)
               // but those URLs wouldn't support upgrades anyways.
             }
             break;
           }
+        // Normal cases.
         // Fall through
-        // Normal cases.
         case "httpRealm":
         case "id":
         case "usernameField":
         case "passwordField":
         case "encryptedUsername":
         case "encryptedPassword":
         case "guid":
         case "encType":
--- a/toolkit/components/places/tests/queries/test_containersQueries_sorting.js
+++ b/toolkit/components/places/tests/queries/test_containersQueries_sorting.js
@@ -435,16 +435,17 @@ function check_children_sorting(aRootNod
       comparator = function(a, b) {
         return a.time - b.time;
       };
       break;
     case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
       comparator = function(a, b) {
         return b.time - a.time;
       };
+      break;
     case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING:
       comparator = function(a, b) {
         return a.dateAdded - b.dateAdded;
       };
       break;
     case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING:
       comparator = function(a, b) {
         return b.dateAdded - a.dateAdded;
--- a/toolkit/components/resistfingerprinting/RFPHelper.jsm
+++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm
@@ -174,16 +174,17 @@ class _RFPHelper {
     }
   }
 
   _handleSpoofEnglishChanged() {
     switch (Services.prefs.getIntPref(kPrefSpoofEnglish)) {
       case 0: // will prompt
       // This should only happen when turning privacy.resistFingerprinting off.
       // Works like disabling accept-language spoofing.
+      // fall through
       case 1: // don't spoof
         if (
           Services.prefs.prefHasUserValue("javascript.use_us_english_locale")
         ) {
           Services.prefs.clearUserPref("javascript.use_us_english_locale");
         }
         // We don't reset intl.accept_languages. Instead, setting
         // privacy.spoof_english to 1 allows user to change preferred language
--- a/toolkit/components/timermanager/UpdateTimerManager.jsm
+++ b/toolkit/components/timermanager/UpdateTimerManager.jsm
@@ -67,16 +67,17 @@ TimerManager.prototype = {
     // seconds.
     var minFirstInterval = 10000;
     switch (aTopic) {
       case "utm-test-init":
         // Enforce a minimum timer interval of 500 ms for tests and fall through
         // to profile-after-change to initialize the timer.
         minInterval = 500;
         minFirstInterval = 500;
+      // fall through
       case "profile-after-change":
         this._timerMinimumDelay = Math.max(
           1000 *
             Services.prefs.getIntPref(PREF_APP_UPDATE_TIMERMINIMUMDELAY, 120),
           minInterval
         );
         // Prevent the timer delay between notifications to other consumers from
         // being greater than 5 minutes which is 300000 milliseconds.
--- a/toolkit/content/widgets/browser-custom-element.js
+++ b/toolkit/content/widgets/browser-custom-element.js
@@ -1835,16 +1835,17 @@
             if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
               // the escape key will be processed by
               // nsXULPopupManager::KeyDown and the panel will be closed.
               // So, don't consume the key event here.
               break;
             }
             // don't break here. we need to eat keydown events.
           }
+          // fall through
           case "keypress":
           case "keyup": {
             // All keyevents should be eaten here during autoscrolling.
             aEvent.stopPropagation();
             aEvent.preventDefault();
             break;
           }
         }
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -766,19 +766,18 @@ PopupNotifications.prototype = {
       case "popuphidden":
         this._onPopupHidden(aEvent);
         break;
       case "activate":
         if (this.isPanelOpen) {
           for (let elt of this.panel.children) {
             elt.notification.timeShown = this.window.performance.now();
           }
-          break;
         }
-
+      // fall through
       case "TabSelect":
         let self = this;
         // setTimeout(..., 0) needed, otherwise openPopup from "activate" event
         // handler results in the popup being hidden again for some reason...
         this.window.setTimeout(function() {
           self._update();
         }, 0);
         break;
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -1416,16 +1416,17 @@ class AddonInstall {
         this._cleanup();
         this._callInstallListeners("onInstallCancelled");
         this.removeTemporaryFile();
 
         let stagingDir = this.location.installer.getStagingDir();
         let stagedAddon = stagingDir.clone();
 
         this.unstageInstall(stagedAddon);
+        break;
       default:
         throw new Error(
           "Cannot cancel install of " +
             this.sourceURI.spec +
             " from this state (" +
             this.state +
             ")"
         );
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1405,17 +1405,17 @@ MockInstall.prototype = {
             this.addon.id = this.existingAddon.id;
           }
           this.existingAddon.pendingUpgrade = this.addon;
           this.existingAddon.pendingOperations |= AddonManager.PENDING_UPGRADE;
         }
 
         this.state = AddonManager.STATE_DOWNLOADED;
         this.callListeners("onDownloadEnded");
-
+        break;
       case AddonManager.STATE_DOWNLOADED:
         this.state = AddonManager.STATE_INSTALLING;
         if (!this.callListeners("onInstallStarted")) {
           this.state = AddonManager.STATE_CANCELLED;
           this.callListeners("onInstallCancelled");
           return;
         }
 
--- a/toolkit/profile/content/profileSelection.js
+++ b/toolkit/profile/content/profileSelection.js
@@ -183,16 +183,17 @@ function updateStartupPrefs() {
 
 // handle key event on listboxes
 function onProfilesKey(aEvent) {
   switch (aEvent.keyCode) {
     case KeyEvent.DOM_VK_BACK_SPACE:
       if (AppConstants.platform != "macosx") {
         break;
       }
+    // fall through
     case KeyEvent.DOM_VK_DELETE:
       ConfirmDelete();
       break;
     case KeyEvent.DOM_VK_F2:
       RenameProfile();
       break;
   }
 }