Closed Bug 559303 Opened 14 years ago Closed 9 years ago

[HTML5] Consolidate strBuf and longStrBuf use in the tokenizer

Categories

(Core :: DOM: HTML Parser, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

It is unnecessary to have two growable buffers in the HTML5 tokenizer. There should be only one growable buffer and a fixed-size buffer for dealing with the case of avoiding losing the data following an unterminated named character reference that is also a prefix of another named character reference when tokenizing an attribute value. (e.g. foo="&notiX")
Summary: [HTML5] Consolidate strBuf and langStrBuf use in the tokenizer → [HTML5] Consolidate strBuf and longStrBuf use in the tokenizer
Blocks: 561311
Attached patch htmlparser repo patch (obsolete) — Splinter Review
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Attached patch m-c patch (obsolete) — Splinter Review
The javadocs that this patch leaves out-of-date are fixed in the last part of bug 489820.
Blocks: 1029671
Attachment #8625698 - Flags: review?(wchen)
Comment on attachment 8625699 [details] [diff] [review]
m-c patch

See bug 1029671 comment 36 for the big picture of the whole queue and about landing.
Attachment #8625699 - Flags: review?(wchen)
Comment on attachment 8625698 [details] [diff] [review]
htmlparser repo patch

Review of attachment 8625698 [details] [diff] [review]:
-----------------------------------------------------------------

::: src/nu/validator/htmlparser/impl/Tokenizer.java
@@ +816,5 @@
> +            charRefBuf = newBuf;
> +        }
> +        charRefBuf[charRefBufLen++] = c;
> +    }
> +    

Trailing whitespace here

@@ +831,5 @@
> +                tokenHandler.characters(charRefBuf, 0, charRefBufLen);
> +            }
> +        }
> +    }
> +    

and here.

@@ +3185,3 @@
>                              if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
> +                                for (int i = charRefBufMark; i < charRefBufLen; i++) {
> +                                    appendStrBuf(charRefBuf[i]);

Slightly unrelated, but it looks like we can replace the for loop with the alternate appendStrBuf that takes buffer/offset/length.

@@ +6415,3 @@
>                              if ((returnState & DATA_AND_RCDATA_MASK) != 0) {
> +                                for (int i = charRefBufMark; i < charRefBufLen; i++) {
> +                                    appendStrBuf(charRefBuf[i]);

Same for this for loop.
Attachment #8625698 - Flags: review?(wchen) → review+
Comment on attachment 8625699 [details] [diff] [review]
m-c patch

This stuff should be regenerated after making the changes to the java file.
Attachment #8625699 - Flags: review?(wchen) → review+
Thanks. Attaching revised patches for the record.
Attachment #8625698 - Attachment is obsolete: true
Attachment #8644157 - Flags: review+
Attachment #8625699 - Attachment is obsolete: true
Attachment #8644158 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/7b3c5dd7ad30
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: