Closed Bug 334821 Opened 18 years ago Closed 18 years ago

CDATA handling is wrong

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

()

Details

(Keywords: fixed1.8.0.5, fixed1.8.1)

Attachments

(2 files, 1 obsolete file)

XPath states: "Each character within a CDATA section is treated as character data. Thus, <![CDATA[<]]> in the source document will treated the same as &lt;. Both will result in a single < character in a text node in the tree. Thus, a CDATA section is treated as if the <![CDATA[ and ]]> were removed and every occurrence of < and & were replaced by &lt; and &amp; respectively." [http://www.w3.org/TR/xpath#section-Text-Nodes] That's not how we handle it right now.
Attached file Testcase
Is this as a duplicate of 305242? CDATA markup in html/xhtml creates a dom comment node with leading text (approx) " CDATA ".
This has nothing to do with bug 305242, since that bug is about tag-soup and this bug isn't really using tag-soup. So has someone tried tracing the code to see where this goes wrong?
(In reply to comment #3) > This has nothing to do with bug 305242, since that bug is about tag-soup and > this bug isn't really using tag-soup. > > So has someone tried tracing the code to see where this goes wrong? This is an XForms bug, we specifically search for text nodes only.
Attached patch Patch (obsolete) — Splinter Review
nsXFormsUtils::GetNodeValue() should treat text and cdata nodes equally.
Assignee: aaronr → allan
Status: NEW → ASSIGNED
Attachment #220787 - Flags: review?(Olli.Pettay)
Attachment #220787 - Flags: review?(aaronr)
Attachment #220787 - Flags: review?(Olli.Pettay)
Attachment #220787 - Flags: review+
Might I recommend one change? Add all known types that don't have a string value defined explicitly in the switch. Make the default case assert about an unknown node type. This way when we add other node types to Gecko you'll be able to catch issues...
(In reply to comment #6) > Might I recommend one change? Add all known types that don't have a string > value defined explicitly in the switch. Make the default case assert about an > unknown node type. This way when we add other node types to Gecko you'll be > able to catch issues... Good idea. Thx.
Attachment #220787 - Flags: review?(aaronr)
Attached patch Patch v2Splinter Review
As bz suggested, explicitly check for node types. While I was at it: * use EmptyString() instead of Truncate() * initialize value to the empty string, in case something goes haywire in the GetNodeValue() calls * do not return inside the switch. Maybe it's just me, but it hurts my eyes
Attachment #220787 - Attachment is obsolete: true
Attachment #220794 - Flags: review?(Olli.Pettay)
Attachment #220794 - Flags: review?(aaronr)
Attachment #220794 - Flags: review?(Olli.Pettay)
Attachment #220794 - Flags: review+
Attachment #220794 - Flags: review?(aaronr) → review+
Fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Keywords: fixed1.8.1
Keywords: fixed1.8.0.5
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: