зеркало из https://github.com/mozilla/pjs.git
Deal with multiple BODY elements passed by the parser by ignoring all but the first
This commit is contained in:
Родитель
475cd91987
Коммит
5d9b49edf0
|
@ -99,6 +99,7 @@ public:
|
||||||
nsresult FlushText();
|
nsresult FlushText();
|
||||||
|
|
||||||
PRBool mHitSentinel;
|
PRBool mHitSentinel;
|
||||||
|
PRBool mSeenBody;
|
||||||
|
|
||||||
nsIContent* mRoot;
|
nsIContent* mRoot;
|
||||||
nsIParser* mParser;
|
nsIParser* mParser;
|
||||||
|
@ -132,6 +133,7 @@ nsHTMLFragmentContentSink::nsHTMLFragmentContentSink()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mHitSentinel = PR_FALSE;
|
mHitSentinel = PR_FALSE;
|
||||||
|
mSeenBody = PR_TRUE;
|
||||||
mRoot = nsnull;
|
mRoot = nsnull;
|
||||||
mParser = nsnull;
|
mParser = nsnull;
|
||||||
mCurrentForm = nsnull;
|
mCurrentForm = nsnull;
|
||||||
|
@ -292,7 +294,15 @@ nsHTMLFragmentContentSink::CloseHead(const nsIParserNode& aNode)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLFragmentContentSink::OpenBody(const nsIParserNode& aNode)
|
nsHTMLFragmentContentSink::OpenBody(const nsIParserNode& aNode)
|
||||||
{
|
{
|
||||||
return OpenContainer(aNode);
|
// Ignore repeated BODY elements. The DTD is just sending them
|
||||||
|
// to us for compatibility reasons that don't apply here.
|
||||||
|
if (!mSeenBody) {
|
||||||
|
mSeenBody = PR_TRUE;
|
||||||
|
return OpenContainer(aNode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -99,6 +99,7 @@ public:
|
||||||
nsresult FlushText();
|
nsresult FlushText();
|
||||||
|
|
||||||
PRBool mHitSentinel;
|
PRBool mHitSentinel;
|
||||||
|
PRBool mSeenBody;
|
||||||
|
|
||||||
nsIContent* mRoot;
|
nsIContent* mRoot;
|
||||||
nsIParser* mParser;
|
nsIParser* mParser;
|
||||||
|
@ -132,6 +133,7 @@ nsHTMLFragmentContentSink::nsHTMLFragmentContentSink()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mHitSentinel = PR_FALSE;
|
mHitSentinel = PR_FALSE;
|
||||||
|
mSeenBody = PR_TRUE;
|
||||||
mRoot = nsnull;
|
mRoot = nsnull;
|
||||||
mParser = nsnull;
|
mParser = nsnull;
|
||||||
mCurrentForm = nsnull;
|
mCurrentForm = nsnull;
|
||||||
|
@ -292,7 +294,15 @@ nsHTMLFragmentContentSink::CloseHead(const nsIParserNode& aNode)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLFragmentContentSink::OpenBody(const nsIParserNode& aNode)
|
nsHTMLFragmentContentSink::OpenBody(const nsIParserNode& aNode)
|
||||||
{
|
{
|
||||||
return OpenContainer(aNode);
|
// Ignore repeated BODY elements. The DTD is just sending them
|
||||||
|
// to us for compatibility reasons that don't apply here.
|
||||||
|
if (!mSeenBody) {
|
||||||
|
mSeenBody = PR_TRUE;
|
||||||
|
return OpenContainer(aNode);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
Загрузка…
Ссылка в новой задаче