diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp
index 04e90de92d4..97af80fb253 100644
--- a/mozilla/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/htmlparser/src/CNavDTD.cpp
@@ -957,33 +957,37 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
}
if(theChildAgrees && theChildIsContainer) {
- if (!nsHTMLElement::IsResidualStyleTag(aChildTag)) {
- if(theParentTag!=aChildTag) {
-
- //trying is blockcloser to widen the set of elements that this effects, re: bug 27865...
-
- if(nsHTMLElement::IsBlockCloser(theParentTag)) {
- PRInt32 theChildIndex=GetIndexOfChildOrSynonym(*mBodyContext,aChildTag);
-
- if((kNotFound
-
- How do we know that the 2nd should close the
rather than nest inside the ?
- (Afterall, the is a legal child of the
).
-
- The way you know is that there is no root between the two, so the binds more
- tightly to the 1st than to the
.
-
- 2. Also, bug 6148 shows this case:
- From this case we learned not to execute this logic if the parent is a block.
- -------------------------------------------------------------------------------------*/
-
- theChildAgrees=CanBeContained(aChildTag,*mBodyContext);
- } //if
- }//if
- }
+ if(theParentTag!=aChildTag) {
+ // Double check the power structure a
+ // Note: The bit is currently set on and .
+ if(gHTMLElements[theParentTag].ShouldVerifyHierarchy(aChildTag)){
+ PRInt32 theChildIndex=GetIndexOfChildOrSynonym(*mBodyContext,aChildTag);
+
+ if((kNotFound
+ How do we know that the 2nd should close the
rather than nest inside the ?
+ (Afterall, the is a legal child of the
).
+
+ The way you know is that there is no root between the two, so the binds more
+ tightly to the 1st than to the
.
+ 2. Also, bug 6148 shows this case:
+ From this case we learned not to execute this logic if the parent is a block.
+
+ 3. Fix for 26583
+ Ex. foobar <-- A legal HTML
+ In the above example clicking on "foo" or "bar" should link to
+ foo.html or bar.html respectively. That is, the inner should be informed
+ about the presence of an open above ..so that the inner can close out
+ the outer . The following code does it for us.
+
+ 4. Fix for 27865 [ similer to 22596 ]. Ex: - one
- two
+ -------------------------------------------------------------------------------------*/
+
+ theChildAgrees=CanBeContained(aChildTag,*mBodyContext);
+ } //if
+ }//if
} //if
} //if
} //if parentcontains
@@ -1549,9 +1553,9 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
//This is special NAV-QUIRKS code that allows users
//to use , even though that isn't a legitimate tag.
if(eParseMode_quirks==mParseMode) {
- CStartToken theToken(theChildTag); //leave this on the stack; no recycling necessary.
- theToken.mUseCount=1;
- result=HandleStartToken(&theToken);
+ // Use recycler and pass the token thro' HandleToken() to fix bugs like 32782.
+ CHTMLToken* theToken = (CHTMLToken*)mTokenRecycler->CreateTokenOfType(eToken_start,theChildTag);
+ result=HandleToken(theToken,mParser);
}
}
break;
diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp
index ef762c6854f..2a3867bc9cb 100644
--- a/mozilla/htmlparser/src/nsDTDUtils.cpp
+++ b/mozilla/htmlparser/src/nsDTDUtils.cpp
@@ -1180,7 +1180,7 @@ void CObserverService::RegisterObservers(const nsString& aTopic) {
nsServiceManager::ReleaseService(NS_OBSERVERSERVICE_PROGID, theObserverService);
if(result == NS_OK) {
- nsIElementObserver *theElementObserver = nsnull;
+ nsCOMPtr theElementObserver;
nsISupports *inst = nsnull;
nsObserverTopic *theTopic=0;
@@ -1188,7 +1188,7 @@ void CObserverService::RegisterObservers(const nsString& aTopic) {
for (theEnum->First(); theEnum->IsDone() != NS_OK; theEnum->Next()) {
result = theEnum->CurrentItem(&inst);
if (NS_SUCCEEDED(result)) {
- result = inst->QueryInterface(NS_GET_IID(nsIElementObserver), (void**)&theElementObserver);
+ theElementObserver = do_QueryInterface(inst, &result);
NS_RELEASE(inst);
}
if (result == NS_OK) {
diff --git a/mozilla/htmlparser/src/nsElementTable.cpp b/mozilla/htmlparser/src/nsElementTable.cpp
index 7c40ee0712b..5f3211ac9ef 100644
--- a/mozilla/htmlparser/src/nsElementTable.cpp
+++ b/mozilla/htmlparser/src/nsElementTable.cpp
@@ -219,7 +219,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kSpecial, kInlineEntity, kNone,
- /*special props, prop-range*/ 0,kDefaultPropRange,
+ /*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@@ -760,7 +760,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gLIRootTags,&gLIRootTags,
/*autoclose starttags and endtags*/ &gLIAutoClose,0,0,0,
/*parent,incl,exclgroups*/ kBlock, kFlowEntity, kSelf, //changed this from blockentity to block during RS cleanup
- /*special props, prop-range*/ kNoPropagate, kDefaultPropRange,
+ /*special props, prop-range*/ kNoPropagate|kVerifyHierarchy, kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gLIKids,eHTMLTag_unknown);
Initialize(
@@ -891,11 +891,11 @@ void InitializeElementTable(void) {
Initialize(
/*tag*/ eHTMLTag_option,
- /*requiredAncestor*/ eHTMLTag_unknown,eHTMLTag_unknown,
+ /*requiredAncestor*/ eHTMLTag_select,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kPCDATA, kFlowEntity,
- /*special props, prop-range*/ kNoStyleLeaksIn, kDefaultPropRange,
+ /*special props, prop-range*/ kNoStyleLeaksIn|kNoPropagate, kDefaultPropRange,
/*special parents,kids,skip*/ &gOptgroupParents,&gContainsText,eHTMLTag_unknown);
Initialize(
@@ -1678,6 +1678,32 @@ PRBool nsHTMLElement::SectionContains(eHTMLTags aChild,PRBool allowDepthSearch)
return result;
}
+/**
+ * This method should be called to determine if the a tags
+ * hierarchy needs to be validated.
+ *
+ * @update harishd 04/19/00
+ * @param
+ * @return
+ */
+
+PRBool nsHTMLElement::ShouldVerifyHierarchy(eHTMLTags aChildTag) {
+ PRBool result=PR_FALSE;
+
+ // If the tag cannot contain itself then we need to make sure that
+ // anywhere in the hierarchy we don't nest accidently.
+ // Ex:
- . Inner LI has the potential of getting nested
+ // inside outer LI.If the tag can contain self, Ex: ,
+ // ( B can contain self )then ask the child () if it requires a containment check.
+ if(aChildTag!=eHTMLTag_userdefined) {
+ if(CanContainSelf()) {
+ result=gHTMLElements[aChildTag].HasSpecialProperty(kVerifyHierarchy);
+ }
+ else result=PR_TRUE;
+ }
+ return result;
+}
+
/**
*
* @update gess12/13/98
diff --git a/mozilla/htmlparser/src/nsElementTable.h b/mozilla/htmlparser/src/nsElementTable.h
index b659f212971..e1944f20171 100644
--- a/mozilla/htmlparser/src/nsElementTable.h
+++ b/mozilla/htmlparser/src/nsElementTable.h
@@ -173,6 +173,7 @@ struct nsHTMLElement {
PRBool IsSpecialParent(eHTMLTags aTag) const;
PRBool IsExcludableParent(eHTMLTags aParent) const;
PRBool SectionContains(eHTMLTags aTag,PRBool allowDepthSearch);
+ PRBool ShouldVerifyHierarchy(eHTMLTags achildTag);
static PRBool CanContain(eHTMLTags aParent,eHTMLTags aChild);
static PRBool IsContainer(eHTMLTags aTag) ;
@@ -224,6 +225,6 @@ static const int kSaveMisplaced = 0x0200; //If set, then children this tag ca
static const int kNonContainer = 0x0400; //If set, then this tag is not a container.
static const int kHandleStrayTag = 0x0800; //If set, we automatically open a start tag
static const int kRequiresBody = 0x1000; //If set, then in case of no BODY one will be opened up immediately.
-
+static const int kVerifyHierarchy = 0x2000; //If set, check to see if the tag is a child or a sibling..
#endif
diff --git a/mozilla/htmlparser/src/nsHTMLTokenizer.cpp b/mozilla/htmlparser/src/nsHTMLTokenizer.cpp
index e4b4c295a69..71fb0bfed93 100644
--- a/mozilla/htmlparser/src/nsHTMLTokenizer.cpp
+++ b/mozilla/htmlparser/src/nsHTMLTokenizer.cpp
@@ -551,7 +551,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
nsAutoString endTag(nsHTMLTags::GetStringValue(theTag));
endTag.InsertWithConversion("",0,2);
CToken* textToken=theRecycler->CreateTokenOfType(eToken_text,theTag);
- result=((CTextToken*)textToken)->ConsumeUntil(0,PR_FALSE,aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
+ result=((CTextToken*)textToken)->ConsumeUntil(0,PRBool(theTag!=eHTMLTag_script),aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
//endTag.Append(">");
CToken* endToken=theRecycler->CreateTokenOfType(eToken_end,theTag,endTag);
AddToken(textToken,result,&mTokenDeque,theRecycler);
diff --git a/mozilla/htmlparser/src/nsHTMLTokens.cpp b/mozilla/htmlparser/src/nsHTMLTokens.cpp
index 157d9d25df1..a0ede590ff1 100644
--- a/mozilla/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/htmlparser/src/nsHTMLTokens.cpp
@@ -614,20 +614,22 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
}
//theTermStrPos=theBuffer.Find(aTerminalString,PR_TRUE,theCurrOffset);
if(theTermStrPos>kNotFound) {
- if(aMode!=eParseMode_noquirks && !theLastIteration && !aIgnoreComments) {
- theCurrOffset=theBuffer.Find(" between ",PR_TRUE,theTermStrPos,theTermStrPos-theStartCommentPos);
- if(theCurrOffset==kNotFound) {
- // If you're here it means that we have a bogus terminal string.
- theAltTermStrPos=(theAltTermStrPos>-1)? theAltTermStrPos:theTermStrPos; // This could be helpful in case we hit the rock bottom.
- theCurrOffset=theTermStrPos+termStrLen; // We did not find '-->' so keep searching for terminal string.
- continue;
- }
+ if(aMode!=eParseMode_noquirks && !theLastIteration) {
+ if(!aIgnoreComments) {
+ theCurrOffset=theBuffer.Find(" between ",PR_TRUE,theTermStrPos,theTermStrPos-theStartCommentPos);
+ if(theCurrOffset==kNotFound) {
+ // If you're here it means that we have a bogus terminal string.
+ theAltTermStrPos=(theAltTermStrPos>-1)? theAltTermStrPos:theTermStrPos; // This could be helpful in case we hit the rock bottom.
+ theCurrOffset=theTermStrPos+termStrLen; // We did not find '-->' so keep searching for terminal string.
+ continue;
+ }
+ }
}
PRInt32 thePos=theBuffer.FindChar(kGreaterThan,PR_TRUE,theTermStrPos,20);
@@ -1248,6 +1250,8 @@ void CAttributeToken::AppendSource(nsString& anOutputString){
*/
nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScanner){
nsresult result=NS_OK;
+ PRInt32 theOffset=aScanner.GetOffset();
+
switch(aChar) {
case kQuote:
result=aScanner.ReadUntil(aString,kQuote,PR_TRUE);
@@ -1262,9 +1266,21 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
default:
break;
}
+
+ // Ref: Bug 35806
+ // A back up measure when disaster strikes...
+ // Ex
WillBuildModel(*pc,nsnull); // Fixing UMR - Bug 33570
+
pc->mMultipart=!aLastCall; //by default
if (pc->mPrevContext) {
pc->mMultipart |= pc->mPrevContext->mMultipart; //if available
diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp
index 04e90de92d4..97af80fb253 100644
--- a/mozilla/parser/htmlparser/src/CNavDTD.cpp
+++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp
@@ -957,33 +957,37 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
}
if(theChildAgrees && theChildIsContainer) {
- if (!nsHTMLElement::IsResidualStyleTag(aChildTag)) {
- if(theParentTag!=aChildTag) {
-
- //trying is blockcloser to widen the set of elements that this effects, re: bug 27865...
-
- if(nsHTMLElement::IsBlockCloser(theParentTag)) {
- PRInt32 theChildIndex=GetIndexOfChildOrSynonym(*mBodyContext,aChildTag);
-
- if((kNotFound
-
- How do we know that the 2nd should close the
- rather than nest inside the
- ?
- (Afterall, the
is a legal child of the
- ).
-
- The way you know is that there is no root between the two, so the
binds more
- tightly to the 1st than to the
- .
-
- 2. Also, bug 6148 shows this case:
- From this case we learned not to execute this logic if the parent is a block.
- -------------------------------------------------------------------------------------*/
-
- theChildAgrees=CanBeContained(aChildTag,*mBodyContext);
- } //if
- }//if
- }
+ if(theParentTag!=aChildTag) {
+ // Double check the power structure a
+ // Note: The bit is currently set on and - .
+ if(gHTMLElements[theParentTag].ShouldVerifyHierarchy(aChildTag)){
+ PRInt32 theChildIndex=GetIndexOfChildOrSynonym(*mBodyContext,aChildTag);
+
+ if((kNotFound
+ How do we know that the 2nd should close the
- rather than nest inside the
- ?
+ (Afterall, the
is a legal child of the
- ).
+
+ The way you know is that there is no root between the two, so the
binds more
+ tightly to the 1st than to the
- .
+ 2. Also, bug 6148 shows this case:
+ From this case we learned not to execute this logic if the parent is a block.
+
+ 3. Fix for 26583
+ Ex. foobar <-- A legal HTML
+ In the above example clicking on "foo" or "bar" should link to
+ foo.html or bar.html respectively. That is, the inner should be informed
+ about the presence of an open above ..so that the inner can close out
+ the outer . The following code does it for us.
+
+ 4. Fix for 27865 [ similer to 22596 ]. Ex: - one
- two
+ -------------------------------------------------------------------------------------*/
+
+ theChildAgrees=CanBeContained(aChildTag,*mBodyContext);
+ } //if
+ }//if
} //if
} //if
} //if parentcontains
@@ -1549,9 +1553,9 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
//This is special NAV-QUIRKS code that allows users
//to use , even though that isn't a legitimate tag.
if(eParseMode_quirks==mParseMode) {
- CStartToken theToken(theChildTag); //leave this on the stack; no recycling necessary.
- theToken.mUseCount=1;
- result=HandleStartToken(&theToken);
+ // Use recycler and pass the token thro' HandleToken() to fix bugs like 32782.
+ CHTMLToken* theToken = (CHTMLToken*)mTokenRecycler->CreateTokenOfType(eToken_start,theChildTag);
+ result=HandleToken(theToken,mParser);
}
}
break;
diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
index ef762c6854f..2a3867bc9cb 100644
--- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
+++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
@@ -1180,7 +1180,7 @@ void CObserverService::RegisterObservers(const nsString& aTopic) {
nsServiceManager::ReleaseService(NS_OBSERVERSERVICE_PROGID, theObserverService);
if(result == NS_OK) {
- nsIElementObserver *theElementObserver = nsnull;
+ nsCOMPtr theElementObserver;
nsISupports *inst = nsnull;
nsObserverTopic *theTopic=0;
@@ -1188,7 +1188,7 @@ void CObserverService::RegisterObservers(const nsString& aTopic) {
for (theEnum->First(); theEnum->IsDone() != NS_OK; theEnum->Next()) {
result = theEnum->CurrentItem(&inst);
if (NS_SUCCEEDED(result)) {
- result = inst->QueryInterface(NS_GET_IID(nsIElementObserver), (void**)&theElementObserver);
+ theElementObserver = do_QueryInterface(inst, &result);
NS_RELEASE(inst);
}
if (result == NS_OK) {
diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp
index 7c40ee0712b..5f3211ac9ef 100644
--- a/mozilla/parser/htmlparser/src/nsElementTable.cpp
+++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp
@@ -219,7 +219,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kSpecial, kInlineEntity, kNone,
- /*special props, prop-range*/ 0,kDefaultPropRange,
+ /*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@@ -760,7 +760,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gLIRootTags,&gLIRootTags,
/*autoclose starttags and endtags*/ &gLIAutoClose,0,0,0,
/*parent,incl,exclgroups*/ kBlock, kFlowEntity, kSelf, //changed this from blockentity to block during RS cleanup
- /*special props, prop-range*/ kNoPropagate, kDefaultPropRange,
+ /*special props, prop-range*/ kNoPropagate|kVerifyHierarchy, kDefaultPropRange,
/*special parents,kids,skip*/ 0,&gLIKids,eHTMLTag_unknown);
Initialize(
@@ -891,11 +891,11 @@ void InitializeElementTable(void) {
Initialize(
/*tag*/ eHTMLTag_option,
- /*requiredAncestor*/ eHTMLTag_unknown,eHTMLTag_unknown,
+ /*requiredAncestor*/ eHTMLTag_select,eHTMLTag_unknown,
/*rootnodes,endrootnodes*/ &gOptgroupParents,&gOptgroupParents,
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kNone, kPCDATA, kFlowEntity,
- /*special props, prop-range*/ kNoStyleLeaksIn, kDefaultPropRange,
+ /*special props, prop-range*/ kNoStyleLeaksIn|kNoPropagate, kDefaultPropRange,
/*special parents,kids,skip*/ &gOptgroupParents,&gContainsText,eHTMLTag_unknown);
Initialize(
@@ -1678,6 +1678,32 @@ PRBool nsHTMLElement::SectionContains(eHTMLTags aChild,PRBool allowDepthSearch)
return result;
}
+/**
+ * This method should be called to determine if the a tags
+ * hierarchy needs to be validated.
+ *
+ * @update harishd 04/19/00
+ * @param
+ * @return
+ */
+
+PRBool nsHTMLElement::ShouldVerifyHierarchy(eHTMLTags aChildTag) {
+ PRBool result=PR_FALSE;
+
+ // If the tag cannot contain itself then we need to make sure that
+ // anywhere in the hierarchy we don't nest accidently.
+ // Ex:
- . Inner LI has the potential of getting nested
+ // inside outer LI.If the tag can contain self, Ex: ,
+ // ( B can contain self )then ask the child () if it requires a containment check.
+ if(aChildTag!=eHTMLTag_userdefined) {
+ if(CanContainSelf()) {
+ result=gHTMLElements[aChildTag].HasSpecialProperty(kVerifyHierarchy);
+ }
+ else result=PR_TRUE;
+ }
+ return result;
+}
+
/**
*
* @update gess12/13/98
diff --git a/mozilla/parser/htmlparser/src/nsElementTable.h b/mozilla/parser/htmlparser/src/nsElementTable.h
index b659f212971..e1944f20171 100644
--- a/mozilla/parser/htmlparser/src/nsElementTable.h
+++ b/mozilla/parser/htmlparser/src/nsElementTable.h
@@ -173,6 +173,7 @@ struct nsHTMLElement {
PRBool IsSpecialParent(eHTMLTags aTag) const;
PRBool IsExcludableParent(eHTMLTags aParent) const;
PRBool SectionContains(eHTMLTags aTag,PRBool allowDepthSearch);
+ PRBool ShouldVerifyHierarchy(eHTMLTags achildTag);
static PRBool CanContain(eHTMLTags aParent,eHTMLTags aChild);
static PRBool IsContainer(eHTMLTags aTag) ;
@@ -224,6 +225,6 @@ static const int kSaveMisplaced = 0x0200; //If set, then children this tag ca
static const int kNonContainer = 0x0400; //If set, then this tag is not a container.
static const int kHandleStrayTag = 0x0800; //If set, we automatically open a start tag
static const int kRequiresBody = 0x1000; //If set, then in case of no BODY one will be opened up immediately.
-
+static const int kVerifyHierarchy = 0x2000; //If set, check to see if the tag is a child or a sibling..
#endif
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
index e4b4c295a69..71fb0bfed93 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokenizer.cpp
@@ -551,7 +551,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
nsAutoString endTag(nsHTMLTags::GetStringValue(theTag));
endTag.InsertWithConversion("",0,2);
CToken* textToken=theRecycler->CreateTokenOfType(eToken_text,theTag);
- result=((CTextToken*)textToken)->ConsumeUntil(0,PR_FALSE,aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
+ result=((CTextToken*)textToken)->ConsumeUntil(0,PRBool(theTag!=eHTMLTag_script),aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
//endTag.Append(">");
CToken* endToken=theRecycler->CreateTokenOfType(eToken_end,theTag,endTag);
AddToken(textToken,result,&mTokenDeque,theRecycler);
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
index 157d9d25df1..a0ede590ff1 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -614,20 +614,22 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
}
//theTermStrPos=theBuffer.Find(aTerminalString,PR_TRUE,theCurrOffset);
if(theTermStrPos>kNotFound) {
- if(aMode!=eParseMode_noquirks && !theLastIteration && !aIgnoreComments) {
- theCurrOffset=theBuffer.Find(" between ",PR_TRUE,theTermStrPos,theTermStrPos-theStartCommentPos);
- if(theCurrOffset==kNotFound) {
- // If you're here it means that we have a bogus terminal string.
- theAltTermStrPos=(theAltTermStrPos>-1)? theAltTermStrPos:theTermStrPos; // This could be helpful in case we hit the rock bottom.
- theCurrOffset=theTermStrPos+termStrLen; // We did not find '-->' so keep searching for terminal string.
- continue;
- }
+ if(aMode!=eParseMode_noquirks && !theLastIteration) {
+ if(!aIgnoreComments) {
+ theCurrOffset=theBuffer.Find(" between ",PR_TRUE,theTermStrPos,theTermStrPos-theStartCommentPos);
+ if(theCurrOffset==kNotFound) {
+ // If you're here it means that we have a bogus terminal string.
+ theAltTermStrPos=(theAltTermStrPos>-1)? theAltTermStrPos:theTermStrPos; // This could be helpful in case we hit the rock bottom.
+ theCurrOffset=theTermStrPos+termStrLen; // We did not find '-->' so keep searching for terminal string.
+ continue;
+ }
+ }
}
PRInt32 thePos=theBuffer.FindChar(kGreaterThan,PR_TRUE,theTermStrPos,20);
@@ -1248,6 +1250,8 @@ void CAttributeToken::AppendSource(nsString& anOutputString){
*/
nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScanner){
nsresult result=NS_OK;
+ PRInt32 theOffset=aScanner.GetOffset();
+
switch(aChar) {
case kQuote:
result=aScanner.ReadUntil(aString,kQuote,PR_TRUE);
@@ -1262,9 +1266,21 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
default:
break;
}
+
+ // Ref: Bug 35806
+ // A back up measure when disaster strikes...
+ // Ex
WillBuildModel(*pc,nsnull); // Fixing UMR - Bug 33570
+
pc->mMultipart=!aLastCall; //by default
if (pc->mPrevContext) {
pc->mMultipart |= pc->mPrevContext->mMultipart; //if available