Closed Bug 125090 Opened 23 years ago Closed 22 years ago

Bad tag enum passed to CNavDTD::IntTagToStringTag()!!: 'str_ptr',

Categories

(Core :: DOM: HTML Parser, enhancement)

x86
FreeBSD
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

Details

Attachments

(2 files, 1 obsolete file)

debug freebsd cvs build.

we're using a custom tag.

#2  0x28316a1d in nsDebug::Assertion (aStr=0x280fb5a0 "nsDependentString must wrap a non-NULL buffer", aExpr=0x280fb58e "aPtr",
    aFile=0x280fb560 "../../dist/include/string/nsDependentString.h", aLine=54) at /home/timeless/mozilla/xpcom/glue/nsDebug.cpp:291
#3  0x280f106a in nsDependentString::Rebind (this=0xbfbfedac, aPtr=0x0) at ../../dist/include/string/nsDependentString.h:54
#4  0x280f091a in nsDependentString::nsDependentString (this=0xbfbfedac, aPtr=0x0) at ../../dist/include/string/nsDependentString.h:100
#5  0x2926b6bb in SinkContext::CloseContainer (this=0x8739980, aNode=@0x8808870)
    at /home/timeless/mozilla/content/html/document/src/nsHTMLContentSink.cpp:1539
(gdb) l
1534        if (mStack[mStackPos].mNumFlushed < childCount) {
1535    #ifdef NS_DEBUG
1536          // Tracing code
1537          nsCOMPtr<nsIDTD> dtd;
1538          mSink->mParser->GetDTD(getter_AddRefs(dtd));
1539          nsDependentString str(dtd->IntTagToStringTag(nsHTMLTag(nodeType)));
1540
1541          SINK_TRACE(SINK_TRACE_REFLOW,
1542                     ("SinkContext::CloseContainer: reflow on notifyImmediate tag=%s newIndex=%d stackPos=%d",
1543                      NS_LossyConvertUCS2toASCII(str).get(),
(gdb) p nodeType
$1 = eHTMLTag_userdefined

code flow needs to avoid 1539 when nodeType==(eHTMLTag_userdefined===0)

#6  0x292732d7 in HTMLContentSink::CloseContainer (this=0x8800c00, aNode=@0x8808870)
    at /home/timeless/mozilla/content/html/document/src/nsHTMLContentSink.cpp:3401
#7  0x288d6a5e in CNavDTD::CloseContainer (this=0x886be00, aNode=0x8808870, aTarget=eHTMLTag_userdefined, aClosedByStartTag=0)
    at /home/timeless/mozilla/htmlparser/src/CNavDTD.cpp:3558
#8  0x288d6b83 in CNavDTD::CloseContainersTo (this=0x886be00, anIndex=2, aTarget=eHTMLTag_userdefined, aClosedByStartTag=0)
    at /home/timeless/mozilla/htmlparser/src/CNavDTD.cpp:3594
#9  0x288d6f84 in CNavDTD::CloseContainersTo (this=0x886be00, aTarget=eHTMLTag_userdefined, aClosedByStartTag=0)
    at /home/timeless/mozilla/htmlparser/src/CNavDTD.cpp:3750
#10 0x288cf545 in CNavDTD::DidBuildModel (this=0x886be00, anErrorCode=0, aNotifySink=1, aParser=0x8746700, aSink=0x8800c00)
    at /home/timeless/mozilla/htmlparser/src/CNavDTD.cpp:609
#11 0x288e3d76 in nsParser::DidBuildModel (this=0x8746700, anErrorCode=0) at /home/timeless/mozilla/htmlparser/src/nsParser.cpp:1385
#12 0x288e4fbd in nsParser::ResumeParse (this=0x8746700, allowIteration=1, aIsFinalChunk=1, aCanInterrupt=1)
    at /home/timeless/mozilla/htmlparser/src/nsParser.cpp:1892
#13 0x288e6d3d in nsParser::OnStopRequest (this=0x8746700, request=0x8736500, aContext=0x0, status=0)
    at /home/timeless/mozilla/htmlparser/src/nsParser.cpp:2516
#14 0x28e5f3db in nsDocumentOpenInfo::OnStopRequest (this=0x86af1a0, request=0x8736500, aCtxt=0x0, aStatus=0)
    at /home/timeless/mozilla/uriloader/base/nsURILoader.cpp:253
Attached patch don't debug output for empty (obsolete) — Splinter Review
There's a second patch in there too, there's probably even a bug explaining it.
Reviewers can decide whether I commit both or just the top.
*** Bug 117299 has been marked as a duplicate of this bug. ***
Timeless:

 if (mStack[stackPos].mType) { 

means that if the current tag is not eHTMLTag_unknown. You should also check for
eHTMLTag_userdefined. So, may be the above line should be

if (mStack[stackPos].mType != eHTMLTag_unknown &&
    mStack[stackPos].mType != eHTMLTag_userdefined) { 

>There's a second patch in there too, there's probably even a bug explaining it.

|Don't| checkin your second patch. We need to find out what the real problem is.
With your patch we will just mask the problem.

Giving bug to timeless since he has done all the work.

-->timeless
Assignee: harishd → timeless
timeless and me talked about this on #mozilla. IMHO we shouldn't be using the 
enum at all to do the tag->string conversion since that'll never work for <foo> 
tags. It would be better to use

nsCOMPtr<nsIAtom> tag;
mStack[stackPos].mContent->GetTag(*getter_AddRefs(tag));
PRUnichar* tagChar;
tag->GetUnicode(&tagChar);
nsDependantString str(tagChar);

to get the string.
yeah sure :)
Blocks: 152015
Attached patch corrected patchSplinter Review
i've actually been running with the first part of this patch for months.  And
the second part is just like the first so :-)
Attachment #69974 - Attachment is obsolete: true
*** Bug 127742 has been marked as a duplicate of this bug. ***
Comment on attachment 88892 [details] [diff] [review]
corrected patch

ignore
@@ -3699,7 +3703,7 @@
Comment on attachment 88892 [details] [diff] [review]
corrected patch

r=bzbarsky
Attachment #88892 - Flags: review+
Comment on attachment 88892 [details] [diff] [review]
corrected patch

sr=jst
Attachment #88892 - Flags: superreview+
fixed
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
I just brought this change down from CVS. I am trapping at line 1921 under 
Win2K. mStack[mStackPos].mContent->GetTag(*getter_AddRefs(tag));

mStack[mStackPos].mContent is uninitialized.

I just clobbered content and I am rebuilding it right now to see if that helps.
Comment on attachment 89158 [details] [diff] [review]
fix small error caught by jonsmirl@yahoo.com

r=bzbarsky
Attachment #89158 - Flags: review+
Comment on attachment 89158 [details] [diff] [review]
fix small error caught by jonsmirl@yahoo.com

sr=jst
Attachment #89158 - Flags: superreview+
*** Bug 154382 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: