зеркало из https://github.com/mozilla/pjs.git
Repaired script tag handling so that attributes make it through
This commit is contained in:
Родитель
3d7330d613
Коммит
6ca7071513
|
@ -627,7 +627,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
|
|||
break;
|
||||
|
||||
case eHTMLTag_script:
|
||||
result=HandleScriptToken(st); break;
|
||||
result=HandleScriptToken(st, attrNode); break;
|
||||
|
||||
case eHTMLTag_head:
|
||||
break; //ignore head tags...
|
||||
|
@ -821,32 +821,32 @@ nsresult CNavDTD::HandleAttributeToken(CToken* aToken) {
|
|||
* @param aToken -- next (start) token to be handled
|
||||
* @return PR_TRUE if all went well; PR_FALSE if error occured
|
||||
*/
|
||||
nsresult CNavDTD::HandleScriptToken(CToken* aToken) {
|
||||
nsresult CNavDTD::HandleScriptToken(CToken* aToken, nsCParserNode& aNode) {
|
||||
NS_PRECONDITION(0!=aToken,kNullToken);
|
||||
nsresult result=NS_OK;
|
||||
|
||||
PRInt32 pos=GetTopmostIndexOf(eHTMLTag_body);
|
||||
nsCParserNode theNode((CHTMLToken*)aToken);
|
||||
nsCParserNode attrNode((CHTMLToken*)aToken);
|
||||
// nsCParserNode theNode((CHTMLToken*)aToken);
|
||||
// nsCParserNode attrNode((CHTMLToken*)aToken);
|
||||
PRInt32 attrCount=aToken->GetAttributeCount();
|
||||
|
||||
if (kNotFound == pos) {
|
||||
// We're in the HEAD
|
||||
result=OpenHead(theNode);
|
||||
result=OpenHead(aNode);
|
||||
if(NS_OK==result) {
|
||||
mParser->CollectSkippedContent(attrNode,attrCount);
|
||||
mParser->CollectSkippedContent(aNode,attrCount);
|
||||
if(NS_OK==result) {
|
||||
result=AddLeaf(attrNode);
|
||||
result=AddLeaf(aNode);
|
||||
if(NS_OK==result)
|
||||
result=CloseHead(theNode);
|
||||
result=CloseHead(aNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We're in the BODY
|
||||
mParser->CollectSkippedContent(attrNode,attrCount);
|
||||
mParser->CollectSkippedContent(aNode,attrCount);
|
||||
if(NS_OK==result) {
|
||||
result=AddLeaf(attrNode);
|
||||
result=AddLeaf(aNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
class nsIHTMLContentSink;
|
||||
class nsIDTDDebug;
|
||||
class nsIParserNode;
|
||||
class nsCParserNode;
|
||||
class CITokenHandler;
|
||||
class nsParser;
|
||||
|
||||
|
@ -359,7 +360,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
|
|||
nsresult HandleCommentToken(CToken* aToken);
|
||||
nsresult HandleSkippedContentToken(CToken* aToken);
|
||||
nsresult HandleAttributeToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(CToken* aToken, nsCParserNode& aNode);
|
||||
nsresult HandleStyleToken(CToken* aToken);
|
||||
|
||||
|
||||
|
|
|
@ -325,8 +325,8 @@ nsresult COtherDTD::HandleAttributeToken(CToken* aToken) {
|
|||
* @param aToken -- next (start) token to be handled
|
||||
* @return PR_TRUE if all went well; PR_FALSE if error occured
|
||||
*/
|
||||
nsresult COtherDTD::HandleScriptToken(CToken* aToken) {
|
||||
return CNavDTD::HandleScriptToken(aToken);
|
||||
nsresult COtherDTD::HandleScriptToken(CToken* aToken, nsCParserNode& aNode) {
|
||||
return CNavDTD::HandleScriptToken(aToken, aNode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -292,7 +292,7 @@ class COtherDTD : public CNavDTD {
|
|||
* @param aToken is the script token to be handled
|
||||
* @return TRUE if the token was handled.
|
||||
*/
|
||||
nsresult HandleScriptToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(CToken* aToken, nsCParserNode& aNode);
|
||||
|
||||
/**
|
||||
* This method gets called when a style token has been consumed and needs
|
||||
|
|
|
@ -627,7 +627,7 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
|
|||
break;
|
||||
|
||||
case eHTMLTag_script:
|
||||
result=HandleScriptToken(st); break;
|
||||
result=HandleScriptToken(st, attrNode); break;
|
||||
|
||||
case eHTMLTag_head:
|
||||
break; //ignore head tags...
|
||||
|
@ -821,32 +821,32 @@ nsresult CNavDTD::HandleAttributeToken(CToken* aToken) {
|
|||
* @param aToken -- next (start) token to be handled
|
||||
* @return PR_TRUE if all went well; PR_FALSE if error occured
|
||||
*/
|
||||
nsresult CNavDTD::HandleScriptToken(CToken* aToken) {
|
||||
nsresult CNavDTD::HandleScriptToken(CToken* aToken, nsCParserNode& aNode) {
|
||||
NS_PRECONDITION(0!=aToken,kNullToken);
|
||||
nsresult result=NS_OK;
|
||||
|
||||
PRInt32 pos=GetTopmostIndexOf(eHTMLTag_body);
|
||||
nsCParserNode theNode((CHTMLToken*)aToken);
|
||||
nsCParserNode attrNode((CHTMLToken*)aToken);
|
||||
// nsCParserNode theNode((CHTMLToken*)aToken);
|
||||
// nsCParserNode attrNode((CHTMLToken*)aToken);
|
||||
PRInt32 attrCount=aToken->GetAttributeCount();
|
||||
|
||||
if (kNotFound == pos) {
|
||||
// We're in the HEAD
|
||||
result=OpenHead(theNode);
|
||||
result=OpenHead(aNode);
|
||||
if(NS_OK==result) {
|
||||
mParser->CollectSkippedContent(attrNode,attrCount);
|
||||
mParser->CollectSkippedContent(aNode,attrCount);
|
||||
if(NS_OK==result) {
|
||||
result=AddLeaf(attrNode);
|
||||
result=AddLeaf(aNode);
|
||||
if(NS_OK==result)
|
||||
result=CloseHead(theNode);
|
||||
result=CloseHead(aNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We're in the BODY
|
||||
mParser->CollectSkippedContent(attrNode,attrCount);
|
||||
mParser->CollectSkippedContent(aNode,attrCount);
|
||||
if(NS_OK==result) {
|
||||
result=AddLeaf(attrNode);
|
||||
result=AddLeaf(aNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
class nsIHTMLContentSink;
|
||||
class nsIDTDDebug;
|
||||
class nsIParserNode;
|
||||
class nsCParserNode;
|
||||
class CITokenHandler;
|
||||
class nsParser;
|
||||
|
||||
|
@ -359,7 +360,7 @@ CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {
|
|||
nsresult HandleCommentToken(CToken* aToken);
|
||||
nsresult HandleSkippedContentToken(CToken* aToken);
|
||||
nsresult HandleAttributeToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(CToken* aToken, nsCParserNode& aNode);
|
||||
nsresult HandleStyleToken(CToken* aToken);
|
||||
|
||||
|
||||
|
|
|
@ -325,8 +325,8 @@ nsresult COtherDTD::HandleAttributeToken(CToken* aToken) {
|
|||
* @param aToken -- next (start) token to be handled
|
||||
* @return PR_TRUE if all went well; PR_FALSE if error occured
|
||||
*/
|
||||
nsresult COtherDTD::HandleScriptToken(CToken* aToken) {
|
||||
return CNavDTD::HandleScriptToken(aToken);
|
||||
nsresult COtherDTD::HandleScriptToken(CToken* aToken, nsCParserNode& aNode) {
|
||||
return CNavDTD::HandleScriptToken(aToken, aNode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -292,7 +292,7 @@ class COtherDTD : public CNavDTD {
|
|||
* @param aToken is the script token to be handled
|
||||
* @return TRUE if the token was handled.
|
||||
*/
|
||||
nsresult HandleScriptToken(CToken* aToken);
|
||||
nsresult HandleScriptToken(CToken* aToken, nsCParserNode& aNode);
|
||||
|
||||
/**
|
||||
* This method gets called when a style token has been consumed and needs
|
||||
|
|
Загрузка…
Ссылка в новой задаче