зеркало из https://github.com/mozilla/pjs.git
No need to keep an owning reference to an element's NodeInfo if we already have an owning reference to the element. Bug 225825, r=bz, sr=jst.
This commit is contained in:
Родитель
a151276cc1
Коммит
a9d415efad
|
@ -551,7 +551,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
||||||
nsCOMPtr<nsIContent> cont = do_QueryInterface(aTrustedNode);
|
nsCOMPtr<nsIContent> cont = do_QueryInterface(aTrustedNode);
|
||||||
NS_ENSURE_TRUE(cont, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(cont, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> ni = cont->GetNodeInfo();
|
nsINodeInfo *ni = cont->GetNodeInfo();
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(ni, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
ni->GetDocumentPrincipal(getter_AddRefs(trustedPrincipal));
|
ni->GetDocumentPrincipal(getter_AddRefs(trustedPrincipal));
|
||||||
|
@ -787,7 +787,7 @@ nsContentUtils::ReparentContentWrapper(nsIContent *aContent,
|
||||||
nsIDocument* old_doc = aOldDocument;
|
nsIDocument* old_doc = aOldDocument;
|
||||||
|
|
||||||
if (!old_doc) {
|
if (!old_doc) {
|
||||||
nsCOMPtr<nsINodeInfo> ni = aContent->GetNodeInfo();
|
nsINodeInfo *ni = aContent->GetNodeInfo();
|
||||||
|
|
||||||
if (ni) {
|
if (ni) {
|
||||||
old_doc = ni->GetDocument();
|
old_doc = ni->GetDocument();
|
||||||
|
|
|
@ -158,7 +158,7 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn)
|
||||||
NS_ADDREF(*aReturn = domAttribute);
|
NS_ADDREF(*aReturn = domAttribute);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsCOMPtr<nsINodeInfo> contentNi = mContent->GetNodeInfo();
|
nsINodeInfo *contentNi = mContent->GetNodeInfo();
|
||||||
NS_ENSURE_TRUE(contentNi, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(contentNi, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
rv = contentNi->NodeInfoManager()->GetNodeInfo(name, nsnull,
|
rv = contentNi->NodeInfoManager()->GetNodeInfo(name, nsnull,
|
||||||
|
@ -235,11 +235,12 @@ nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||||
nsAutoString value, name;
|
nsAutoString value, name;
|
||||||
mContent->GetAttr(nameSpaceID, nameAtom, value);
|
mContent->GetAttr(nameSpaceID, nameAtom, value);
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> ni(mContent->GetNodeInfo());
|
nsINodeInfo *contentNi = mContent->GetNodeInfo();
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(contentNi, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfoManager> nimgr = ni->NodeInfoManager();
|
nsCOMPtr<nsINodeInfo> ni;
|
||||||
nimgr->GetNodeInfo(nameAtom, prefix, nameSpaceID, getter_AddRefs(ni));
|
contentNi->NodeInfoManager()->GetNodeInfo(nameAtom, prefix, nameSpaceID,
|
||||||
|
getter_AddRefs(ni));
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsDOMAttribute* domAttribute = new nsDOMAttribute(mContent, ni, value);
|
nsDOMAttribute* domAttribute = new nsDOMAttribute(mContent, ni, value);
|
||||||
|
@ -282,8 +283,8 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
|
||||||
PRInt32 nameSpaceID = kNameSpaceID_None;
|
PRInt32 nameSpaceID = kNameSpaceID_None;
|
||||||
nsCOMPtr<nsIAtom> prefix;
|
nsCOMPtr<nsIAtom> prefix;
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> ni(mContent->GetNodeInfo());
|
nsINodeInfo *contentNi = mContent->GetNodeInfo();
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(contentNi, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (aNamespaceURI.Length()) {
|
if (aNamespaceURI.Length()) {
|
||||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||||
|
@ -300,8 +301,9 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
|
||||||
getter_AddRefs(prefix), value);
|
getter_AddRefs(prefix), value);
|
||||||
|
|
||||||
if (NS_CONTENT_ATTR_NOT_THERE != attrResult && NS_SUCCEEDED(attrResult)) {
|
if (NS_CONTENT_ATTR_NOT_THERE != attrResult && NS_SUCCEEDED(attrResult)) {
|
||||||
nsCOMPtr<nsINodeInfoManager> nimgr = ni->NodeInfoManager();
|
nsCOMPtr<nsINodeInfo> ni;
|
||||||
nimgr->GetNodeInfo(nameAtom, prefix, nameSpaceID, getter_AddRefs(ni));
|
contentNi->NodeInfoManager()->GetNodeInfo(nameAtom, prefix, nameSpaceID,
|
||||||
|
getter_AddRefs(ni));
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsDOMAttribute* domAttribute = new nsDOMAttribute(mContent, ni, value);
|
nsDOMAttribute* domAttribute = new nsDOMAttribute(mContent, ni, value);
|
||||||
|
@ -349,11 +351,11 @@ nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
|
||||||
attribute->GetName(name);
|
attribute->GetName(name);
|
||||||
attribute->GetNamespaceURI(nsURI);
|
attribute->GetNamespaceURI(nsURI);
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> ni(mContent->GetNodeInfo());
|
nsINodeInfo *contentNi = mContent->GetNodeInfo();
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(contentNi, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfoManager> nimgr = ni->NodeInfoManager();
|
nsCOMPtr<nsINodeInfo> ni;
|
||||||
nimgr->GetNodeInfo(name, nsURI, getter_AddRefs(ni));
|
contentNi->NodeInfoManager()->GetNodeInfo(name, nsURI, getter_AddRefs(ni));
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsresult attrResult = mContent->GetAttr(ni->NamespaceID(),
|
nsresult attrResult = mContent->GetAttr(ni->NamespaceID(),
|
||||||
|
@ -400,8 +402,8 @@ nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
|
||||||
nsCOMPtr<nsIDOMNode> attribute;
|
nsCOMPtr<nsIDOMNode> attribute;
|
||||||
nsCOMPtr<nsIAtom> prefix;
|
nsCOMPtr<nsIAtom> prefix;
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> ni(mContent->GetNodeInfo());
|
nsINodeInfo *contentNi = mContent->GetNodeInfo();
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(contentNi, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (aNamespaceURI.Length()) {
|
if (aNamespaceURI.Length()) {
|
||||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||||
|
@ -417,8 +419,9 @@ nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
|
||||||
getter_AddRefs(prefix), value);
|
getter_AddRefs(prefix), value);
|
||||||
|
|
||||||
if (NS_CONTENT_ATTR_NOT_THERE != attrResult && NS_SUCCEEDED(attrResult)) {
|
if (NS_CONTENT_ATTR_NOT_THERE != attrResult && NS_SUCCEEDED(attrResult)) {
|
||||||
nsCOMPtr<nsINodeInfoManager> nimgr = ni->NodeInfoManager();
|
nsCOMPtr<nsINodeInfo> ni;
|
||||||
nimgr->GetNodeInfo(nameAtom, prefix, nameSpaceID, getter_AddRefs(ni));
|
contentNi->NodeInfoManager()->GetNodeInfo(nameAtom, prefix, nameSpaceID,
|
||||||
|
getter_AddRefs(ni));
|
||||||
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsDOMAttribute* domAttribute = new nsDOMAttribute(nsnull, ni, value);
|
nsDOMAttribute* domAttribute = new nsDOMAttribute(nsnull, ni, value);
|
||||||
|
|
|
@ -3830,11 +3830,12 @@ nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsINodeInfo> ni = aTargetNode->GetNodeInfo();
|
nsINodeInfo *contentNi = aTargetNode->GetNodeInfo();
|
||||||
|
nsCOMPtr<nsINodeInfo> ni;
|
||||||
|
|
||||||
if (ni) {
|
if (contentNi) {
|
||||||
nsCOMPtr<nsINodeInfoManager> manager = ni->NodeInfoManager();
|
contentNi->NodeInfoManager()->GetNodeInfo(attr, prefix,
|
||||||
manager->GetNodeInfo(attr, prefix, nameSpaceID,
|
nameSpaceID,
|
||||||
getter_AddRefs(ni));
|
getter_AddRefs(ni));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче