Skip to content

Commit

Permalink
Bug 1834519 - Don't throw when popovers/dialogs are in requested stat…
Browse files Browse the repository at this point in the history
…e. r=emilio

Update to be in line with spec discussions at
whatwg/html#9142

Differential Revision: https://phabricator.services.mozilla.com/D178782

UltraBlame original commit: 39007d3d4f3eee8382115fb59e595de006ceca70
  • Loading branch information
marco-c committed May 31, 2023
1 parent 0ebbd01 commit f88e427
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
19 changes: 13 additions & 6 deletions dom/html/HTMLDialogElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ void HTMLDialogElement::Close(

void HTMLDialogElement::Show(ErrorResult& aError) {
if (Open()) {
return;
if (!IsInTopLayer()) {
return;
}
return aError.ThrowInvalidStateError(
"Cannot call show() on an open modal dialog.");
}

if (IsPopoverOpen()) {
Expand Down Expand Up @@ -121,13 +125,16 @@ void HTMLDialogElement::UnbindFromTree(bool aNullParent) {
}

void HTMLDialogElement::ShowModal(ErrorResult& aError) {
if (!IsInComposedDoc()) {
return aError.ThrowInvalidStateError("Dialog element is not connected");
}

if (Open()) {
if (IsInTopLayer()) {
return;
}
return aError.ThrowInvalidStateError(
"Dialog element already has an 'open' attribute");
"Cannot call showModal() on an open non-modal dialog.");
}

if (!IsInComposedDoc()) {
return aError.ThrowInvalidStateError("Dialog element is not connected");
}

if (IsPopoverOpen()) {
Expand Down

This file was deleted.

0 comments on commit f88e427

Please sign in to comment.