Closed Bug 103483 Opened 23 years ago Closed 23 years ago

nsWellFormedDTD::CanParse() doesn't recognise any xml file

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: bbaetz, Assigned: dbaron)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

This change was made as part of the doctype fixes dbaron did a couple of weeks
ago (see url field for bonsai log).

Previously, we returned eValidDetect if "<?xml " was in the buffer, and also set
the mimetype if we didn't have one. This has changed to only return eValidDetect
if "<?xml " was in the buffer _and_ we don't have a mimetype.

This breaks the display of .svg documents (on the branch) bz came up with a
patch which I'll attach, basically restoring the original behaviour. This fixes
the problem for me.

I think that this is valid, since if we get here then we registered the type in
nsContentDLF (as svg has done on the branch). Is that correct?
Attached patch bz's patchSplinter Review
Without this patch, we get NS_ERROR_HTMLPARSER_UNRESOLVEDDTD returned from the
document load.
We shouldn't be sniffing the content of documents when we have a mime type,
ever.  That's just wrong.

What's the mime type for SVG?  Can't you just make the parser recognize that?
But we're not sniffing, and I agree that we shouldn't be. The appropriate mime
type has been added to nsContentDLF.cpp (registering us from the category
manager), and we're called from within nsSVGDocument.cpp. By the time we're
inside the parser, we've already decided that we know something about the file
type, haven't we? The patch just says: "The dtd can be used on files that I know
about, if they are XML".
The other option is to just add SVG to the list of mimetypes above, I guess. But
I'm trying to avoid having:

#ifdef MOZ_SVG
|| foo(SVGMimetype)
#endif

scattered all over the tree. I'll admit that I'm largely failing, though.
Can you prove that this patch will never cause us to do sniffing of a known mime
type?
OK, after talking with dbaron, I've just added svg to the list of known parsable
mimetypes on the SVG branch.

marking fixed.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
daniele confirmed that this fixed it on the branch, but doesn't have canedit
perms on bugzilla.

Marking VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: