Sanity check return values on window.parent, window.top
This commit is contained in:
Родитель
33bce2cc76
Коммит
beba90af07
|
@ -283,6 +283,8 @@ GlobalWindowImpl::GetParent(nsIDOMWindow** aParent)
|
|||
nsIWebShell *mParentWebShell;
|
||||
mWebShell->GetParent(mParentWebShell);
|
||||
|
||||
*aParent = nsnull;
|
||||
|
||||
if (nsnull != mParentWebShell) {
|
||||
nsIScriptContextOwner *mParentContextOwner;
|
||||
if (NS_OK == mParentWebShell->QueryInterface(kIScriptContextOwnerIID, (void**)&mParentContextOwner)) {
|
||||
|
@ -294,7 +296,12 @@ GlobalWindowImpl::GetParent(nsIDOMWindow** aParent)
|
|||
NS_RELEASE(mParentContextOwner);
|
||||
}
|
||||
NS_RELEASE(mParentWebShell);
|
||||
}
|
||||
else {
|
||||
*aParent = this;
|
||||
NS_ADDREF(this);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -319,6 +326,8 @@ GlobalWindowImpl::GetTop(nsIDOMWindow** aTop)
|
|||
nsIWebShell *mRootWebShell;
|
||||
mWebShell->GetRootWebShell(mRootWebShell);
|
||||
|
||||
*aTop = nsnull;
|
||||
|
||||
if (nsnull != mRootWebShell) {
|
||||
nsIScriptContextOwner *mRootContextOwner;
|
||||
if (NS_OK == mRootWebShell->QueryInterface(kIScriptContextOwnerIID, (void**)&mRootContextOwner)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче