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
--- 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()
{