Bug 1319410 fixup - Stay in the COMMENT_LESSTHAN state, annotate fall-throughs. r=smaug
authorMichael[tm] Smith <mike@w3.org>
Mon, 16 Aug 2021 05:01:10 +0000
changeset 589001 0b241b7f07e9e2a38841a86f044575fef4397fc9
parent 589000 5b33e3f54b589b5935d8d3d573cbff239f90f5be
child 589002 d75852f907a6cae2baad0bac15b4382fcda5bd48
push id38710
push userdluca@mozilla.com
push dateMon, 16 Aug 2021 21:53:09 +0000
treeherdermozilla-central@405034da0bdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1319410
milestone93.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 1319410 fixup - Stay in the COMMENT_LESSTHAN state, annotate fall-throughs. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D82163
parser/html/javasrc/Tokenizer.java
parser/html/nsHtml5Tokenizer.cpp
--- a/parser/html/javasrc/Tokenizer.java
+++ b/parser/html/javasrc/Tokenizer.java
@@ -2846,37 +2846,37 @@ public class Tokenizer implements Locato
                         c = checkChar(buf, pos);
                         switch (c) {
                             case '!':
                                 appendStrBuf(c);
                                 state = transition(state, Tokenizer.COMMENT_LESSTHAN_BANG, reconsume, pos);
                                 continue stateloop;
                             case '<':
                                 appendStrBuf(c);
-                                state = transition(state, Tokenizer.COMMENT_LESSTHAN, reconsume, pos);
-                                continue stateloop;
+                                continue;
                             case '-':
                                 appendStrBuf(c);
                                 state = transition(state, Tokenizer.COMMENT_END_DASH, reconsume, pos);
                                 continue stateloop;
                             case '\r':
                                 appendStrBufCarriageReturn();
                                 break stateloop;
                             case '\n':
                                 appendStrBufLineFeed();
                                 continue;
                             case '\u0000':
                                 c = '\uFFFD';
-                                // fall thru
+                                // CPPONLY: MOZ_FALLTHROUGH;
                             default:
                                 appendStrBuf(c);
                                 state = transition(state, Tokenizer.COMMENT, reconsume, pos);
                                 continue stateloop;
                         }
                     }
+                    // CPPONLY: MOZ_FALLTHROUGH;
                 case COMMENT_LESSTHAN_BANG:
                     for (;;) {
                         if (++pos == endPos) {
                             break stateloop;
                         }
                         c = checkChar(buf, pos);
                         switch (c) {
                             case '-':
@@ -2890,23 +2890,24 @@ public class Tokenizer implements Locato
                             case '\r':
                                 appendStrBufCarriageReturn();
                                 break stateloop;
                             case '\n':
                                 appendStrBufLineFeed();
                                 continue;
                             case '\u0000':
                                 c = '\uFFFD';
-                                // fall thru
+                                // CPPONLY: MOZ_FALLTHROUGH;
                             default:
                                 appendStrBuf(c);
                                 state = transition(state, Tokenizer.COMMENT, reconsume, pos);
                                 continue stateloop;
                         }
                     }
+                    // CPPONLY: MOZ_FALLTHROUGH;
                 case COMMENT_LESSTHAN_BANG_DASH:
                     for (;;) {
                         if (++pos == endPos) {
                             break stateloop;
                         }
                         c = checkChar(buf, pos);
                         switch (c) {
                             case '-':
@@ -2920,23 +2921,24 @@ public class Tokenizer implements Locato
                             case '\r':
                                 appendStrBufCarriageReturn();
                                 break stateloop;
                             case '\n':
                                 appendStrBufLineFeed();
                                 continue;
                             case '\u0000':
                                 c = '\uFFFD';
-                                // fall thru
+                                // CPPONLY: MOZ_FALLTHROUGH;
                             default:
                                 appendStrBuf(c);
                                 state = transition(state, Tokenizer.COMMENT, reconsume, pos);
                                 continue stateloop;
                         }
                     }
+                    // CPPONLY: MOZ_FALLTHROUGH;
                 case COMMENT_LESSTHAN_BANG_DASH_DASH:
                     for (;;) {
                         if (++pos == endPos) {
                             break stateloop;
                         }
                         c = checkChar(buf, pos);
                         switch (c) {
                             case '>':
@@ -2959,31 +2961,32 @@ public class Tokenizer implements Locato
                             case '\n':
                                 errNestedComment();
                                 adjustDoubleHyphenAndAppendToStrBufAndErr(c, reportedConsecutiveHyphens);
                                 reportedConsecutiveHyphens = true;
                                 state = transition(state, Tokenizer.COMMENT, reconsume, pos);
                                 continue;
                             case '\u0000':
                                 c = '\uFFFD';
-                                // fall thru
+                                // CPPONLY: MOZ_FALLTHROUGH;
                             case '!':
                                 errNestedComment();
                                 adjustDoubleHyphenAndAppendToStrBufAndErr(c, reportedConsecutiveHyphens);
                                 reportedConsecutiveHyphens = true;
                                 state = transition(state, Tokenizer.COMMENT_END_BANG, reconsume, pos);
                                 continue stateloop;
                             default:
                                 errNestedComment();
                                 adjustDoubleHyphenAndAppendToStrBufAndErr(c, reportedConsecutiveHyphens);
                                 reportedConsecutiveHyphens = true;
                                 state = transition(state, Tokenizer.COMMENT_END, reconsume, pos);
                                 continue stateloop;
                         }
                     }
+                    // CPPONLY: MOZ_FALLTHROUGH;
                     // XXX reorder point
                 case COMMENT_START_DASH:
                     if (++pos == endPos) {
                         break stateloop;
                     }
                     c = checkChar(buf, pos);
                     /*
                      * Comment start dash state
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -1512,20 +1512,17 @@ stateloop:
               appendStrBuf(c);
               state = P::transition(mViewSource.get(),
                                     nsHtml5Tokenizer::COMMENT_LESSTHAN_BANG,
                                     reconsume, pos);
               NS_HTML5_CONTINUE(stateloop);
             }
             case '<': {
               appendStrBuf(c);
-              state = P::transition(mViewSource.get(),
-                                    nsHtml5Tokenizer::COMMENT_LESSTHAN,
-                                    reconsume, pos);
-              NS_HTML5_CONTINUE(stateloop);
+              continue;
             }
             case '-': {
               appendStrBuf(c);
               state = P::transition(mViewSource.get(),
                                     nsHtml5Tokenizer::COMMENT_END_DASH,
                                     reconsume, pos);
               NS_HTML5_CONTINUE(stateloop);
             }
@@ -1534,25 +1531,27 @@ stateloop:
               NS_HTML5_BREAK(stateloop);
             }
             case '\n': {
               appendStrBufLineFeed();
               continue;
             }
             case '\0': {
               c = 0xfffd;
+              [[fallthrough]];
             }
             default: {
               appendStrBuf(c);
               state = P::transition(mViewSource.get(),
                                     nsHtml5Tokenizer::COMMENT, reconsume, pos);
               NS_HTML5_CONTINUE(stateloop);
             }
           }
         }
+        [[fallthrough]];
       }
       case COMMENT_LESSTHAN_BANG: {
         for (;;) {
           if (++pos == endPos) {
             NS_HTML5_BREAK(stateloop);
           }
           c = checkChar(buf, pos);
           switch (c) {
@@ -1575,25 +1574,27 @@ stateloop:
               NS_HTML5_BREAK(stateloop);
             }
             case '\n': {
               appendStrBufLineFeed();
               continue;
             }
             case '\0': {
               c = 0xfffd;
+              [[fallthrough]];
             }
             default: {
               appendStrBuf(c);
               state = P::transition(mViewSource.get(),
                                     nsHtml5Tokenizer::COMMENT, reconsume, pos);
               NS_HTML5_CONTINUE(stateloop);
             }
           }
         }
+        [[fallthrough]];
       }
       case COMMENT_LESSTHAN_BANG_DASH: {
         for (;;) {
           if (++pos == endPos) {
             NS_HTML5_BREAK(stateloop);
           }
           c = checkChar(buf, pos);
           switch (c) {
@@ -1617,25 +1618,27 @@ stateloop:
               NS_HTML5_BREAK(stateloop);
             }
             case '\n': {
               appendStrBufLineFeed();
               continue;
             }
             case '\0': {
               c = 0xfffd;
+              [[fallthrough]];
             }
             default: {
               appendStrBuf(c);
               state = P::transition(mViewSource.get(),
                                     nsHtml5Tokenizer::COMMENT, reconsume, pos);
               NS_HTML5_CONTINUE(stateloop);
             }
           }
         }
+        [[fallthrough]];
       }
       case COMMENT_LESSTHAN_BANG_DASH_DASH: {
         for (;;) {
           if (++pos == endPos) {
             NS_HTML5_BREAK(stateloop);
           }
           c = checkChar(buf, pos);
           switch (c) {
@@ -1677,16 +1680,17 @@ stateloop:
                   c, reportedConsecutiveHyphens);
               reportedConsecutiveHyphens = true;
               state = P::transition(mViewSource.get(),
                                     nsHtml5Tokenizer::COMMENT, reconsume, pos);
               continue;
             }
             case '\0': {
               c = 0xfffd;
+              [[fallthrough]];
             }
             case '!': {
               if (P::reportErrors) {
                 errNestedComment();
               }
               adjustDoubleHyphenAndAppendToStrBufAndErr(
                   c, reportedConsecutiveHyphens);
               reportedConsecutiveHyphens = true;
@@ -1704,16 +1708,17 @@ stateloop:
               reportedConsecutiveHyphens = true;
               state =
                   P::transition(mViewSource.get(),
                                 nsHtml5Tokenizer::COMMENT_END, reconsume, pos);
               NS_HTML5_CONTINUE(stateloop);
             }
           }
         }
+        [[fallthrough]];
       }
       case COMMENT_START_DASH: {
         if (++pos == endPos) {
           NS_HTML5_BREAK(stateloop);
         }
         c = checkChar(buf, pos);
         switch (c) {
           case '-': {