Closed Bug 1309326 Opened 8 years ago Closed 8 years ago

HTML serializer handling of <br> (and other empty tags) inside <pre> is all buggy

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1308675 +++

Consider something like this:

  <pre>Some text<br>More text</pre>

When we run that through our HTML serializer, we increment mPreLevel at the <pre>, increment it again at the <br> start, do NOT decrement it at the <br> end because it's an empty tag, and then end up with a nonzero mPreLevel forever after.

And our serializer tests don't catch this, because they run with a display:none iframe, where we never end up touching mPreLevel at all, because it's style-dependent.

Yes, just like bug 1308675 but for the HTML serializer.  Sorry I didn't notice it immediately.  :(
The test change makes sure the test actually tests this codepath. The resulting
test expectation changes are all due to the test now recognizing <pre> as preformatted.
Attachment #8799905 - Flags: review?(ehsan)
Attachment #8799905 - Flags: review?(ehsan) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1ae11d588928
Fix the HTML serializer's handling of self-closing tags inside <pre> to correctly keep track of our mPreLevel. r=ehsan
https://hg.mozilla.org/mozilla-central/rev/1ae11d588928
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: