From d198a18e75661efae56597737d0ca9a2e3b09862 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 31 May 2023 11:43:58 +0000 Subject: [PATCH] Bug 1834519 - Don't throw when popovers/dialogs are in requested state. r=emilio Update to be in line with spec discussions at https://github.com/whatwg/html/pull/9142 Differential Revision: https://phabricator.services.mozilla.com/D178782 UltraBlame original commit: 39007d3d4f3eee8382115fb59e595de006ceca70 --- dom/html/HTMLDialogElement.cpp | 73 +++++++++++++++---- .../dialog-no-throw-requested-state.html.ini | 27 ------- 2 files changed, 58 insertions(+), 42 deletions(-) delete mode 100644 testing/web-platform/meta/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html.ini diff --git a/dom/html/HTMLDialogElement.cpp b/dom/html/HTMLDialogElement.cpp index 9af55db98d64e..70f65b27c652c 100644 --- a/dom/html/HTMLDialogElement.cpp +++ b/dom/html/HTMLDialogElement.cpp @@ -538,9 +538,38 @@ Open ) ) { +if +( +! +IsInTopLayer +( +) +) +{ return ; } +return +aError +. +ThrowInvalidStateError +( +" +Cannot +call +show +( +) +on +an +open +modal +dialog +. +" +) +; +} if ( IsPopoverOpen @@ -758,30 +787,48 @@ aError { if ( -! -IsInComposedDoc +Open +( +) +) +{ +if +( +IsInTopLayer ( ) ) { return +; +} +return aError . ThrowInvalidStateError ( " -Dialog -element -is -not -connected +Cannot +call +showModal +( +) +on +an +open +non +- +modal +dialog +. " ) ; } if ( -Open +! +IsInComposedDoc ( ) ) @@ -794,13 +841,9 @@ ThrowInvalidStateError " Dialog element -already -has -an -' -open -' -attribute +is +not +connected " ) ; diff --git a/testing/web-platform/meta/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html.ini b/testing/web-platform/meta/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html.ini deleted file mode 100644 index 2a33c59d3e578..0000000000000 --- a/testing/web-platform/meta/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html.ini +++ /dev/null @@ -1,27 +0,0 @@ -[ -dialog -- -no -- -throw -- -requested -- -state -. -html -] -[ -dialog -- -no -- -throw -- -requested -- -state -] -expected -: -FAIL