Skip to content

Commit

Permalink
Make U+0000 a parse error in bogus comment and bogus DOCTYPE states
Browse files Browse the repository at this point in the history
Also make sure to reconsume instead of switching to the bogus
DOCTYPE state so that a U+0000 that causes the parser to enter the
bogus DOCTYPE state is itself caught as a parse error.

Fixes #2684.

Tests: html5lib/html5lib-tests#103
  • Loading branch information
zcorpan committed Aug 22, 2017
1 parent d967dc0 commit 5a6fef5
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -103083,7 +103083,9 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>Emit the comment. Emit an end-of-file token.</dd>

<dt>U+0000 NULL</dt>
<dd>Append a U+FFFD REPLACEMENT CHARACTER character to the comment token's data.</dd>
<dd>This is an <span
data-x="parse-error-unexpected-null-character">unexpected-null-character</span> <span>parse
error</span>. Append a U+FFFD REPLACEMENT CHARACTER character to the comment token's data.</dd>

<dt>Anything else</dt>
<dd>Append the <span>current input character</span> to the comment token's data.</dd>
Expand Down Expand Up @@ -103478,7 +103480,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<p>Otherwise, this is an <span
data-x="parse-error-invalid-character-sequence-after-doctype-name">invalid-character-sequence-after-doctype-name</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</p>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</p>

</dd>

Expand Down Expand Up @@ -103525,7 +103527,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>This is a <span
data-x="parse-error-missing-quote-before-doctype-public-identifier">missing-quote-before-doctype-public-identifier</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</dd>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</dd>

</dl>

Expand Down Expand Up @@ -103566,7 +103568,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>This is a <span
data-x="parse-error-missing-quote-before-doctype-public-identifier">missing-quote-before-doctype-public-identifier</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</dd>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</dd>

</dl>

Expand Down Expand Up @@ -103674,7 +103676,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>This is a <span
data-x="parse-error-missing-quote-before-doctype-system-identifier">missing-quote-before-doctype-system-identifier</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</dd>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</dd>

</dl>

Expand Down Expand Up @@ -103712,7 +103714,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>This is a <span
data-x="parse-error-missing-quote-before-doctype-system-identifier">missing-quote-before-doctype-system-identifier</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</dd>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</dd>

</dl>

Expand Down Expand Up @@ -103757,7 +103759,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>This is a <span
data-x="parse-error-missing-quote-before-doctype-system-identifier">missing-quote-before-doctype-system-identifier</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</dd>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</dd>

</dl>

Expand Down Expand Up @@ -103798,7 +103800,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dd>This is a <span
data-x="parse-error-missing-quote-before-doctype-system-identifier">missing-quote-before-doctype-system-identifier</span>
<span>parse error</span>. Set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks
flag</i> to <i>on</i>. Switch to the <span>bogus DOCTYPE state</span>.</dd>
flag</i> to <i>on</i>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>.</dd>

</dl>

Expand All @@ -103815,7 +103817,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dt>U+0000 NULL</dt>
<dd>This is an <span
data-x="parse-error-unexpected-null-character">unexpected-null-character</span> <span>parse
error</span>.Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's
error</span>. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE token's
system identifier.</dd>

<dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
Expand Down Expand Up @@ -103893,8 +103895,9 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dt>Anything else</dt>
<dd>This is an <span
data-x="parse-error-unexpected-character-after-doctype-system-identifier">unexpected-character-after-doctype-system-identifier</span>
<span>parse error</span>. Switch to the <span>bogus DOCTYPE state</span>. (This does <em>not</em>
set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks flag</i> to <i>on</i>.)</dd>
<span>parse error</span>. <span>Reconsume</span> in the <span>bogus DOCTYPE state</span>. (This
does <em>not</em> set the DOCTYPE token's <i data-x="force-quirks flag">force-quirks flag</i> to
<i>on</i>.)</dd>

</dl>

Expand All @@ -103908,6 +103911,11 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
<dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
<dd>Switch to the <span>data state</span>. Emit the DOCTYPE token.</dd>

<dt>U+0000 NULL</dt>
<dd>This is an <span
data-x="parse-error-unexpected-null-character">unexpected-null-character</span> <span>parse
error</span>. Ignore the character.</dd>

<dt>EOF</dt>
<dd>Emit the DOCTYPE token. Emit an end-of-file token.</dd>

Expand Down

0 comments on commit 5a6fef5

Please sign in to comment.