Bug 1179069 - Remove docshell warnings in embedding. r=bz
authorEric Rahm <erahm@mozilla.com>
Mon, 20 Jul 2015 20:16:27 -0700
changeset 253807 61d43e7e6d1fa8998391bb216b26988885c1616f
parent 253806 69a890ec1aa240b81b3d079e3f6f1a73561ada54
child 253808 a4dd53b2940a4bbb033bb41c5f8d82fb78d3770c
push id62563
push usererahm@mozilla.com
push dateTue, 21 Jul 2015 05:01:13 +0000
treeherdermozilla-inbound@61d43e7e6d1f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1179069
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1179069 - Remove docshell warnings in embedding. r=bz
embedding/browser/nsDocShellTreeOwner.cpp
embedding/browser/nsWebBrowser.cpp
--- a/embedding/browser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/nsDocShellTreeOwner.cpp
@@ -71,21 +71,25 @@
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // A helper routine that navigates the tricky path from a |nsWebBrowser| to
 // a |EventTarget| via the window root and chrome event handler.
 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);
   nsPIDOMWindow* rootWindow = domWindowPrivate->GetPrivateRoot();
   NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE);
   nsCOMPtr<EventTarget> target = rootWindow->GetChromeEventHandler();
   NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
   target.forget(aTarget);
--- a/embedding/browser/nsWebBrowser.cpp
+++ b/embedding/browser/nsWebBrowser.cpp
@@ -355,17 +355,20 @@ nsWebBrowser::SetParentURIContentListene
     return listener->SetParentContentListener(aParentContentListener);
   }
   return NS_ERROR_FAILURE;
 }
 
 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;
 }
 
 NS_IMETHODIMP
 nsWebBrowser::GetIsActive(bool* aResult)
 {