Bug 810669 - Cleanup GetDocumentForReport in nsDOMEvent.cpp a bit; r=smaug

This commit is contained in:
Ms2ger 2012-12-02 09:59:29 +01:00
parent f5bccafc02
commit 25360fe5d5

View File

@ -381,16 +381,16 @@ nsDOMEvent::StopImmediatePropagation()
static nsIDocument* GetDocumentForReport(nsEvent* aEvent)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aEvent->currentTarget);
if (node)
nsIDOMEventTarget* target = aEvent->currentTarget;
if (nsCOMPtr<nsINode> node = do_QueryInterface(target)) {
return node->OwnerDoc();
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aEvent->currentTarget);
if (!window)
return nullptr;
if (nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(target)) {
return window->GetExtantDoc();
}
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
return doc;
return nullptr;
}
static void