Bug 1571567 - Fix no-fallthrough errors in /toolkit. r=MattN

Differential Revision: https://phabricator.services.mozilla.com/D40746
This commit is contained in:
Jared Wein
2019-08-08 16:18:24 +00:00
parent a559a71435
commit abceb15a41
16 changed files with 30 additions and 8 deletions

View File

@@ -51,6 +51,7 @@ function prefillAlertInfo() {
icon.src = window.arguments[12]; icon.src = window.arguments[12];
} }
} }
// fall through
case 12: { case 12: {
if (window.arguments[11]) { if (window.arguments[11]) {
let alertBox = document.getElementById("alertBox"); let alertBox = document.getElementById("alertBox");
@@ -95,12 +96,16 @@ function prefillAlertInfo() {
); );
} }
} }
// fall through
case 11: case 11:
gAlertListener = window.arguments[10]; gAlertListener = window.arguments[10];
// fall through
case 10: case 10:
gReplacedWindow = window.arguments[9]; gReplacedWindow = window.arguments[9];
// fall through
case 9: case 9:
gRequireInteraction = window.arguments[8]; gRequireInteraction = window.arguments[8];
// fall through
case 8: case 8:
if (window.arguments[7]) { if (window.arguments[7]) {
document document
@@ -110,15 +115,19 @@ function prefillAlertInfo() {
.getElementById("alertTextLabel") .getElementById("alertTextLabel")
.setAttribute("lang", window.arguments[7]); .setAttribute("lang", window.arguments[7]);
} }
// fall through
case 7: case 7:
if (window.arguments[6]) { if (window.arguments[6]) {
document.getElementById("alertNotification").style.direction = document.getElementById("alertNotification").style.direction =
window.arguments[6]; window.arguments[6];
} }
// fall through
case 6: case 6:
gOrigin = window.arguments[5]; gOrigin = window.arguments[5];
// fall through
case 5: case 5:
gAlertCookie = window.arguments[4]; gAlertCookie = window.arguments[4];
// fall through
case 4: case 4:
gAlertTextClickable = window.arguments[3]; gAlertTextClickable = window.arguments[3];
if (gAlertTextClickable) { if (gAlertTextClickable) {
@@ -129,6 +138,7 @@ function prefillAlertInfo() {
.getElementById("alertTextLabel") .getElementById("alertTextLabel")
.setAttribute("clickable", true); .setAttribute("clickable", true);
} }
// fall through
case 3: case 3:
if (window.arguments[2]) { if (window.arguments[2]) {
document.getElementById("alertBox").setAttribute("hasBodyText", true); document.getElementById("alertBox").setAttribute("hasBodyText", true);
@@ -159,10 +169,12 @@ function prefillAlertInfo() {
} }
bodyTextLabel.textContent = bodyText; bodyTextLabel.textContent = bodyText;
} }
// fall through
case 2: case 2:
document document
.getElementById("alertTitleLabel") .getElementById("alertTitleLabel")
.setAttribute("value", window.arguments[1]); .setAttribute("value", window.arguments[1]);
// fall through
case 1: case 1:
if (window.arguments[0]) { if (window.arguments[0]) {
document.getElementById("alertBox").setAttribute("hasImage", true); document.getElementById("alertBox").setAttribute("hasImage", true);
@@ -170,6 +182,7 @@ function prefillAlertInfo() {
.getElementById("alertImage") .getElementById("alertImage")
.setAttribute("src", window.arguments[0]); .setAttribute("src", window.arguments[0]);
} }
// fall through
case 0: case 0:
break; break;
} }

View File

@@ -509,6 +509,7 @@ this.AntiTracking = {
ifr.src = obj.nextPage; ifr.src = obj.nextPage;
}); });
break;
case "navigate-topframe": case "navigate-topframe":
// pass-through // pass-through
break; break;

View File

@@ -209,7 +209,7 @@ function LoginObserver(captivePortalDetector) {
case LOGIN_OBSERVER_STATE_BURST: case LOGIN_OBSERVER_STATE_BURST:
// Wait while network stays idle for a short period // Wait while network stays idle for a short period
state = LOGIN_OBSERVER_STATE_VERIFY_NEEDED; state = LOGIN_OBSERVER_STATE_VERIFY_NEEDED;
// Fall though to start polling timer // Fall through to start polling timer
case LOGIN_OBSERVER_STATE_IDLE: case LOGIN_OBSERVER_STATE_IDLE:
// Just fall through to perform a captive portal check. // Just fall through to perform a captive portal check.
case LOGIN_OBSERVER_STATE_VERIFY_NEEDED: case LOGIN_OBSERVER_STATE_VERIFY_NEEDED:

View File

@@ -64,6 +64,7 @@ class PreferenceRollbackAction extends BaseAction {
{ reason: "rollback" } { reason: "rollback" }
); );
TelemetryEnvironment.setExperimentInactive(rolloutSlug); TelemetryEnvironment.setExperimentInactive(rolloutSlug);
break;
} }
case PreferenceRollouts.STATE_ROLLED_BACK: { case PreferenceRollouts.STATE_ROLLED_BACK: {
// The rollout has already been rolled back, so nothing to do here. // The rollout has already been rolled back, so nothing to do here.

View File

@@ -149,6 +149,7 @@ class ShowHeartbeatAction extends BaseAction {
); );
return false; return false;
} }
break;
} }
case "nag": { case "nag": {
@@ -161,6 +162,7 @@ class ShowHeartbeatAction extends BaseAction {
); );
return false; return false;
} }
break;
} }
case "xdays": { case "xdays": {

View File

@@ -456,7 +456,7 @@ this.LoginHelper = {
for (let prop of aNewLoginData.enumerator) { for (let prop of aNewLoginData.enumerator) {
switch (prop.name) { switch (prop.name) {
// nsILoginInfo // nsILoginInfo (fall through)
case "origin": case "origin":
case "httpRealm": case "httpRealm":
case "formActionOrigin": case "formActionOrigin":
@@ -464,7 +464,7 @@ this.LoginHelper = {
case "password": case "password":
case "usernameField": case "usernameField":
case "passwordField": case "passwordField":
// nsILoginMetaInfo // nsILoginMetaInfo (fall through)
case "guid": case "guid":
case "timeCreated": case "timeCreated":
case "timeLastUsed": case "timeLastUsed":

View File

@@ -435,8 +435,8 @@ this.LoginManagerStorage_json.prototype = {
} }
break; break;
} }
// fall through
// Normal cases. // Normal cases.
// fall through
case "httpRealm": case "httpRealm":
case "id": case "id":
case "usernameField": case "usernameField":

View File

@@ -562,8 +562,8 @@ LoginManagerStorage_mozStorage.prototype = {
} }
break; break;
} }
// Fall through
// Normal cases. // Normal cases.
// Fall through
case "httpRealm": case "httpRealm":
case "id": case "id":
case "usernameField": case "usernameField":

View File

@@ -440,6 +440,7 @@ function check_children_sorting(aRootNode, aExpectedSortingMode) {
comparator = function(a, b) { comparator = function(a, b) {
return b.time - a.time; return b.time - a.time;
}; };
// fall through - we shouldn't do this, see bug 1572437.
case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING: case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING:
comparator = function(a, b) { comparator = function(a, b) {
return a.dateAdded - b.dateAdded; return a.dateAdded - b.dateAdded;

View File

@@ -179,6 +179,7 @@ class _RFPHelper {
case 0: // will prompt case 0: // will prompt
// This should only happen when turning privacy.resistFingerprinting off. // This should only happen when turning privacy.resistFingerprinting off.
// Works like disabling accept-language spoofing. // Works like disabling accept-language spoofing.
// fall through
case 1: // don't spoof case 1: // don't spoof
if ( if (
Services.prefs.prefHasUserValue("javascript.use_us_english_locale") Services.prefs.prefHasUserValue("javascript.use_us_english_locale")

View File

@@ -72,6 +72,7 @@ TimerManager.prototype = {
// to profile-after-change to initialize the timer. // to profile-after-change to initialize the timer.
minInterval = 500; minInterval = 500;
minFirstInterval = 500; minFirstInterval = 500;
// fall through
case "profile-after-change": case "profile-after-change":
this._timerMinimumDelay = Math.max( this._timerMinimumDelay = Math.max(
1000 * 1000 *

View File

@@ -1840,6 +1840,7 @@
} }
// don't break here. we need to eat keydown events. // don't break here. we need to eat keydown events.
} }
// fall through
case "keypress": case "keypress":
case "keyup": { case "keyup": {
// All keyevents should be eaten here during autoscrolling. // All keyevents should be eaten here during autoscrolling.

View File

@@ -771,9 +771,8 @@ PopupNotifications.prototype = {
for (let elt of this.panel.children) { for (let elt of this.panel.children) {
elt.notification.timeShown = this.window.performance.now(); elt.notification.timeShown = this.window.performance.now();
} }
break;
} }
// fall through
case "TabSelect": case "TabSelect":
let self = this; let self = this;
// setTimeout(..., 0) needed, otherwise openPopup from "activate" event // setTimeout(..., 0) needed, otherwise openPopup from "activate" event

View File

@@ -1421,6 +1421,7 @@ class AddonInstall {
let stagedAddon = stagingDir.clone(); let stagedAddon = stagingDir.clone();
this.unstageInstall(stagedAddon); this.unstageInstall(stagedAddon);
break;
default: default:
throw new Error( throw new Error(
"Cannot cancel install of " + "Cannot cancel install of " +

View File

@@ -1410,7 +1410,7 @@ MockInstall.prototype = {
this.state = AddonManager.STATE_DOWNLOADED; this.state = AddonManager.STATE_DOWNLOADED;
this.callListeners("onDownloadEnded"); this.callListeners("onDownloadEnded");
// fall through
case AddonManager.STATE_DOWNLOADED: case AddonManager.STATE_DOWNLOADED:
this.state = AddonManager.STATE_INSTALLING; this.state = AddonManager.STATE_INSTALLING;
if (!this.callListeners("onInstallStarted")) { if (!this.callListeners("onInstallStarted")) {

View File

@@ -188,6 +188,7 @@ function onProfilesKey(aEvent) {
if (AppConstants.platform != "macosx") { if (AppConstants.platform != "macosx") {
break; break;
} }
// fall through
case KeyEvent.DOM_VK_DELETE: case KeyEvent.DOM_VK_DELETE:
ConfirmDelete(); ConfirmDelete();
break; break;