From bdf8f404dd3331ad0c40a8f8b08a45948e602c3d Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Tue, 29 Oct 2024 22:51:26 -0700 Subject: [PATCH] Throw exception for popovers/dialogs in non-active documents See discussion at: https://github.com/whatwg/html/issues/10659 and spec PR at: https://github.com/whatwg/html/pull/10705 Web-facing change PSA: https://groups.google.com/a/chromium.org/g/blink-dev/c/jRFiIIkXv_k/m/jnPTfg8WBgAJ Fixed: 373684393 Change-Id: I50e400ee526775f915f006865301fff2f04016b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5943740 Reviewed-by: Domenic Denicola Auto-Submit: Mason Freed Commit-Queue: Domenic Denicola Cr-Commit-Position: refs/heads/main@{#1375681} --- .../dialog-active-document.html | 16 ++++++++++++++++ .../the-dialog-element/dialog-showModal.html | 7 +++---- .../popovers/popover-active-document.html | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 html/semantics/interactive-elements/the-dialog-element/dialog-active-document.html create mode 100644 html/semantics/popovers/popover-active-document.html diff --git a/html/semantics/interactive-elements/the-dialog-element/dialog-active-document.html b/html/semantics/interactive-elements/the-dialog-element/dialog-active-document.html new file mode 100644 index 00000000000000..d6eea38fa8a399 --- /dev/null +++ b/html/semantics/interactive-elements/the-dialog-element/dialog-active-document.html @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html b/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html index 47612e759eaa49..652378e015b56d 100644 --- a/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html +++ b/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html @@ -181,8 +181,7 @@ doc.body.appendChild(d11); this.add_cleanup(() => document.body.append(d11)); assert_false(d11.open); - d11.showModal(); - assert_true(d11.open); - this.add_cleanup(() => d11.close()); - }, "Although the document is not attached to any pages, showModal() should execute as normal."); + assert_throws_dom("INVALID_STATE_ERR", () => d11.showModal()); + assert_false(d11.open); + }, "When the document is not attached to any pages, showModal() should throw."); diff --git a/html/semantics/popovers/popover-active-document.html b/html/semantics/popovers/popover-active-document.html new file mode 100644 index 00000000000000..6ad1142ed79c64 --- /dev/null +++ b/html/semantics/popovers/popover-active-document.html @@ -0,0 +1,17 @@ + + + + + + + +