Bug 761448, be more strict when to allow docshell loads, r=bz, a=akeybl

This commit is contained in:
Olli Pettay 2013-01-08 19:12:41 +02:00
Родитель 3f1b0abc0c
Коммит 2a01a34912
2 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -8651,6 +8651,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
return NS_ERROR_FAILURE;
}
NS_ENSURE_STATE(!HasUnloadedParent());
rv = CheckLoadingPermissions();
if (NS_FAILED(rv)) {
return rv;
@ -12440,3 +12442,23 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
*aOut = false;
return NS_OK;
}
bool
nsDocShell::HasUnloadedParent()
{
nsCOMPtr<nsIDocShellTreeItem> currentTreeItem = this;
while (currentTreeItem) {
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
currentTreeItem->GetParent(getter_AddRefs(parentTreeItem));
nsCOMPtr<nsIDocShell> parent = do_QueryInterface(parentTreeItem);
if (parent) {
bool inUnload = false;
parent->GetIsInUnload(&inUnload);
if (inUnload) {
return true;
}
}
currentTreeItem.swap(parentTreeItem);
}
return false;
}

Просмотреть файл

@ -675,6 +675,8 @@ protected:
FrameType GetInheritedFrameType();
bool HasUnloadedParent();
// hash of session storages, keyed by domain
nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;