added code to ignore unknown namespace prefix for attributes

(actually the parser should've rejected it before here)
This commit is contained in:
peterl%netscape.com 1999-06-10 05:18:46 +00:00
Родитель fa94e3b67e
Коммит 784f0c9bee
19 изменённых файлов: 115 добавлений и 8 удалений

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

@ -22,6 +22,7 @@
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDOMScriptObjectFactory.h" #include "nsIDOMScriptObjectFactory.h"
#include "nsITextContent.h" #include "nsITextContent.h"
#include "nsINameSpaceManager.h"
static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID); static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID);
static NS_DEFINE_IID(kIDOMAttributePrivateIID, NS_IDOMATTRIBUTEPRIVATE_IID); static NS_DEFINE_IID(kIDOMAttributePrivateIID, NS_IDOMATTRIBUTEPRIVATE_IID);
@ -158,6 +159,9 @@ nsDOMAttribute::GetValue(nsString& aValue)
nsresult attrResult; nsresult attrResult;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, mValue); attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, mValue);
if (NS_CONTENT_ATTR_NOT_THERE == attrResult) { if (NS_CONTENT_ATTR_NOT_THERE == attrResult) {
mValue.Truncate(); mValue.Truncate();
@ -177,6 +181,9 @@ nsDOMAttribute::SetValue(const nsString& aValue)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE); result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE);
NS_IF_RELEASE(nameAtom); NS_IF_RELEASE(nameAtom);
} }
@ -199,6 +206,9 @@ nsDOMAttribute::GetSpecified(PRBool* aSpecified)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, value); attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, value);
NS_IF_RELEASE(nameAtom); NS_IF_RELEASE(nameAtom);
if (NS_CONTENT_ATTR_HAS_VALUE == attrResult) { if (NS_CONTENT_ATTR_HAS_VALUE == attrResult) {
@ -369,6 +379,9 @@ nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
mContent->GetAttribute(nameSpaceID, nameAtom, value); mContent->GetAttribute(nameSpaceID, nameAtom, value);
newAttr = new nsDOMAttribute(nsnull, mName, value); newAttr = new nsDOMAttribute(nsnull, mName, value);
} }

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

@ -241,6 +241,9 @@ nsDOMAttributeMap::GetNamedItem(const nsString &aAttrName,
nsAutoString normalizedName; nsAutoString normalizedName;
mContent->ParseAttributeString(aAttrName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aAttrName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNormalizedName(nameSpaceID, nameAtom, normalizedName); GetNormalizedName(nameSpaceID, nameAtom, normalizedName);
result = GetNamedItemCommon(normalizedName, result = GetNamedItemCommon(normalizedName,
nameSpaceID, nameSpaceID,
@ -279,6 +282,9 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn)
// Get normalized attribute name // Get normalized attribute name
attribute->GetName(name); attribute->GetName(name);
mContent->ParseAttributeString(name, nameAtom, nameSpaceID); mContent->ParseAttributeString(name, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNormalizedName(nameSpaceID, nameAtom, name); GetNormalizedName(nameSpaceID, nameAtom, name);
name.ToCString(buf, sizeof(buf)); name.ToCString(buf, sizeof(buf));
result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &oldAttribute); result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &oldAttribute);
@ -361,6 +367,9 @@ nsDOMAttributeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsAutoString name; nsAutoString name;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNormalizedName(nameSpaceID, nameAtom, name); GetNormalizedName(nameSpaceID, nameAtom, name);
name.ToCString(buf, sizeof(buf)); name.ToCString(buf, sizeof(buf));
result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &attribute); result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &attribute);

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

@ -47,11 +47,11 @@
#include "nsIDOMDOMImplementation.h" #include "nsIDOMDOMImplementation.h"
#include "nsGenericElement.h" #include "nsGenericElement.h"
#include "nsCSSPropIDs.h" //#include "nsCSSPropIDs.h"
#include "nsCSSProps.h" //#include "nsCSSProps.h"
#include "nsICSSStyleSheet.h" #include "nsICSSStyleSheet.h"
#include "nsICSSStyleRule.h" //#include "nsICSSStyleRule.h"
#include "nsICSSDeclaration.h" //#include "nsICSSDeclaration.h"
#include "nsITextContent.h" #include "nsITextContent.h"
#include "nsXIFConverter.h" #include "nsXIFConverter.h"

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

@ -394,6 +394,9 @@ nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
mContent->GetAttribute(nameSpaceID, nameAtom, aReturn); mContent->GetAttribute(nameSpaceID, nameAtom, aReturn);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);
@ -409,6 +412,9 @@ nsGenericElement::SetAttribute(const nsString& aName,
nsresult result = NS_OK; nsresult result = NS_OK;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE); result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);
@ -423,6 +429,9 @@ nsGenericElement::RemoveAttribute(const nsString& aName)
nsresult result = NS_OK; nsresult result = NS_OK;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
result = mContent->UnsetAttribute(nameSpaceID, nameAtom, PR_TRUE); result = mContent->UnsetAttribute(nameSpaceID, nameAtom, PR_TRUE);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);

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

@ -442,6 +442,9 @@ nsXULAttributes::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn)
if (NS_FAILED(rv = mContent->ParseAttributeString(aName, name, nameSpaceID))) if (NS_FAILED(rv = mContent->ParseAttributeString(aName, name, nameSpaceID)))
return rv; return rv;
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
// XXX doing this instead of calling mContent->GetAttribute() will // XXX doing this instead of calling mContent->GetAttribute() will
// make it a lot harder to lazily instantiate properties from the // make it a lot harder to lazily instantiate properties from the
// graph. The problem is, how else do we get the named item? // graph. The problem is, how else do we get the named item?

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

@ -879,6 +879,9 @@ RDFElementImpl::GetAttribute(const nsString& aName, nsString& aReturn)
NS_WARNING("unable to parse attribute name"); NS_WARNING("unable to parse attribute name");
return rv; return rv;
} }
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetAttribute(nameSpaceID, nameAtom, aReturn); GetAttribute(nameSpaceID, nameAtom, aReturn);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);

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

@ -1643,6 +1643,9 @@ RDFGenericBuilderImpl::OnSetAttribute(nsIDOMElement* aElement, const nsString& a
} }
// If we get here, it's a "vanilla" property: push its value into the graph. // If we get here, it's a "vanilla" property: push its value into the graph.
if (kNameSpaceID_Unknown == attrNameSpaceID) {
attrNameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
@ -1746,6 +1749,9 @@ RDFGenericBuilderImpl::OnRemoveAttribute(nsIDOMElement* aElement, const nsString
// It's a "vanilla" property: push its value into the graph. // It's a "vanilla" property: push its value into the graph.
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (kNameSpaceID_Unknown == attrNameSpaceID) {
attrNameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
return rv; return rv;

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

@ -22,6 +22,7 @@
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDOMScriptObjectFactory.h" #include "nsIDOMScriptObjectFactory.h"
#include "nsITextContent.h" #include "nsITextContent.h"
#include "nsINameSpaceManager.h"
static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID); static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID);
static NS_DEFINE_IID(kIDOMAttributePrivateIID, NS_IDOMATTRIBUTEPRIVATE_IID); static NS_DEFINE_IID(kIDOMAttributePrivateIID, NS_IDOMATTRIBUTEPRIVATE_IID);
@ -158,6 +159,9 @@ nsDOMAttribute::GetValue(nsString& aValue)
nsresult attrResult; nsresult attrResult;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, mValue); attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, mValue);
if (NS_CONTENT_ATTR_NOT_THERE == attrResult) { if (NS_CONTENT_ATTR_NOT_THERE == attrResult) {
mValue.Truncate(); mValue.Truncate();
@ -177,6 +181,9 @@ nsDOMAttribute::SetValue(const nsString& aValue)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE); result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE);
NS_IF_RELEASE(nameAtom); NS_IF_RELEASE(nameAtom);
} }
@ -199,6 +206,9 @@ nsDOMAttribute::GetSpecified(PRBool* aSpecified)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, value); attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, value);
NS_IF_RELEASE(nameAtom); NS_IF_RELEASE(nameAtom);
if (NS_CONTENT_ATTR_HAS_VALUE == attrResult) { if (NS_CONTENT_ATTR_HAS_VALUE == attrResult) {
@ -369,6 +379,9 @@ nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID); mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
mContent->GetAttribute(nameSpaceID, nameAtom, value); mContent->GetAttribute(nameSpaceID, nameAtom, value);
newAttr = new nsDOMAttribute(nsnull, mName, value); newAttr = new nsDOMAttribute(nsnull, mName, value);
} }

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

@ -241,6 +241,9 @@ nsDOMAttributeMap::GetNamedItem(const nsString &aAttrName,
nsAutoString normalizedName; nsAutoString normalizedName;
mContent->ParseAttributeString(aAttrName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aAttrName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNormalizedName(nameSpaceID, nameAtom, normalizedName); GetNormalizedName(nameSpaceID, nameAtom, normalizedName);
result = GetNamedItemCommon(normalizedName, result = GetNamedItemCommon(normalizedName,
nameSpaceID, nameSpaceID,
@ -279,6 +282,9 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn)
// Get normalized attribute name // Get normalized attribute name
attribute->GetName(name); attribute->GetName(name);
mContent->ParseAttributeString(name, nameAtom, nameSpaceID); mContent->ParseAttributeString(name, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNormalizedName(nameSpaceID, nameAtom, name); GetNormalizedName(nameSpaceID, nameAtom, name);
name.ToCString(buf, sizeof(buf)); name.ToCString(buf, sizeof(buf));
result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &oldAttribute); result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &oldAttribute);
@ -361,6 +367,9 @@ nsDOMAttributeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsAutoString name; nsAutoString name;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNormalizedName(nameSpaceID, nameAtom, name); GetNormalizedName(nameSpaceID, nameAtom, name);
name.ToCString(buf, sizeof(buf)); name.ToCString(buf, sizeof(buf));
result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &attribute); result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &attribute);

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

@ -47,11 +47,11 @@
#include "nsIDOMDOMImplementation.h" #include "nsIDOMDOMImplementation.h"
#include "nsGenericElement.h" #include "nsGenericElement.h"
#include "nsCSSPropIDs.h" //#include "nsCSSPropIDs.h"
#include "nsCSSProps.h" //#include "nsCSSProps.h"
#include "nsICSSStyleSheet.h" #include "nsICSSStyleSheet.h"
#include "nsICSSStyleRule.h" //#include "nsICSSStyleRule.h"
#include "nsICSSDeclaration.h" //#include "nsICSSDeclaration.h"
#include "nsITextContent.h" #include "nsITextContent.h"
#include "nsXIFConverter.h" #include "nsXIFConverter.h"

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

@ -394,6 +394,9 @@ nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn)
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
mContent->GetAttribute(nameSpaceID, nameAtom, aReturn); mContent->GetAttribute(nameSpaceID, nameAtom, aReturn);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);
@ -409,6 +412,9 @@ nsGenericElement::SetAttribute(const nsString& aName,
nsresult result = NS_OK; nsresult result = NS_OK;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE); result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);
@ -423,6 +429,9 @@ nsGenericElement::RemoveAttribute(const nsString& aName)
nsresult result = NS_OK; nsresult result = NS_OK;
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID); mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
result = mContent->UnsetAttribute(nameSpaceID, nameAtom, PR_TRUE); result = mContent->UnsetAttribute(nameSpaceID, nameAtom, PR_TRUE);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);

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

@ -1073,6 +1073,9 @@ RDFContentSinkImpl::AddProperties(const nsIParserNode& aNode,
nsRDFParserUtils::StripAndConvert(v); nsRDFParserUtils::StripAndConvert(v);
nsAutoString k; nsAutoString k;
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetNameSpaceURI(nameSpaceID, k); GetNameSpaceURI(nameSpaceID, k);
k.Append(attr->GetUnicode()); k.Append(attr->GetUnicode());

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

@ -879,6 +879,9 @@ RDFElementImpl::GetAttribute(const nsString& aName, nsString& aReturn)
NS_WARNING("unable to parse attribute name"); NS_WARNING("unable to parse attribute name");
return rv; return rv;
} }
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetAttribute(nameSpaceID, nameAtom, aReturn); GetAttribute(nameSpaceID, nameAtom, aReturn);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);

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

@ -1643,6 +1643,9 @@ RDFGenericBuilderImpl::OnSetAttribute(nsIDOMElement* aElement, const nsString& a
} }
// If we get here, it's a "vanilla" property: push its value into the graph. // If we get here, it's a "vanilla" property: push its value into the graph.
if (kNameSpaceID_Unknown == attrNameSpaceID) {
attrNameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
@ -1746,6 +1749,9 @@ RDFGenericBuilderImpl::OnRemoveAttribute(nsIDOMElement* aElement, const nsString
// It's a "vanilla" property: push its value into the graph. // It's a "vanilla" property: push its value into the graph.
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (kNameSpaceID_Unknown == attrNameSpaceID) {
attrNameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
return rv; return rv;

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

@ -1508,6 +1508,9 @@ RDFXULBuilderImpl::OnSetAttribute(nsIDOMElement* aElement, const nsString& aName
// the RDF graph to update. So, build an RDF resource from the // the RDF graph to update. So, build an RDF resource from the
// property name... // property name...
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
if (NS_FAILED(rv = GetResource(nameSpaceID, nameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(nameSpaceID, nameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
return rv; return rv;
@ -1580,6 +1583,9 @@ RDFXULBuilderImpl::OnRemoveAttribute(nsIDOMElement* aElement, const nsString& aN
} }
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
if (NS_FAILED(rv = GetResource(nameSpaceID, nameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(nameSpaceID, nameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
return rv; return rv;

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

@ -442,6 +442,9 @@ nsXULAttributes::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn)
if (NS_FAILED(rv = mContent->ParseAttributeString(aName, name, nameSpaceID))) if (NS_FAILED(rv = mContent->ParseAttributeString(aName, name, nameSpaceID)))
return rv; return rv;
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
// XXX doing this instead of calling mContent->GetAttribute() will // XXX doing this instead of calling mContent->GetAttribute() will
// make it a lot harder to lazily instantiate properties from the // make it a lot harder to lazily instantiate properties from the
// graph. The problem is, how else do we get the named item? // graph. The problem is, how else do we get the named item?

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

@ -879,6 +879,9 @@ RDFElementImpl::GetAttribute(const nsString& aName, nsString& aReturn)
NS_WARNING("unable to parse attribute name"); NS_WARNING("unable to parse attribute name");
return rv; return rv;
} }
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
GetAttribute(nameSpaceID, nameAtom, aReturn); GetAttribute(nameSpaceID, nameAtom, aReturn);
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);

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

@ -1643,6 +1643,9 @@ RDFGenericBuilderImpl::OnSetAttribute(nsIDOMElement* aElement, const nsString& a
} }
// If we get here, it's a "vanilla" property: push its value into the graph. // If we get here, it's a "vanilla" property: push its value into the graph.
if (kNameSpaceID_Unknown == attrNameSpaceID) {
attrNameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
@ -1746,6 +1749,9 @@ RDFGenericBuilderImpl::OnRemoveAttribute(nsIDOMElement* aElement, const nsString
// It's a "vanilla" property: push its value into the graph. // It's a "vanilla" property: push its value into the graph.
nsCOMPtr<nsIRDFResource> property; nsCOMPtr<nsIRDFResource> property;
if (kNameSpaceID_Unknown == attrNameSpaceID) {
attrNameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) { if (NS_FAILED(rv = GetResource(attrNameSpaceID, attrNameAtom, getter_AddRefs(property)))) {
NS_ERROR("unable to construct resource"); NS_ERROR("unable to construct resource");
return rv; return rv;

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

@ -1188,6 +1188,9 @@ XULContentSinkImpl::AddAttributes(const nsIParserNode& aNode,
nsIAtom* prefix = CutNameSpacePrefix(attr); nsIAtom* prefix = CutNameSpacePrefix(attr);
if (prefix) { if (prefix) {
SplitQualifiedName(key, nameSpaceID, attr); SplitQualifiedName(key, nameSpaceID, attr);
if (kNameSpaceID_Unknown == nameSpaceID) {
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
}
NS_RELEASE(prefix); NS_RELEASE(prefix);
} }
else { else {