CNavDTD shouldn't have a DTD and we shouldn't try to QI to it. bug 327980, r+sr=jst

git-svn-id: svn://10.0.0.236/trunk@190770 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com
2006-02-22 00:00:38 +00:00
parent 39fe796f2f
commit 3ad008c538
3 changed files with 14 additions and 19 deletions

View File

@@ -113,7 +113,7 @@ static const char kInvalidTagStackPos[] = "Error: invalid tag stack position";
#define NS_DTD_FLAG_HAS_MAIN_CONTAINER (NS_DTD_FLAG_HAD_BODY | \
NS_DTD_FLAG_HAD_FRAMESET)
NS_IMPL_ISUPPORTS2(CNavDTD, nsIDTD, CNavDTD)
NS_IMPL_ISUPPORTS1(CNavDTD, nsIDTD)
CNavDTD::CNavDTD()
: mMisplacedContent(0),

View File

@@ -107,11 +107,6 @@
#include "nsDTDUtils.h"
#include "nsParser.h"
#define NS_INAVHTML_DTD_IID \
{0x5c5cce40, 0xcfd6, 0x11d1, \
{0xaa, 0xda, 0x00, 0x80, 0x5f, 0x8a, 0x3e, 0x14}}
class nsIHTMLContentSink;
class nsIParserNode;
class nsDTDContext;
@@ -166,8 +161,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDTD
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INAVHTML_DTD_IID);
private:
/**
* This method is called to determine whether or not a tag

View File

@@ -1505,20 +1505,22 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
// was no <body> in the context.
// XXX This is extremely ugly. Maybe CNavDTD should have FlushMisplaced()?
NS_ASSERTION(mParserContext, "Parsing didn't create a parser context?");
nsCOMPtr<CNavDTD> dtd = do_QueryInterface(mParserContext->mDTD);
if (dtd) {
CStartToken bodyToken(NS_LITERAL_STRING("BODY"), eHTMLTag_body);
nsCParserNode bodyNode(&bodyToken, 0);
CNavDTD* dtd = NS_STATIC_CAST(CNavDTD*,
NS_STATIC_CAST(nsIDTD*,
mParserContext->mDTD));
NS_ASSERTION(dtd, "How did we parse anything without a dtd?");
dtd->OpenContainer(&bodyNode, eHTMLTag_body);
CStartToken bodyToken(NS_LITERAL_STRING("BODY"), eHTMLTag_body);
nsCParserNode bodyNode(&bodyToken, 0);
// Now parse the flushed out tags.
result = BuildModel();
if (NS_FAILED(result)) {
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
return result;
}
dtd->OpenContainer(&bodyNode, eHTMLTag_body);
// Now parse the flushed out tags.
result = BuildModel();
if (NS_FAILED(result)) {
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
return result;
}
// Now that we've flushed all of the tags out of the body, we have to make