Closed Bug 209271 Opened 23 years ago Closed 23 years ago

Dodgy SetCaseSensitive() call in nsDOMCSSAttrDeclaration.cpp

Categories

(Core :: DOM: CSS Object Model, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla1.5alpha

People

(Reporter: ian, Assigned: bzbarsky)

Details

Attachments

(1 file)

nsDOMCSSAttrDeclaration.cpp contains the following code: // look up our namespace. If we're XHTML, we need to be case-sensitive // Otherwise, we should not be (*aCSSParser)->SetCaseSensitive(nodeInfo->NamespaceEquals(kNameSpaceID_XHTML)); This seems wrong. We should be case sensitive in any namespace _other_ than non-XML HTML, not _just_ case sensitive in the case of XHTML. Note that IMHO, if the code is relying on some other constant (like, this code only gets called for XHTML and HTML, but not, e.g., SVG) then a comment should be added to this effect.
Attached patch PatchSplinter Review
This code is indeed relying on the fact that it's only called for HTML. That said, this is a bit safer... Of course all this only matters when you have a node that can no longer reach its ownerDocument (so that it's not getting a CSS parser via the loader), which is kinda hard to arrange... ;)
Comment on attachment 126105 [details] [diff] [review] Patch The other option is to assert that in fact mContent->IsContentOfType(nsIContent::eHTML)
Attachment #126105 - Flags: superreview?(dbaron)
Attachment #126105 - Flags: review?(dbaron)
.
Assignee: dom_bugs → bzbarsky
OS: Windows 2000 → All
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla1.5alpha
Attachment #126105 - Flags: superreview?(dbaron)
Attachment #126105 - Flags: superreview+
Attachment #126105 - Flags: review?(dbaron)
Attachment #126105 - Flags: review+
fixed.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
+ // If we are not HTML, we need to be case-sensitive. Otherwise, Look up our + // namespace. If we're XHTML, we need to be case-sensitive Otherwise, we + // should not be That's still a confusing comment, IMHO. (It requires that you realise that XHTML is also HTML.) What about something like "If we are XML, we are case sensitive on all attributes. Otherwise, we're HTML, and we should only be case sensitive on those that the HTML spec says are [CS]." But yeah, whatever. It's only a comment in a rarely used piece of code. :-)
> (It requires that you realise that XHTML is also HTML.) If you don't know that about nsIContent objects in Mozilla, you probably should not be touching this code. ;)
> What about something like "If we are XML, we are case sensitive on all > attributes. Otherwise, we're HTML, and we should only be case sensitive on those Since you're picking comment nits: "... we should be case sensitive only on those ...." /be
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: