Bug 160095 NOEMBED tag causes leaks as the skipped content is not consumed.

patch by mrbkap@gmail.com r=rbs sr=brendan
This commit is contained in:
timeless%mozdev.org 2005-03-17 19:38:01 +00:00
Родитель dcf385909f
Коммит 70371ad98c
3 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -3229,6 +3229,12 @@ CNavDTD::OpenContainer(const nsCParserNode *aNode,
result = HandleScriptToken(aNode); result = HandleScriptToken(aNode);
break; break;
case eHTMLTag_noembed:
// <noembed> is unconditionally alternate content.
done = PR_FALSE;
mFlags |= NS_DTD_FLAG_ALTERNATE_CONTENT;
break;
case eHTMLTag_noscript: case eHTMLTag_noscript:
// we want to make sure that OpenContainer gets called below since we're // we want to make sure that OpenContainer gets called below since we're
// not doing it here // not doing it here
@ -3315,6 +3321,7 @@ CNavDTD::CloseContainer(const eHTMLTags aTag, eHTMLTags aTarget,PRBool aClosedBy
break; break;
case eHTMLTag_iframe: case eHTMLTag_iframe:
case eHTMLTag_noembed:
case eHTMLTag_noscript: case eHTMLTag_noscript:
case eHTMLTag_noframes: case eHTMLTag_noframes:
// switch from alternate content state to regular state // switch from alternate content state to regular state

Просмотреть файл

@ -859,9 +859,9 @@ void InitializeElementTable(void) {
/*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0, /*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kNone, kNone, /*parent,incl,exclgroups*/ kFlowEntity, kFlowEntity, kNone,
/*special props, prop-range*/ kDiscardTag, kDefaultPropRange, /*special props, prop-range*/ 0, kNoPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_noembed); /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize( Initialize(
/*tag*/ eHTMLTag_noframes, /*tag*/ eHTMLTag_noframes,

Просмотреть файл

@ -817,9 +817,12 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,
PRBool isPCDATA = eHTMLTag_textarea == theTag || PRBool isPCDATA = eHTMLTag_textarea == theTag ||
eHTMLTag_title == theTag; eHTMLTag_title == theTag;
// XXX This is an evil hack, we should be able to handle these properly
// in the DTD.
if ((eHTMLTag_iframe == theTag && (mFlags & NS_IPARSER_FLAG_FRAMES_ENABLED)) || if ((eHTMLTag_iframe == theTag && (mFlags & NS_IPARSER_FLAG_FRAMES_ENABLED)) ||
(eHTMLTag_noframes == theTag && (mFlags & NS_IPARSER_FLAG_FRAMES_ENABLED)) || (eHTMLTag_noframes == theTag && (mFlags & NS_IPARSER_FLAG_FRAMES_ENABLED)) ||
(eHTMLTag_noscript == theTag && (mFlags & NS_IPARSER_FLAG_SCRIPT_ENABLED))) { (eHTMLTag_noscript == theTag && (mFlags & NS_IPARSER_FLAG_SCRIPT_ENABLED)) ||
(eHTMLTag_noembed == theTag)) {
isCDATA = PR_TRUE; isCDATA = PR_TRUE;
} }
@ -844,7 +847,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,
mFlags, mFlags,
done); done);
// Only flush tokens for <script>, to give oursevles more of a // Only flush tokens for <script>, to give ourselves more of a
// chance of allowing inlines to contain blocks. // chance of allowing inlines to contain blocks.
aFlushTokens = done && theTag == eHTMLTag_script; aFlushTokens = done && theTag == eHTMLTag_script;
} }