Closed Bug 903912 Opened 11 years ago Closed 11 years ago

Rip out most of the old parser

Categories

(Core :: DOM: HTML Parser, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: mrbkap, Assigned: mrbkap)

References

Details

Attachments

(4 files)

The old parser code is unused except for about:blank and yet it sits in the tree, hurting the eyes of passers-by, taking time to compile, and using otherwise-useful space on b2g (about 40-50kb by my measurements). It is much easier to generate blank documents than what we do now.

It would be ideal to switch things over to use the new HTML parser for about:blank, but while we wait, this makes life a little nicer for everybody.

I couldn't figure out a nice way to make small patches out of this. Hopefully it should be pretty easy, though, as the majority of it is simply removing never-reached code.
This patch also removes some code from nsElementTable.{h,cpp} in order to make
the DTD utils possible. Note that this won't compile alone because I forgot to
change nsHTMLContentSink here (I ended up doing that in the tokenizer removal
patch).

Henry, let me know if you don't want to review this and I'll find someone else to.
Attachment #788756 - Flags: review?(hsivonen)
This allowed me to get rid of the DTD utils entirely (which involved moving
some stuff to nsElementTable temporarily). Unlike the DTD patch, the tokenizer
literally does nothing now.
Note the one bug that tryserver found in my patches: If we are given a content
sink that isn't an nsIHTMLContentSink, we need to return
NS_ERROR_HTMLPARSER_STOPPARSING from CNavDTD::BuildModel. This happens due to
(I think) XBL files that don't exist. I haven't tracked down why yet, but I'll
file a followup on fixing that.
Attachment #788758 - Flags: review?(hsivonen)
There's only one user of nsElementTable: the HTML editor. We should fix that,
but in the meantime, this strips the element table down to answer only the
questions on nsIParserService. I generated most of this diff (the actual table
changes) with a python script that I'm happy to attach here if wanted.
Attachment #788759 - Flags: review?(hsivonen)
Attachment #788757 - Flags: review?(hsivonen)
And for the record:

$ git diff master | diffstat
 28 files changed, 650 insertions(+), 12023 deletions(-)
Assignee: nobody → mrbkap
Comment on attachment 788756 [details] [diff] [review]
Gut CNavDTD and the DTD utils.

I assume that you tested that about:blank still gets a body element generated with this patch applied.
Attachment #788756 - Flags: review?(hsivonen) → review+
Attachment #788757 - Flags: review?(hsivonen) → review+
Comment on attachment 788758 [details] [diff] [review]
A small cleanup patch to make the DTD even simpler.

Never mind. I see that this patch takes care of what I was wondering about in my previous comment.
Attachment #788758 - Flags: review?(hsivonen) → review+
Attachment #788759 - Flags: review?(hsivonen) → review+
Further editor dependencies are handled in bug 729046.

Thank you!
https://hg.mozilla.org/mozilla-central/rev/0bcfd14b61e8
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Blocks: 496779
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: