Bug 456008. Make sure to not claim nodes are created via parser in the XML fragment sink, just like the HTML fragment sink doesn't claim it. r+sr=jst

This commit is contained in:
Boris Zbarsky 2008-09-25 12:58:11 -04:00
Родитель 86c3085de6
Коммит 697d3353ca
8 изменённых файлов: 42 добавлений и 11 удалений

Просмотреть файл

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<body>
<div id="target"></div>
<script>
document.getElementById("target").innerHTML =
"<object type='text/html' data='data:text/html,&lt;body bgcolor=&quot;green&quot;&gt;' width='300' height='200'></object>";
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div id="target"></div>
<script>
<![CDATA[
document.getElementById("target").innerHTML =
"<object type='text/html' data='data:text/html,&lt;body bgcolor=&quot;green&quot;&gt;' width='300' height='200'></object>";
]]>
</script>
</body>
</html>

Просмотреть файл

@ -1,2 +1,3 @@
== bug453105.html bug453105-ref.html
== optiontext.html optiontext-ref.html
== bug456008.xhtml bug456008-ref.html

Просмотреть файл

@ -867,14 +867,15 @@ nsXBLContentSink::ConstructParameter(const PRUnichar **aAtts)
nsresult
nsXBLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent)
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser)
{
#ifdef MOZ_XUL
if (!aNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {
#endif
return nsXMLContentSink::CreateElement(aAtts, aAttsCount, aNodeInfo,
aLineNumber, aResult,
aAppendContent);
aAppendContent, aFromParser);
#ifdef MOZ_XUL
}

Просмотреть файл

@ -122,7 +122,8 @@ protected:
nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent);
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser);
nsresult AddAttributes(const PRUnichar** aAtts,
nsIContent* aContent);

Просмотреть файл

@ -497,7 +497,8 @@ nsXMLContentSink::SetParser(nsIParser* aParser)
nsresult
nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent)
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser)
{
NS_ASSERTION(aNodeInfo, "can't create element without nodeinfo");
@ -507,7 +508,7 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsCOMPtr<nsIContent> content;
rv = NS_NewElement(getter_AddRefs(content), aNodeInfo->NamespaceID(),
aNodeInfo, PR_TRUE);
aNodeInfo, aFromParser);
NS_ENSURE_SUCCESS(rv, rv);
if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML)
@ -1005,7 +1006,7 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
result = CreateElement(aAtts, aAttsCount, nodeInfo, aLineNumber,
getter_AddRefs(content), &appendContent);
getter_AddRefs(content), &appendContent, PR_TRUE);
NS_ENSURE_SUCCESS(result, result);
// Have to do this before we push the new content on the stack... and have to

Просмотреть файл

@ -135,7 +135,8 @@ protected:
nsIContent *aContent);
virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent);
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser);
// aParent is allowed to be null here if this is the root content
// being closed

Просмотреть файл

@ -115,7 +115,8 @@ protected:
nsIContent *aContent);
virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent);
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser);
virtual nsresult CloseElement(nsIContent* aContent);
virtual void MaybeStartLayout(PRBool aIgnorePendingSheets);
@ -256,11 +257,15 @@ nsXMLFragmentContentSink::SetDocElement(PRInt32 aNameSpaceID,
nsresult
nsXMLFragmentContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent)
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser)
{
// Claim to not be coming from parser, since we don't do any of the
// fancy CloseElement stuff.
nsresult rv = nsXMLContentSink::CreateElement(aAtts, aAttsCount,
aNodeInfo, aLineNumber,
aResult, aAppendContent);
aNodeInfo, aLineNumber,
aResult, aAppendContent,
PR_FALSE);
// When we aren't grabbing all of the content we, never open a doc
// element, we run into trouble on the first element, so we don't append,