Closed Bug 265339 Opened 20 years ago Closed 20 years ago

nsCParserStartNode::~nsCParserStartNode asserts unnecessarily

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Assigned: mrbkap)

Details

Attachments

(1 file)

nsCParserStartNode::~nsCParserStartNode asserts to make sure it has an
allocator, but it only ever uses that allocator to delete its attributes. This
means that if you have the equivilant of:

{
  nsCParserStartNode node;
}

You will assert because mTokenAllocator is NULL. This will happen once bug
263083 is checked in, if you never view-source any pages that have errors on
them. Trivial patch coming up.
Attached patch patch v1Splinter Review
Only assert if we're actually going to use mTokenAllocator.
Assignee: parser → mrbkap
Status: NEW → ASSIGNED
Attachment #162764 - Flags: superreview?(peterv)
Attachment #162764 - Flags: review?(peterv)
Comment on attachment 162764 [details] [diff] [review]
patch v1

>Index: src/nsParserNode.h
>===================================================================
>RCS file: /cvsroot/mozilla/parser/htmlparser/src/nsParserNode.h,v
>retrieving revision 3.47
>diff -u -5 -p -r3.47 nsParserNode.h
>--- src/nsParserNode.h	23 Apr 2004 13:28:51 -0000	3.47
>+++ src/nsParserNode.h	20 Oct 2004 22:57:47 -0000
>@@ -294,11 +294,12 @@ public:
>                        nsNodeAllocator* aNodeAllocator = 0) 
>       : nsCParserNode(aToken, aTokenAllocator, aNodeAllocator), mAttributes(0) { }
> 
>     virtual ~nsCParserStartNode() 
>     {
>-      NS_ASSERTION(0 != mTokenAllocator, "Error: no token allocator");
>+      NS_ASSERTION(0 != mTokenAllocator || 0 == mAttributes.GetSize(),

I'd prefer

      NS_ASSERTION(mTokenAllocator || mAttributes.GetSize() == 0,
Attachment #162764 - Flags: superreview?(peterv)
Attachment #162764 - Flags: superreview+
Attachment #162764 - Flags: review?(peterv)
Attachment #162764 - Flags: review+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: