diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp
index 02f48fd7460..734b70fbfbb 100644
--- a/htmlparser/src/CNavDTD.cpp
+++ b/htmlparser/src/CNavDTD.cpp
@@ -1781,7 +1781,6 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
case eHTMLTag_noframes:
case eHTMLTag_noembed:
- case eHTMLTag_noscript:
mHasOpenNoXXX--;
//and allow to fall through...
@@ -2318,6 +2317,14 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
}
}
#endif
+ if(!result) {
+ // Bug 42429 - Preserve whitespace inside TABLE,TR,TBODY,TFOOT,etc.,
+ if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
+ if(nsHTMLElement::IsWhitespaceTag((eHTMLTags)aChild)) {
+ result=PR_TRUE;
+ }
+ }
+ }
return result;
}
@@ -3181,6 +3188,7 @@ nsresult CNavDTD::CloseNoscript(const nsIParserNode *aNode) {
START_TIMER();
if(NS_SUCCEEDED(result)) {
+ NS_ASSERTION((mHasOpenNoXXX > -1), "mHasOpenNoXXX underflow");
if(mHasOpenNoXXX > 0) {
mHasOpenNoXXX--;
}
diff --git a/htmlparser/src/nsDTDUtils.cpp b/htmlparser/src/nsDTDUtils.cpp
index 9668c01fb75..7894a2defa5 100644
--- a/htmlparser/src/nsDTDUtils.cpp
+++ b/htmlparser/src/nsDTDUtils.cpp
@@ -1079,6 +1079,7 @@ nsIParserNode* nsDTDContext::PopStyle(eHTMLTags aTag){
if(aTag==theStack->Last()) {
result=theStack->Pop();
mResidualStyleCount--;
+ break; // Fix bug 50710 - Stop after finding a style.
} else {
// NS_ERROR("bad residual style entry");
}
diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp
index 02f48fd7460..734b70fbfbb 100644
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -1781,7 +1781,6 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
case eHTMLTag_noframes:
case eHTMLTag_noembed:
- case eHTMLTag_noscript:
mHasOpenNoXXX--;
//and allow to fall through...
@@ -2318,6 +2317,14 @@ PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
}
}
#endif
+ if(!result) {
+ // Bug 42429 - Preserve whitespace inside TABLE,TR,TBODY,TFOOT,etc.,
+ if(gHTMLElements[aParent].HasSpecialProperty(kBadContentWatch)) {
+ if(nsHTMLElement::IsWhitespaceTag((eHTMLTags)aChild)) {
+ result=PR_TRUE;
+ }
+ }
+ }
return result;
}
@@ -3181,6 +3188,7 @@ nsresult CNavDTD::CloseNoscript(const nsIParserNode *aNode) {
START_TIMER();
if(NS_SUCCEEDED(result)) {
+ NS_ASSERTION((mHasOpenNoXXX > -1), "mHasOpenNoXXX underflow");
if(mHasOpenNoXXX > 0) {
mHasOpenNoXXX--;
}
diff --git a/parser/htmlparser/src/nsDTDUtils.cpp b/parser/htmlparser/src/nsDTDUtils.cpp
index 9668c01fb75..7894a2defa5 100644
--- a/parser/htmlparser/src/nsDTDUtils.cpp
+++ b/parser/htmlparser/src/nsDTDUtils.cpp
@@ -1079,6 +1079,7 @@ nsIParserNode* nsDTDContext::PopStyle(eHTMLTags aTag){
if(aTag==theStack->Last()) {
result=theStack->Pop();
mResidualStyleCount--;
+ break; // Fix bug 50710 - Stop after finding a style.
} else {
// NS_ERROR("bad residual style entry");
}