Bug 835417 part 1. Mark Node.namespaceURI as not throwing, since [Constant] things aren't allowed to throw (though we were not enforcing that). r=peterv

This commit is contained in:
Boris Zbarsky 2013-01-29 17:53:52 -05:00
parent a94eb57cf0
commit 12de7c3472
6 changed files with 16 additions and 19 deletions

View File

@ -1550,9 +1550,9 @@ public:
already_AddRefed<nsINode> CloneNode(bool aDeep, mozilla::ErrorResult& aError);
bool IsEqualNode(nsINode* aNode);
bool IsSupported(const nsAString& aFeature, const nsAString& aVersion);
void GetNamespaceURI(nsAString& aNamespaceURI, mozilla::ErrorResult& aError) const
void GetNamespaceURI(nsAString& aNamespaceURI) const
{
aError = mNodeInfo->GetNamespaceURI(aNamespaceURI);
mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
#ifdef MOZILLA_INTERNAL_API
void GetPrefix(nsAString& aPrefix)
@ -2000,9 +2000,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsINode, NS_INODE_IID)
} \
NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI) __VA_ARGS__ \
{ \
mozilla::ErrorResult rv; \
nsINode::GetNamespaceURI(aNamespaceURI, rv); \
return rv.ErrorCode(); \
nsINode::GetNamespaceURI(aNamespaceURI); \
return NS_OK; \
} \
NS_IMETHOD GetPrefix(nsAString& aPrefix) __VA_ARGS__ \
{ \

View File

@ -132,7 +132,7 @@ public:
/*
* Get the namespace URI for a node, if the node has a namespace URI.
*/
virtual nsresult GetNamespaceURI(nsAString& aNameSpaceURI) const = 0;
virtual void GetNamespaceURI(nsAString& aNameSpaceURI) const = 0;
/*
* Get the namespace ID for a node if the node has a namespace, if not this

View File

@ -208,19 +208,20 @@ NS_INTERFACE_MAP_END
// nsINodeInfo
nsresult
void
nsNodeInfo::GetNamespaceURI(nsAString& aNameSpaceURI) const
{
nsresult rv = NS_OK;
if (mInner.mNamespaceID > 0) {
rv = nsContentUtils::NameSpaceManager()->GetNameSpaceURI(mInner.mNamespaceID,
nsresult rv =
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(mInner.mNamespaceID,
aNameSpaceURI);
// How can we possibly end up with a bogus namespace ID here?
if (NS_FAILED(rv)) {
MOZ_CRASH();
}
} else {
SetDOMStringToNull(aNameSpaceURI);
}
return rv;
}

View File

@ -29,7 +29,7 @@ public:
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsNodeInfo)
// nsINodeInfo
virtual nsresult GetNamespaceURI(nsAString& aNameSpaceURI) const;
virtual void GetNamespaceURI(nsAString& aNameSpaceURI) const;
virtual bool NamespaceEquals(const nsAString& aNamespaceURI) const;
// nsNodeInfo

View File

@ -478,10 +478,7 @@ nsXULPrototypeDocument::Write(nsIObjectOutputStream* aStream)
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE);
nsAutoString namespaceURI;
tmp = nodeInfo->GetNamespaceURI(namespaceURI);
if (NS_FAILED(tmp)) {
rv = tmp;
}
nodeInfo->GetNamespaceURI(namespaceURI);
tmp = aStream->WriteWStringZ(namespaceURI.get());
if (NS_FAILED(tmp)) {
rv = tmp;

View File

@ -82,7 +82,7 @@ interface Node : EventTarget {
readonly attribute NamedNodeMap? attributes;
// If we move namespaceURI, prefix and localName to Element they should return
// a non-nullable type.
[Throws, Constant]
[Constant]
readonly attribute DOMString? namespaceURI;
[Constant]
readonly attribute DOMString? prefix;