Bug 1840342 - Throw exception when popover attribute changes during beforetoggle in showpopover. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D182871
This commit is contained in:
@@ -3362,12 +3362,19 @@ void nsGenericHTMLElement::ShowPopoverInternal(
|
||||
bool shouldRestoreFocus = false;
|
||||
nsWeakPtr originallyFocusedElement;
|
||||
if (IsAutoPopover()) {
|
||||
auto originalState = GetPopoverAttributeState();
|
||||
RefPtr<nsINode> ancestor = GetTopmostPopoverAncestor();
|
||||
if (!ancestor) {
|
||||
ancestor = document;
|
||||
}
|
||||
document->HideAllPopoversUntil(*ancestor, false,
|
||||
/* aFireEvents = */ !wasShowingOrHiding);
|
||||
if (GetPopoverAttributeState() != originalState) {
|
||||
aRv.ThrowInvalidStateError(
|
||||
"The value of the popover attribute was changed while hiding the "
|
||||
"popover.");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Handle if document changes, see
|
||||
// https://github.com/whatwg/html/issues/9177
|
||||
|
||||
Reference in New Issue
Block a user