зеркало из https://github.com/mozilla/gecko-dev.git
Fixing #35605, avoid accessing a null pointer in GetOffsetParent()!
This commit is contained in:
Родитель
a73404c364
Коммит
6656f5324e
|
@ -624,13 +624,20 @@ nsGenericHTMLElement::GetOffsetHeight(PRInt32* aOffsetHeight)
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
|
nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aOffsetParent);
|
||||||
|
|
||||||
nsRect rcFrame;
|
nsRect rcFrame;
|
||||||
nsCOMPtr<nsIContent> parent;
|
nsCOMPtr<nsIContent> parent;
|
||||||
nsresult res = GetOffsetRect(rcFrame,
|
nsresult res = GetOffsetRect(rcFrame,
|
||||||
nsHTMLAtoms::body,
|
nsHTMLAtoms::body,
|
||||||
getter_AddRefs(parent));
|
getter_AddRefs(parent));
|
||||||
if (NS_SUCCEEDED(res)) {
|
if (NS_SUCCEEDED(res)) {
|
||||||
res = parent->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aOffsetParent);
|
if (parent) {
|
||||||
|
res = parent->QueryInterface(NS_GET_IID(nsIDOMElement),
|
||||||
|
(void**)aOffsetParent);
|
||||||
|
} else {
|
||||||
|
*aOffsetParent = nsnull;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,13 +624,20 @@ nsGenericHTMLElement::GetOffsetHeight(PRInt32* aOffsetHeight)
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
|
nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aOffsetParent);
|
||||||
|
|
||||||
nsRect rcFrame;
|
nsRect rcFrame;
|
||||||
nsCOMPtr<nsIContent> parent;
|
nsCOMPtr<nsIContent> parent;
|
||||||
nsresult res = GetOffsetRect(rcFrame,
|
nsresult res = GetOffsetRect(rcFrame,
|
||||||
nsHTMLAtoms::body,
|
nsHTMLAtoms::body,
|
||||||
getter_AddRefs(parent));
|
getter_AddRefs(parent));
|
||||||
if (NS_SUCCEEDED(res)) {
|
if (NS_SUCCEEDED(res)) {
|
||||||
res = parent->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aOffsetParent);
|
if (parent) {
|
||||||
|
res = parent->QueryInterface(NS_GET_IID(nsIDOMElement),
|
||||||
|
(void**)aOffsetParent);
|
||||||
|
} else {
|
||||||
|
*aOffsetParent = nsnull;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче