Bug 1447193 - Ensure PresShell exists when activating a TabChild to ensure focus can be properly set early in TabChild lifetime. r?smaug draft
authorMike Conley <mconley@mozilla.com>
Thu, 29 Mar 2018 10:17:45 -0700
changeset 777505 b0e3609aa6db1b941dde1593a17b39030185d1be
parent 777504 63fafaa6595dd261804b71811f1504f55ec2ef28
child 778039 b5d4f4957a8e8901fb8af417c68e6b4a6b2685d8
child 779372 fa3be41d686cc96078681309293165789cce2204
push id105228
push usermconley@mozilla.com
push dateWed, 04 Apr 2018 21:10:34 +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
@@ -1480,16 +1480,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()
 {