Bugzilla – Bug 806
needToDropLF flag not reset if bare LF encountered
Last modified: 2011-01-06 00:22:57 CET
>if (needToDropLF) { > if (buf[start] == '\n') { > start++; > length--; > if (length == 0) { > return; > } > } > needToDropLF = false; >} If a bare LF is encountered (length == 1) then the needToDropLF flag is never reset. In this case multiple LF characters can get dropped. This is usually triggered because CR characters are is handled by emitting a bare LF and setting a flag to consume the next input character if it is an LF, but it also applies if the first LF of a PRE or TEXTAREA element is immediately followed by a CR, since that causes the buffer to be flushed. I don't understand why emitXXX needs to flush the buffer and then handle a single character instead of appending the character to the buffer, but that's a side issue and not directly relevant to the bug.
Created attachment 189 [details] Proposed patch
Thanks. r=hsivonen. OK to use 'Neil Rashbrook <neil@parkwaycc.co.uk>' (as already seen on hg.mozilla.org) as the hg committer of record for landing this?
(In reply to comment #2) > OK to use 'Neil Rashbrook <neil@parkwaycc.co.uk>' (as already seen on > hg.mozilla.org) as the hg committer of record for landing this? Sure, of course.
Landed. Thanks. http://hg.mozilla.org/projects/htmlparser/rev/4e0016ea4674
An HTML LF entity is another way to generate a bare LF.