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

--HG--
extra : rebase_source : 87c01d354d721d4bf427ed3b3c60426f88eb317b
This commit is contained in:
Mike Conley 2018-03-29 10:17:45 -07:00
parent 4e10ada3b9
commit aad0413d0b

View File

@ -1486,6 +1486,12 @@ TabChild::ZoomToRect(const uint32_t& aPresShellId,
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();