Bug 416771 - Remove OwnerDoc() null-checks. r=NeilDeakin a=jcristau
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 21 May 2019 14:10:04 +0000
changeset 536404 37d3185821e914e32603fb808dbb58cbb861fb1a
parent 536403 acd3e9c548df552387c5d0c3c827a26d04045799
child 536405 c42e0bb77074f3b28879493ff9267b5ffb59d45a
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin, jcristau
bugs416771
milestone68.0
Bug 416771 - Remove OwnerDoc() null-checks. r=NeilDeakin a=jcristau OwnerDoc() never returns null. Differential Revision: https://phabricator.services.mozilla.com/D31640
dom/ipc/BrowserBridgeChild.cpp
dom/ipc/BrowserParent.cpp
--- a/dom/ipc/BrowserBridgeChild.cpp
+++ b/dom/ipc/BrowserBridgeChild.cpp
@@ -160,18 +160,17 @@ mozilla::ipc::IPCResult BrowserBridgeChi
     const bool& aCanRaise) {
   // Adapted from BrowserParent
   nsCOMPtr<nsIFocusManager> fm = nsFocusManager::GetFocusManager();
   if (!fm) {
     return IPC_OK();
   }
 
   RefPtr<Element> owner = mFrameLoader->GetOwnerContent();
-
-  if (!owner || !owner->OwnerDoc()) {
+  if (!owner) {
     return IPC_OK();
   }
 
   uint32_t flags = nsIFocusManager::FLAG_NOSCROLL;
   if (aCanRaise) {
     flags |= nsIFocusManager::FLAG_RAISE;
   }
 
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -563,18 +563,17 @@ void BrowserParent::AddWindowListeners()
         eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
                                       this, false, false);
       }
     }
   }
 }
 
 void BrowserParent::RemoveWindowListeners() {
-  if (mFrameElement && mFrameElement->OwnerDoc() &&
-      mFrameElement->OwnerDoc()->GetWindow()) {
+  if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
     nsCOMPtr<nsPIDOMWindowOuter> window =
         mFrameElement->OwnerDoc()->GetWindow();
     nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
     if (eventTarget) {
       eventTarget->RemoveEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
                                        this, false);
     }
   }
@@ -2127,17 +2126,17 @@ mozilla::ipc::IPCResult BrowserParent::R
     return IPC_OK();
   }
 
   nsCOMPtr<nsIFocusManager> fm = nsFocusManager::GetFocusManager();
   if (!fm) {
     return IPC_OK();
   }
 
-  if (!mFrameElement || !mFrameElement->OwnerDoc()) {
+  if (!mFrameElement) {
     return IPC_OK();
   }
 
   uint32_t flags = nsIFocusManager::FLAG_NOSCROLL;
   if (aCanRaise) flags |= nsIFocusManager::FLAG_RAISE;
 
   nsCOMPtr<Element> element = mFrameElement;
   fm->SetFocus(element, flags);