Bug 1179069 - Remove docshell warnings in embedding. r=bz

This commit is contained in:
Eric Rahm 2015-07-20 20:16:27 -07:00
parent 38bbb6b028
commit 14347536a5
2 changed files with 10 additions and 3 deletions

View File

@ -76,11 +76,15 @@ using namespace mozilla::dom;
static nsresult
GetDOMEventTarget(nsWebBrowser* aInBrowser, EventTarget** aTarget)
{
NS_ENSURE_ARG_POINTER(aInBrowser);
if (!aInBrowser) {
return NS_ERROR_INVALID_POINTER;
}
nsCOMPtr<nsIDOMWindow> domWindow;
aInBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
if (!domWindow) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE);

View File

@ -360,7 +360,10 @@ nsWebBrowser::SetParentURIContentListener(
NS_IMETHODIMP
nsWebBrowser::GetContentDOMWindow(nsIDOMWindow** aResult)
{
NS_ENSURE_STATE(mDocShell);
if (!mDocShell) {
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIDOMWindow> retval = mDocShell->GetWindow();
retval.forget(aResult);
return *aResult ? NS_OK : NS_ERROR_FAILURE;