Bug 1675349: Forbid elements representing blocked plugins from accepting focus r=jmathies

As part of the fallback for unsupported plugin elements, we deny them focus.  Since elements can be programmatically changed, and object/embed elements can change internal "type" by updating their data/src attributes, and because that type is decided asynchronously, we may need to give up focus if our element has it.

Differential Revision: https://phabricator.services.mozilla.com/D95903
This commit is contained in:
David Parks
2020-11-18 03:04:02 +00:00
parent ca5707dbdd
commit 45c40ddc10
3 changed files with 31 additions and 1 deletions

View File

@@ -289,6 +289,17 @@ bool HTMLObjectElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
return false;
}
// If we have decided that this is a blocked plugin then do not allow focus.
if ((Type() == eType_Null) &&
(PluginFallbackType() == eFallbackBlockAllPlugins)) {
if (aTabIndex) {
*aTabIndex = -1;
}
*aIsFocusable = false;
return false;
}
const nsAttrValue* attrVal = mAttrs.GetAttr(nsGkAtoms::tabindex);
bool isFocusable = attrVal && attrVal->Type() == nsAttrValue::eInteger;