зеркало из https://github.com/mozilla/pjs.git
bug 77257, add null checks to mozilla wrappers, code by sicking@bigfoot.com, r=me, sr=jst, a=peterv
This commit is contained in:
Родитель
64e5cb41f6
Коммит
1e15480726
|
@ -173,7 +173,7 @@ Attr* Element::getAttributeNode(const String& aName)
|
|||
Attr* Element::setAttributeNode(Attr* aNewAttr)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Element)
|
||||
nsCOMPtr<nsIDOMAttr> newAttr(do_QueryInterface(aNewAttr->getNSObj()));
|
||||
nsCOMPtr<nsIDOMAttr> newAttr(do_QueryInterface(GET_NSOBJ(aNewAttr)));
|
||||
nsCOMPtr<nsIDOMAttr> returnAttr;
|
||||
|
||||
if (NS_SUCCEEDED(nsElement->SetAttributeNode(newAttr,
|
||||
|
@ -195,7 +195,7 @@ Attr* Element::setAttributeNode(Attr* aNewAttr)
|
|||
Attr* Element::removeAttributeNode(Attr* aOldAttr)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Element)
|
||||
nsCOMPtr<nsIDOMAttr> oldAttr(do_QueryInterface(aOldAttr->getNSObj()));
|
||||
nsCOMPtr<nsIDOMAttr> oldAttr(do_QueryInterface(GET_NSOBJ(aOldAttr)));
|
||||
nsCOMPtr<nsIDOMAttr> removedAttr;
|
||||
Attr* attrWrapper = NULL;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ Node* NamedNodeMap::getNamedItem(const String& aName)
|
|||
Node* NamedNodeMap::setNamedItem(Node* aNode)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(NamedNodeMap)
|
||||
nsCOMPtr<nsIDOMNode> nsNode(do_QueryInterface(aNode->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> nsNode(do_QueryInterface(GET_NSOBJ(aNode)));
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (NS_SUCCEEDED(nsNamedNodeMap->SetNamedItem(nsNode,
|
||||
|
|
|
@ -266,8 +266,8 @@ void Node::setNodeValue(const String& aNewNodeValue)
|
|||
Node* Node::insertBefore(Node* aNewChild, Node* aRefChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(aNewChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> refChild(do_QueryInterface(aRefChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(GET_NSOBJ(aNewChild)));
|
||||
nsCOMPtr<nsIDOMNode> refChild(do_QueryInterface(GET_NSOBJ(aRefChild)));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->InsertBefore(newChild, refChild,
|
||||
|
@ -288,8 +288,8 @@ Node* Node::insertBefore(Node* aNewChild, Node* aRefChild)
|
|||
Node* Node::replaceChild(Node* aNewChild, Node* aOldChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(aNewChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> oldChild(do_QueryInterface(aOldChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(GET_NSOBJ(aNewChild)));
|
||||
nsCOMPtr<nsIDOMNode> oldChild(do_QueryInterface(GET_NSOBJ(aOldChild)));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->ReplaceChild(newChild,
|
||||
|
@ -309,7 +309,7 @@ Node* Node::replaceChild(Node* aNewChild, Node* aOldChild)
|
|||
Node* Node::removeChild(Node* aOldChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> oldChild(do_QueryInterface(aOldChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> oldChild(do_QueryInterface(GET_NSOBJ(aOldChild)));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->RemoveChild(oldChild,
|
||||
|
@ -329,7 +329,7 @@ Node* Node::removeChild(Node* aOldChild)
|
|||
Node* Node::appendChild(Node* aNewChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(aNewChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(GET_NSOBJ(aNewChild)));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->AppendChild(newChild,
|
||||
|
|
|
@ -143,6 +143,11 @@ _txClass* Document::_function(nsIDOM##_txClass* aNsObject) \
|
|||
return wrapper; \
|
||||
}
|
||||
|
||||
/**
|
||||
* This macro does a nullsafe getNSObj. If the wrapper object is NULL,
|
||||
* NULL is returned. Else getNSObj is used to get the inner object.
|
||||
*/
|
||||
#define GET_NSOBJ(_txWrapper) ((_txWrapper) ? (_txWrapper)->getNSObj() : NULL)
|
||||
|
||||
/**
|
||||
* Base wrapper class for a Mozilla object. Owns the Mozilla object through an
|
||||
|
|
Загрузка…
Ссылка в новой задаче