Bug 1376879 - Check if we have a retargeted PresShell in FocusTarget. r=kats
authorRyan Hunt <rhunt@eqrion.net>
Wed, 28 Jun 2017 14:03:34 -0400
changeset 601759 5283088aa3be7081cd26fdda0a1c006e67088f40
parent 601758 f83e1c86a428c6965285cbe80bc5b011a4d70f68
child 601760 a60370560b8c0096a30dcf0807a166c4a0dd5a67
push id66200
push userhchang@mozilla.com
push dateThu, 29 Jun 2017 03:53:43 +0000
reviewerskats
bugs1376879
milestone56.0a1
Bug 1376879 - Check if we have a retargeted PresShell in FocusTarget. r=kats MozReview-Commit-ID: L2v2U0MXecv
gfx/layers/apz/src/FocusTarget.cpp
--- a/gfx/layers/apz/src/FocusTarget.cpp
+++ b/gfx/layers/apz/src/FocusTarget.cpp
@@ -79,16 +79,21 @@ FocusTarget::FocusTarget(nsIPresShell* a
   , mFocusHasKeyEventListeners(false)
 {
   MOZ_ASSERT(aRootPresShell);
   MOZ_ASSERT(NS_IsMainThread());
 
   // Key events can be retargeted to a child PresShell when there is an iframe
   nsCOMPtr<nsIPresShell> presShell = GetRetargetEventPresShell(aRootPresShell);
 
+  if (!presShell) {
+    mType = FocusTarget::eNone;
+    return;
+  }
+
   // Get the content that should be scrolled for this PresShell, which is
   // the current focused element or the current DOM selection
   nsCOMPtr<nsIContent> scrollTarget = presShell->GetContentForScrolling();
 
   // Collect event listener information so we can track what is potentially focus
   // changing
   mFocusHasKeyEventListeners = HasListenersForKeyEvents(scrollTarget);