Bug 601604 - Emit ]] or ] when ]]EOF or ]EOF appears in a CDATA section in text/html. rs=jonas, a=jst.
authorHenri Sivonen <hsivonen@iki.fi>
Thu, 07 Oct 2010 10:27:16 +0300
changeset 55841 6affa4d71b64b4b628a3555db0e9667690dce606
parent 55840 aacd84d91b663722a15a2a475f370d063d2e59e4
child 55842 331189af3a52064a51b214c5d27c68d3315720f6
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonas, jst
bugs601604
milestone2.0b8pre
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 601604 - Emit ]] or ] when ]]EOF or ]EOF appears in a CDATA section in text/html. rs=jonas, a=jst.
parser/html/javasrc/Tokenizer.java
parser/html/nsHtml5Tokenizer.cpp
parser/htmlparser/tests/mochitest/html5lib_tree_construction/pending-spec-changes.dat
parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests21.dat
--- a/parser/html/javasrc/Tokenizer.java
+++ b/parser/html/javasrc/Tokenizer.java
@@ -6466,16 +6466,22 @@ public class Tokenizer implements Locato
                         continue;
                     } else {
                         errCharRefLacksSemicolon();
                     }
                     // WARNING previous state sets reconsume
                     handleNcrValue(returnState);
                     state = returnState;
                     continue;
+                case CDATA_RSQB:
+                    tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 1);
+                    break eofloop;
+                case CDATA_RSQB_RSQB:
+                    tokenHandler.characters(Tokenizer.RSQB_RSQB, 0, 2);
+                    break eofloop;
                 case DATA:
                 default:
                     break eofloop;
             }
         }
         // case DATA:
         /*
          * EOF Emit an end-of-file token.
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -3679,16 +3679,24 @@ nsHtml5Tokenizer::eof()
           emitOrAppendStrBuf(returnState);
           state = returnState;
           continue;
         }
         handleNcrValue(returnState);
         state = returnState;
         continue;
       }
+      case NS_HTML5TOKENIZER_CDATA_RSQB: {
+        tokenHandler->characters(nsHtml5Tokenizer::RSQB_RSQB, 0, 1);
+        NS_HTML5_BREAK(eofloop);
+      }
+      case NS_HTML5TOKENIZER_CDATA_RSQB_RSQB: {
+        tokenHandler->characters(nsHtml5Tokenizer::RSQB_RSQB, 0, 2);
+        NS_HTML5_BREAK(eofloop);
+      }
       case NS_HTML5TOKENIZER_DATA:
       default: {
         NS_HTML5_BREAK(eofloop);
       }
     }
   }
   eofloop_end: ;
   tokenHandler->eof();
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/pending-spec-changes.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/pending-spec-changes.dat
@@ -1,17 +1,8 @@
 #data
-<svg><![CDATA[]]
+Placeholder
 #errors
 #document
 | <html>
 |   <head>
 |   <body>
-|     <svg svg>
-
-#data
-<svg><![CDATA[]
-#errors
-#document
-| <html>
-|   <head>
-|   <body>
-|     <svg svg>
+|     "Placeholder"
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests21.dat
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/tests21.dat
@@ -82,16 +82,36 @@
 #document
 | <html>
 |   <head>
 |   <body>
 |     <svg svg>
 |       "]] >"
 
 #data
+<svg><![CDATA[]]
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <svg svg>
+|       "]]"
+
+#data
+<svg><![CDATA[]
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <svg svg>
+|       "]"
+
+#data
 <svg><![CDATA[]>a
 #errors
 #document
 | <html>
 |   <head>
 |   <body>
 |     <svg svg>
 |       "]>a"