mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 617872 - Focus manager allows F6 to focus elements inside non-focusable iframes/browsers. r=smaug, a=blocking
This commit is contained in:
parent
073efd8c8b
commit
54df769994
@ -123,6 +123,22 @@ function test() {
|
||||
browser1.contentWindow, null, true,
|
||||
"focusedWindow after tab switch from no focus to no focus");
|
||||
|
||||
gURLBar.focus();
|
||||
_browser_tabfocus_test_events = "";
|
||||
_browser_tabfocus_test_lastfocus = gURLBar;
|
||||
_browser_tabfocus_test_lastfocuswindow = window;
|
||||
|
||||
expectFocusShift(function () EventUtils.synthesizeKey("VK_F6", { }),
|
||||
browser1.contentWindow, browser1.contentDocument.documentElement,
|
||||
true, "switch document forward with f6");
|
||||
EventUtils.synthesizeKey("VK_F6", { });
|
||||
is(fm.focusedWindow, window, "switch document forward again with f6");
|
||||
|
||||
browser1.style.MozUserFocus = "ignore";
|
||||
browser1.clientWidth;
|
||||
EventUtils.synthesizeKey("VK_F6", { });
|
||||
is(fm.focusedWindow, window, "switch document forward again with f6 when browser non-focusable");
|
||||
|
||||
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
|
||||
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
|
||||
|
||||
@ -207,7 +223,7 @@ function expectFocusShift(callback, expectedWindow, expectedElement, focusChange
|
||||
"focus: " + windowid + "-window";
|
||||
}
|
||||
|
||||
if (expectedElement) {
|
||||
if (expectedElement && expectedElement != expectedElement.ownerDocument.documentElement) {
|
||||
if (expectedEvents)
|
||||
expectedEvents += " ";
|
||||
expectedEvents += "focus: " + getId(expectedElement);
|
||||
|
@ -2878,8 +2878,15 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow,
|
||||
if (aIsForDocNavigation) {
|
||||
nsCOMPtr<nsIContent> docContent =
|
||||
do_QueryInterface(aWindow->GetFrameElementInternal());
|
||||
if (docContent && docContent->Tag() == nsGkAtoms::iframe)
|
||||
return nsnull;
|
||||
// document navigation skips iframes and frames that are specifically non-focusable
|
||||
if (docContent) {
|
||||
if (docContent->Tag() == nsGkAtoms::iframe)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* frame = docContent->GetPrimaryFrame();
|
||||
if (!frame || !frame->IsFocusable(nsnull, 0))
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PRInt32 itemType;
|
||||
|
Loading…
Reference in New Issue
Block a user