Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#61831 closed defect (bug) (fixed)

HTML API: Unclosed "funky comment" may not pause at incomplete token

Reported by: jonsurrell's profile jonsurrell Owned by: jonsurrell's profile jonsurrell
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.5
Component: HTML API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The HTML Tag Processor may report ::paused_at_incomplete_token() === true correctly when the HTML ends in an open "funky comment."

The HTML </# should be handled the same as </# , in both cases a funky comment has been opened but no closer is found before the HTML document ends. Both cases should both be treated as incomplete input, however the former case (with no trailing space) does not report an incomplete token.

Change History (8)

#1 @jonsurrell
18 months ago

I've confirmed this in 6.5, but the behavior may have existed earlier.

This ticket was mentioned in PR #7146 on WordPress/wordpress-develop by @jonsurrell.


18 months ago
#2

  • Keywords has-patch has-unit-tests added
  • Fix an issue where </# is not treated as incomplete input but </# is. Both should be incomplete input.
  • Add a test for the issue.

---

The HTML Tag Processor may report ::paused_at_incomplete_token() === true correctly when the HTML ends in an open "funky comment."

The HTML </# should be handled the same as </# , in both cases a funky comment has been opened but no closer is found before the HTML document ends. Both cases should both be treated as incomplete input, however the former case (with no trailing space) does not report an incomplete token.

Trac ticket: https://core.trac.wordpress.org/ticket/61831

#3 @jonsurrell
18 months ago

This was discovered by the HTML5lib-tests full HTML API parser tests, in progress in https://github.com/WordPress/wordpress-develop/pull/7117.

Last edited 18 months ago by jonsurrell (previous) (diff)

This ticket was mentioned in PR #7117 on WordPress/wordpress-develop by @jonsurrell.


18 months ago
#4

Trac ticket: Core-61646

Previously, the html5lib tests have only run in the fragment parser mode, but in #6977 a full parser was introduced to the HTML API. In this patch, the html5lib tests are running in the full parser mode where applicable.

#7146 is merged here and should be landed first.

- Tests: 609, Assertions: 405, Skipped: 204.
+ Tests: 1498, Assertions: 787, Skipped: 711.

This vastly increases the tests that are used from HTML5lib-tests from 609 to 1498! It's helped to discover two issues:

#5 @dmsnell
18 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 58858:

HTML API: Truncated funky comments should cause the Tag Processor to pause.

A state change was missing in the Tag Processor when the input is too short to
find a comment closer after an opened funky comment. This patch fixes a issue
where </# does not correctly report incomplete input, but </# does.

Developed in https://github.com/wordpress/wordpress-develop/pull/7146
Discussed in https://core.trac.wordpress.org/ticket/61831

Props: jonsurrell.
Fixes #61831.

#7 @sabernhardt
18 months ago

  • Milestone changed from Awaiting Review to 6.7
Note: See TracTickets for help on using tickets.