1
0
MozillaFirefox/358797.patch

38 lines
1.6 KiB
Diff

Index: parser/htmlparser/src/nsParser.cpp
===================================================================
RCS file: /cvsroot/mozilla/parser/htmlparser/src/nsParser.cpp,v
retrieving revision 3.370.4.4
diff -u -p -6 -r3.370.4.4 nsParser.cpp
--- parser/htmlparser/src/nsParser.cpp 13 Jul 2006 17:28:08 -0000 3.370.4.4
+++ parser/htmlparser/src/nsParser.cpp 1 Nov 2006 23:28:14 -0000
@@ -1870,19 +1870,27 @@ nsParser::ParseFragment(const nsAString&
if (NS_FAILED(result)) {
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
return result;
}
nsCOMPtr<nsIFragmentContentSink> fragSink = do_QueryInterface(mSink);
- NS_ASSERTION(fragSink, "ParseFragment requires a fragment content sink");
+ if (!fragSink) {
+ NS_ERROR("ParseFragment requires a fragment content sink");
+ mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
+ return kUnknownError;
+ }
if (!aXMLMode) {
// First, we have to flush any tags that don't belong in the head if there
// 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?");
+ if (!mParserContext) {
+ NS_ERROR("Parsing didn't create a parser context?");
+ mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
+ return kInvalidParserContext;
+ }
nsCOMPtr<CNavDTD> dtd = do_QueryInterface(mParserContext->mDTD);
if (dtd) {
CStartToken bodyToken(NS_LITERAL_STRING("BODY"), eHTMLTag_body);
nsCParserNode bodyNode(&bodyToken, 0);