Bug 416771 - Remove OwnerDoc() null-checks. r=NeilDeakin draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 17 May 2019 16:47:32 +0200
changeset 2008477 6268c987c1deca9c2a17de4a9922264ccecb9f60
parent 2008202 1ae707852b608ea77dc82c892f25e169cbc316b5
child 2008478 211bde66fecc8c3a1c78dfbcede078383ca8b0f8
push id363917
push useremilio@crisal.io
push dateSat, 18 May 2019 06:31:42 +0000
treeherdertry@46e3df2f90da [default view] [failures only]
reviewersNeilDeakin
bugs416771
milestone68.0a1
Bug 416771 - Remove OwnerDoc() null-checks. r=NeilDeakin 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);