Bug 1447193 - Ensure PresShell exists when activating a TabChild to ensure focus can be properly set early in TabChild lifetime. r=smaug
authorMike Conley <mconley@mozilla.com>
Thu, 29 Mar 2018 10:17:45 -0700
changeset 777789 9bad112e0374d2661a2cb9d2fab2c957e847c093
parent 777788 d99564b1aa39948fe5a0192c777676751de3ca45
child 777790 16e014e079d7ec561e54bd97f83fd1ec9f4784a3
push id105296
push userpaolo.mozmail@amadzone.org
push dateThu, 05 Apr 2018 10:49:16 +0000
reviewerssmaug
bugs1447193
milestone61.0a1
Bug 1447193 - Ensure PresShell exists when activating a TabChild to ensure focus can be properly set early in TabChild lifetime. r=smaug MozReview-Commit-ID: At7HAVd33hN
dom/ipc/TabChild.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1481,16 +1481,22 @@ TabChild::ZoomToRect(const uint32_t& aPr
   if (mApzcTreeManager) {
     mApzcTreeManager->ZoomToRect(guid, aRect, aFlags);
   }
 }
 
 mozilla::ipc::IPCResult
 TabChild::RecvActivate()
 {
+  // Ensure that the PresShell exists, otherwise focusing
+  // is definitely not going to work. GetPresShell should
+  // create a PresShell if one doesn't exist yet.
+  nsCOMPtr<nsIPresShell> presShell = GetPresShell();
+  MOZ_ASSERT(presShell);
+
   nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(WebNavigation());
   browser->Activate();
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 TabChild::RecvDeactivate()
 {