Bug 1835464 - Check dialog is modal flag instead of open attribute in 'check popover validity' algorithm. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D181089
This commit is contained in:
Ziran Sun 2023-06-20 08:49:32 +00:00
parent e6d575b5d9
commit 96a16d3cad
3 changed files with 5 additions and 20 deletions

View File

@ -78,11 +78,6 @@ void HTMLDialogElement::Show(ErrorResult& aError) {
"Cannot call show() on an open modal dialog.");
}
if (IsPopoverOpen()) {
return aError.ThrowInvalidStateError(
"Dialog element is already an open popover.");
}
SetOpen(true, IgnoreErrors());
StorePreviouslyFocusedElement();

View File

@ -3276,9 +3276,11 @@ bool nsGenericHTMLElement::CheckPopoverValidity(
return false;
}
if (IsHTMLElement(nsGkAtoms::dialog) && HasAttr(nsGkAtoms::open)) {
aRv.ThrowInvalidStateError("Element is an open <dialog> element");
return false;
if (auto* dialog = HTMLDialogElement::FromNode(this)) {
if (dialog->IsInTopLayer()) {
aRv.ThrowInvalidStateError("Element is a modal <dialog> element");
return false;
}
}
if (State().HasState(ElementState::FULLSCREEN)) {

View File

@ -1,16 +1,4 @@
[popover-top-layer-combinations.html]
[Popover combination: Popover Dialog]
expected: FAIL
[Popover combination: Open Non-modal Popover Dialog]
expected: FAIL
[Popover combination: Fullscreen Popover]
expected:
if os == "linux": FAIL
[Popover combination: Fullscreen Popover Dialog]
expected: FAIL
[Popover combination: Fullscreen Open Non-modal Popover Dialog]
expected: FAIL