зеркало из https://github.com/mozilla/pjs.git
Bug 595844 - Check the namespace of the current element on the tree builder stack when deciding whether to support CDATA sections in text/html. rs=jonas, a=blocking2.0-betaN.
This commit is contained in:
Родитель
a4b8903d81
Коммит
091258f63e
|
@ -2354,14 +2354,13 @@ public class Tokenizer implements Locator {
|
||||||
state = Tokenizer.MARKUP_DECLARATION_OCTYPE;
|
state = Tokenizer.MARKUP_DECLARATION_OCTYPE;
|
||||||
continue stateloop;
|
continue stateloop;
|
||||||
case '[':
|
case '[':
|
||||||
if (tokenHandler.isInForeign()) {
|
if (tokenHandler.cdataSectionAllowed()) {
|
||||||
clearLongStrBufAndAppend(c);
|
clearLongStrBufAndAppend(c);
|
||||||
index = 0;
|
index = 0;
|
||||||
state = Tokenizer.CDATA_START;
|
state = Tokenizer.CDATA_START;
|
||||||
continue stateloop;
|
continue stateloop;
|
||||||
} else {
|
|
||||||
// fall through
|
|
||||||
}
|
}
|
||||||
|
// else fall through
|
||||||
default:
|
default:
|
||||||
errBogusComment();
|
errBogusComment();
|
||||||
clearLongStrBuf();
|
clearLongStrBuf();
|
||||||
|
|
|
@ -5220,6 +5220,14 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||||
|
|
||||||
// ]NOCPP]
|
// ]NOCPP]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see nu.validator.htmlparser.common.TokenHandler#cdataSectionAllowed()
|
||||||
|
*/
|
||||||
|
@Override public boolean cdataSectionAllowed() throws SAXException {
|
||||||
|
return inForeign && currentPtr >= 0
|
||||||
|
&& stack[currentPtr].ns != "http://www.w3.org/1999/xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The argument MUST be an interned string or <code>null</code>.
|
* The argument MUST be an interned string or <code>null</code>.
|
||||||
*
|
*
|
||||||
|
@ -5582,7 +5590,6 @@ public abstract class TreeBuilder<T> implements TokenHandler,
|
||||||
/**
|
/**
|
||||||
* Returns the foreignFlag.
|
* Returns the foreignFlag.
|
||||||
*
|
*
|
||||||
* @see nu.validator.htmlparser.common.TokenHandler#isInForeign()
|
|
||||||
* @return the foreignFlag
|
* @return the foreignFlag
|
||||||
*/
|
*/
|
||||||
public boolean isInForeign() {
|
public boolean isInForeign() {
|
||||||
|
|
|
@ -949,12 +949,11 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
}
|
}
|
||||||
case '[': {
|
case '[': {
|
||||||
if (tokenHandler->isInForeign()) {
|
if (tokenHandler->cdataSectionAllowed()) {
|
||||||
clearLongStrBufAndAppend(c);
|
clearLongStrBufAndAppend(c);
|
||||||
index = 0;
|
index = 0;
|
||||||
state = NS_HTML5TOKENIZER_CDATA_START;
|
state = NS_HTML5TOKENIZER_CDATA_START;
|
||||||
NS_HTML5_CONTINUE(stateloop);
|
NS_HTML5_CONTINUE(stateloop);
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
|
@ -3722,6 +3722,12 @@ nsHtml5TreeBuilder::requestSuspension()
|
||||||
tokenizer->requestSuspension();
|
tokenizer->requestSuspension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
nsHtml5TreeBuilder::cdataSectionAllowed()
|
||||||
|
{
|
||||||
|
return inForeign && currentPtr >= 0 && stack[currentPtr]->ns != kNameSpaceID_XHTML;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHtml5TreeBuilder::setFragmentContext(nsIAtom* context, PRInt32 ns, nsIContent** node, PRBool quirks)
|
nsHtml5TreeBuilder::setFragmentContext(nsIAtom* context, PRInt32 ns, nsIContent** node, PRBool quirks)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,6 +209,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
|
||||||
void elementPushed(PRInt32 ns, nsIAtom* name, nsIContent** node);
|
void elementPushed(PRInt32 ns, nsIAtom* name, nsIContent** node);
|
||||||
void elementPopped(PRInt32 ns, nsIAtom* name, nsIContent** node);
|
void elementPopped(PRInt32 ns, nsIAtom* name, nsIContent** node);
|
||||||
public:
|
public:
|
||||||
|
PRBool cdataSectionAllowed();
|
||||||
void setFragmentContext(nsIAtom* context, PRInt32 ns, nsIContent** node, PRBool quirks);
|
void setFragmentContext(nsIAtom* context, PRInt32 ns, nsIContent** node, PRBool quirks);
|
||||||
protected:
|
protected:
|
||||||
nsIContent** currentNode();
|
nsIContent** currentNode();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче