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

VERIFIED FIXED

Status

()

Core
HTML: Parser
VERIFIED FIXED
17 years ago
17 years ago

People

(Reporter: bbaetz, Assigned: dbaron)

Tracking

({regression})

Trunk
regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
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?
(Reporter)

Comment 1

17 years ago
Created attachment 52386 [details] [diff] [review]
bz's patch
(Reporter)

Comment 2

17 years ago
Without this patch, we get NS_ERROR_HTMLPARSER_UNRESOLVEDDTD returned from the
document load.
(Assignee)

Comment 3

17 years ago
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?
(Reporter)

Comment 4

17 years ago
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.
(Assignee)

Comment 5

17 years ago
Can you prove that this patch will never cause us to do sniffing of a known mime
type?
(Reporter)

Comment 6

17 years ago
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
Last Resolved: 17 years ago
Resolution: --- → FIXED
(Reporter)

Comment 7

17 years ago
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.