From c4c1b82bb793657e79cd5c1f218f398a4f259e6d Mon Sep 17 00:00:00 2001 From: Neil Deakin Date: Wed, 2 Dec 2015 09:34:42 -0500 Subject: [PATCH] Bug 1227461, don't iterate multiple times past the top-level document during tab navigation, prevents hang navigating in page info dialog, r=smaug --- dom/base/nsFocusManager.cpp | 5 ++++ .../mochitest/chrome/window_focus_docnav.xul | 28 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 8b269c00b97c..b921f854f828 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -2827,6 +2827,11 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow, return FocusFirst(root, aNextContent); } + // Once we have hit the top-level and have iterated to the end again, we + // just want to break out next time we hit this spot to prevent infinite + // iteration. + mayFocusRoot = true; + // reset the tab index and start again from the beginning or end startContent = rootContent; tabIndex = forward ? 1 : 0; diff --git a/dom/tests/mochitest/chrome/window_focus_docnav.xul b/dom/tests/mochitest/chrome/window_focus_docnav.xul index d2b6e50fef75..a4e0a56919f9 100644 --- a/dom/tests/mochitest/chrome/window_focus_docnav.xul +++ b/dom/tests/mochitest/chrome/window_focus_docnav.xul @@ -7,10 +7,11 @@