Bug 1018778 - Part b: use more early returns in nsDocumentViewer::SyncParentSubDocMap; r=roc

This commit is contained in:
Ms2ger 2014-06-06 10:06:25 +02:00
parent d008d6e04d
commit 67f40acbc2

View File

@ -573,29 +573,33 @@ nsDocumentViewer::SyncParentSubDocMap()
}
nsCOMPtr<nsPIDOMWindow> pwin(docShell->GetWindow());
nsCOMPtr<Element> element;
if (mDocument && pwin) {
element = pwin->GetFrameElementInternal();
if (!mDocument || !pwin) {
return NS_OK;
}
if (element) {
nsCOMPtr<nsIDocShellTreeItem> parent;
docShell->GetParent(getter_AddRefs(parent));
nsCOMPtr<nsPIDOMWindow> parent_win = parent ? parent->GetWindow() : nullptr;
if (parent_win) {
nsCOMPtr<nsIDocument> parent_doc = parent_win->GetDoc();
if (parent_doc) {
if (mDocument && parent_doc->GetSubDocumentFor(element) != mDocument) {
mDocument->SuppressEventHandling(nsIDocument::eEvents,
parent_doc->EventHandlingSuppressed());
}
return parent_doc->SetSubDocumentFor(element, mDocument);
}
}
nsCOMPtr<Element> element = pwin->GetFrameElementInternal();
if (!element) {
return NS_OK;
}
return NS_OK;
nsCOMPtr<nsIDocShellTreeItem> parent;
docShell->GetParent(getter_AddRefs(parent));
nsCOMPtr<nsPIDOMWindow> parent_win = parent ? parent->GetWindow() : nullptr;
if (!parent_win) {
return NS_OK;
}
nsCOMPtr<nsIDocument> parent_doc = parent_win->GetDoc();
if (!parent_doc) {
return NS_OK;
}
if (mDocument && parent_doc->GetSubDocumentFor(element) != mDocument) {
mDocument->SuppressEventHandling(nsIDocument::eEvents,
parent_doc->EventHandlingSuppressed());
}
return parent_doc->SetSubDocumentFor(element, mDocument);
}
NS_IMETHODIMP