Skip to content

Commit 5a6fef5

Browse files
committed
Make U+0000 a parse error in bogus comment and bogus DOCTYPE states
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 whatwg#2684. Tests: html5lib/html5lib-tests#103
1 parent d967dc0 commit 5a6fef5

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

source

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103083,7 +103083,9 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
103083103083
<dd>Emit the comment. Emit an end-of-file token.</dd>
103084103084

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

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

103483103485
</dd>
103484103486

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

103530103532
</dl>
103531103533

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

103571103573
</dl>
103572103574

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

103679103681
</dl>
103680103682

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

103717103719
</dl>
103718103720

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

103762103764
</dl>
103763103765

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

103803103805
</dl>
103804103806

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

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

103899103902
</dl>
103900103903

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

103914+
<dt>U+0000 NULL</dt>
103915+
<dd>This is an <span
103916+
data-x="parse-error-unexpected-null-character">unexpected-null-character</span> <span>parse
103917+
error</span>. Ignore the character.</dd>
103918+
103911103919
<dt>EOF</dt>
103912103920
<dd>Emit the DOCTYPE token. Emit an end-of-file token.</dd>
103913103921

0 commit comments

Comments
 (0)