From c58beb7e8577ee7545edb568e1a6772d11678d2a Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Fri, 26 Apr 2024 15:32:54 +0000 Subject: [PATCH 1/8] Spec for window.fence.notifyEvent and onfencedtreeclick This adds event handlers for `onfencedtreeclick`, and describes the algorithm for `window.fence.notifyEvent()`, which fires `fencedtreeclick` events from the fenced frame's document to the `HTMLFencedFrameElement` in the embedder. --- spec.bs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/spec.bs b/spec.bs index 515ce54..c4a8152 100644 --- a/spec.bs +++ b/spec.bs @@ -117,6 +117,7 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ text: create a new browsing context and document; url: creating-a-new-browsing-context text: create a new browsing context group and document; url: creating-a-new-browsing-context-group text: document base url; url: document-base-url + text: fully active; url: fully-active text: initialize the navigable; url: initialize-the-navigable text: node navigable; url: node-navigable text: system visibility state; url: system-visibility-state @@ -164,6 +165,7 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ urlPrefix: interaction.html text: activation notification; url: activation-notification text: consume user activation; url: consume-user-activation + text: transient activation; url: transient-activation text: activation; url: activation text: click focusable; url: click-focusable text: focusable area; url: focusable-area @@ -188,6 +190,8 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ for: environment text: target browsing context; url: concept-environment-target-browsing-context text: navigation and traversal task source + text: event handlers on elements, document objects, and window objects; url: event-handlers-on-elements,-document-objects,-and-window-objects + text: idl definitions; url: idl-definitions urlPrefix: document-sequences.html for: browsing context text: active document; url: active-document @@ -1633,6 +1637,7 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. undefined reportEvent(optional ReportEventType event = {}); undefined setReportEventDataForAutomaticBeacons(optional FenceEvent event = {}); sequence<FencedFrameConfig> getNestedConfigs(); + undefined notifyEvent(optional Event event = {}); }; @@ -1839,6 +1844,45 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. +
+ The notifyEvent(|event|) method steps are: + + 1. [=Assert=]: [=this=]'s {{Document}} is [=fully active=]. + + 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=navigable=]. + + 1. If |navigable| is not a [=fenced navigable container/fenced navigable=], then + throw a {{SecurityError}} {{DOMException}}. + + 1. If |event| is null, then throw a {{SecurityError}} {{DOMException}}. + + 1. If |event|'s {{Event/isTrusted}} is false, then throw a {{SecurityError}} {{DOMException}}. + + 1. If |event|'s [=Event/dispatch flag=] is unset, then throw a {{SecurityError}} {{DOMException}}. + + 1. If |event|'s {{Event/type}} is not "fencedtreeclick", throw a {{SecurityError}} + {{DOMException}}. + + 1. If [=this=]'s [=relevant global object=] does not have [=transient activation=], then return. + + 1. [=Consume user activation=] for [=this=]'s [=relevant global object=]. + + 1. [=Fire an event=] named "fencedtreeclick" at |navigable|'s + [=fenced navigable container=]. Initialize the event's {{Event/bubbles}} and {{Event/cancelable}} + attributes to `true`. When running the + inner event creation steps, + set the time to a user-agent-defined value that is consistent across all + invocations of this method. + + + /fenced-frame/notify-event-iframe.https.html + /fenced-frame/notify-event-invalid.https.html + /fenced-frame/notify-event-nested-fenced-frames.https.html + /fenced-frame/notify-event-success.https.html + /fenced-frame/notify-event-transient-user-activation.https.html + +
+

New [=request=] [=request/destination=]

The processing model of a <{fencedframe}>'s navigation request deviates from that of the normal @@ -2955,6 +2999,22 @@ modified such that the first step of the algorithm that runs when a user-agent c [=traversable navigable=]'s [=system visibility state=] calls the [=Document/inclusive descendant navigables=] algorithm with [=inclusive-dn-unfenced|unfenced=] set to true. +

Events

+ +The {{Fence/notifyEvent}} method of the {{Fence}} interface introduces a new event type, `fencedtreeclick`. + +The [=event handlers on elements, Document objects, and Window objects=] section of [[HTML]] is modified to +include a new row. The [=event handler=] name is `onfencedtreeclick`, and the [=event handler event type=] is +`fencedtreeclick`. + +The {{GlobalEventHandlers}} interface is modified as follows: + +
+  partial interface mixin GlobalEventHandlers {
+    attribute EventHandler onfencedtreeclick;
+  };
+
+

Interactions with other specifications

Due to the necessarily cross-cutting nature of the <{fencedframe}> element and its interactions with From c28cd2c3fa7f1b9975e909a48a2316af8da69aca Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Fri, 26 Apr 2024 17:38:26 +0000 Subject: [PATCH 2/8] Condense SecurityError section --- spec.bs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec.bs b/spec.bs index c4a8152..3cd5955 100644 --- a/spec.bs +++ b/spec.bs @@ -1851,17 +1851,17 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=navigable=]. - 1. If |navigable| is not a [=fenced navigable container/fenced navigable=], then - throw a {{SecurityError}} {{DOMException}}. + 1. If any of the following conditions are met, throw a {{SecurityError}} {{DOMException}}: - 1. If |event| is null, then throw a {{SecurityError}} {{DOMException}}. + 1. |navigable| is not a [=fenced navigable container/fenced navigable=]. + + 1. |event| is null. - 1. If |event|'s {{Event/isTrusted}} is false, then throw a {{SecurityError}} {{DOMException}}. + 1. |event|'s {{Event/isTrusted}} is false. - 1. If |event|'s [=Event/dispatch flag=] is unset, then throw a {{SecurityError}} {{DOMException}}. + 1. |event|'s [=Event/dispatch flag=] is unset. - 1. If |event|'s {{Event/type}} is not "fencedtreeclick", throw a {{SecurityError}} - {{DOMException}}. + 1. |event|'s {{Event/type}} is not "fencedtreeclick". 1. If [=this=]'s [=relevant global object=] does not have [=transient activation=], then return. From f4fee5047e4333d1e1ec1ffd2f5f6c08c8441432 Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Wed, 1 May 2024 15:59:39 +0000 Subject: [PATCH 3/8] Address comments from domfarolino --- spec.bs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/spec.bs b/spec.bs index 3cd5955..2cd1db2 100644 --- a/spec.bs +++ b/spec.bs @@ -117,7 +117,6 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ text: create a new browsing context and document; url: creating-a-new-browsing-context text: create a new browsing context group and document; url: creating-a-new-browsing-context-group text: document base url; url: document-base-url - text: fully active; url: fully-active text: initialize the navigable; url: initialize-the-navigable text: node navigable; url: node-navigable text: system visibility state; url: system-visibility-state @@ -165,7 +164,6 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ urlPrefix: interaction.html text: activation notification; url: activation-notification text: consume user activation; url: consume-user-activation - text: transient activation; url: transient-activation text: activation; url: activation text: click focusable; url: click-focusable text: focusable area; url: focusable-area @@ -1847,27 +1845,27 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface.
The notifyEvent(|event|) method steps are: - 1. [=Assert=]: [=this=]'s {{Document}} is [=fully active=]. + 1. [=Assert=]: [=this=]'s {{Document}} is [=Document/fully active=]. 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=navigable=]. 1. If any of the following conditions are met, throw a {{SecurityError}} {{DOMException}}: - 1. |navigable| is not a [=fenced navigable container/fenced navigable=]. + * |navigable| is not a [=fenced navigable container/fenced navigable=]; - 1. |event| is null. + * |event| is null; - 1. |event|'s {{Event/isTrusted}} is false. + * |event|'s {{Event/isTrusted}} is false; - 1. |event|'s [=Event/dispatch flag=] is unset. + * |event|'s [=Event/dispatch flag=] is unset; - 1. |event|'s {{Event/type}} is not "fencedtreeclick". + * |event|'s {{Event/type}} is not [=fencedtreeclick=] 1. If [=this=]'s [=relevant global object=] does not have [=transient activation=], then return. 1. [=Consume user activation=] for [=this=]'s [=relevant global object=]. - 1. [=Fire an event=] named "fencedtreeclick" at |navigable|'s + 1. [=Fire an event=] named [=fencedtreeclick=] at |navigable|'s [=fenced navigable container=]. Initialize the event's {{Event/bubbles}} and {{Event/cancelable}} attributes to `true`. When running the inner event creation steps, @@ -3001,11 +2999,12 @@ navigables=] algorithm with [=inclusive-dn-unfenced|unfenced=] set to true.

Events

-The {{Fence/notifyEvent}} method of the {{Fence}} interface introduces a new event type, `fencedtreeclick`. +The {{Fence/notifyEvent}} method of the {{Fence}} interface introduces a new event type, fencedtreeclick. -The [=event handlers on elements, Document objects, and Window objects=] section of [[HTML]] is modified to -include a new row. The [=event handler=] name is `onfencedtreeclick`, and the [=event handler event type=] is -`fencedtreeclick`. +The +event handlers on elements, Document objects, and Window objects section of [[HTML]] is modified to +include a new row. The [=event handler=] name is onfencedtreeclick, and the [=event handler event type=] is +[=fencedtreeclick=]. The {{GlobalEventHandlers}} interface is modified as follows: From 32020e4d03b952b0ad6030608512b8dd309bedd4 Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Mon, 6 May 2024 17:53:57 +0000 Subject: [PATCH 4/8] Address r2 of comments from domfarolino --- spec.bs | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/spec.bs b/spec.bs index 2cd1db2..d02437c 100644 --- a/spec.bs +++ b/spec.bs @@ -106,6 +106,7 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ text: dom interface; url: concept-element-dom text: accessibility considerations; url: concept-element-accessibility-considerations text: represents; url: represents + text: event handler content attributes which may be specified on any HTML element; url: global-attributes:event-handler-content-attributes urlPrefix: common-dom-interfaces.html text: reflect; url: reflect urlPrefix: embedder-content-other.html @@ -355,6 +356,14 @@ dl, dd { background: white; border: solid #D50606; } + +/* Table styling definitions from https://resources.whatwg.org/standard.css */ +table { border-collapse: collapse; border-style: hidden hidden none hidden; margin: 1.25em 0; } +table thead, table tbody { border-bottom: solid; } +table tbody th { text-align: left; } +table tbody th:first-child { border-left: solid; } +table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; } + @@ -1845,7 +1854,7 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface.
The notifyEvent(|event|) method steps are: - 1. [=Assert=]: [=this=]'s {{Document}} is [=Document/fully active=]. + 1. If [=this=]'s {{Document}} is not [=Document/fully active=], then return. 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=navigable=]. @@ -1859,7 +1868,7 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. * |event|'s [=Event/dispatch flag=] is unset; - * |event|'s {{Event/type}} is not [=fencedtreeclick=] + * |event|'s {{Event/type}} is not click 1. If [=this=]'s [=relevant global object=] does not have [=transient activation=], then return. @@ -2999,12 +3008,52 @@ navigables=] algorithm with [=inclusive-dn-unfenced|unfenced=] set to true.

Events

-The {{Fence/notifyEvent}} method of the {{Fence}} interface introduces a new event type, fencedtreeclick. - -The -event handlers on elements, Document objects, and Window objects section of [[HTML]] is modified to -include a new row. The [=event handler=] name is onfencedtreeclick, and the [=event handler event type=] is -[=fencedtreeclick=]. +

fencedtreeclick event type

+The Events table in the +Index section of [[HTML]] is +modified to include a new row. + + + + + + + + + + + + + + + + + + +
EventInterfaceInteresting targetsDescription
fencedtreeclick{{Event}}Elements + Fired at a <{fencedframe}> element when its contained content calls {{Fence/notifyEvent}} +
+ +

onfencedtreeclick event handler

+The table in the +event handlers on elements, Document objects, and Window objects section of [[HTML]] is modified +to include a new row. The [=event handler=] name is onfencedtreeclick, and the +[=event handler event type=] is fencedtreeclick. + + + + + + + + + + + + + + +
[=Event handler=][=Event handler event type=]
onfencedtreeclick[=fencedtreeclick=]
The {{GlobalEventHandlers}} interface is modified as follows: @@ -3014,6 +3063,11 @@ The {{GlobalEventHandlers}} interface is modified as follows: }; +Additionally, the list of [=event handler content attributes which may be specified on any HTML element=] +in [[HTML]] is modified to include a new row: + +* [=onfencedtreeclick=] +

Interactions with other specifications

Due to the necessarily cross-cutting nature of the <{fencedframe}> element and its interactions with From 2701c710735d10cdf142723992819e03d3bb5d58 Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Thu, 9 May 2024 19:42:33 +0000 Subject: [PATCH 5/8] Address r3 of comments --- spec.bs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec.bs b/spec.bs index d02437c..22861fe 100644 --- a/spec.bs +++ b/spec.bs @@ -1856,7 +1856,7 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. 1. If [=this=]'s {{Document}} is not [=Document/fully active=], then return. - 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=navigable=]. + 1. Let |navigable| be [=this=]'s [=relevant global object=]'s [=Window/navigable=]. 1. If any of the following conditions are met, throw a {{SecurityError}} {{DOMException}}: @@ -3024,11 +3024,12 @@ modified to include a new row. - fencedtreeclick + fencedtreeclick {{Event}} Elements - Fired at a <{fencedframe}> element when its contained content calls {{Fence/notifyEvent}} + Fired at a <{fencedframe}> element asynchronously after its + [=fenced navigable container/fenced navigable=]'s {{Document}} calls {{Fence/notifyEvent()}} @@ -3049,7 +3050,7 @@ to include a new row. The [=event handler=] name is onfencedtreeclick - onfencedtreeclick + onfencedtreeclick [=fencedtreeclick=] From 43cf06bde380bc98414b06c85798e045ca28ff6e Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Fri, 4 Oct 2024 20:24:51 +0000 Subject: [PATCH 6/8] Address latest comments --- spec.bs | 76 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/spec.bs b/spec.bs index 7d80766..cd74c26 100644 --- a/spec.bs +++ b/spec.bs @@ -1848,18 +1848,20 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. * |event|'s [=Event/dispatch flag=] is unset; - * |event|'s {{Event/type}} is not click + * |event|'s {{Event/type}} is not "click" 1. If [=this=]'s [=relevant global object=] does not have [=transient activation=], then return. 1. [=Consume user activation=] for [=this=]'s [=relevant global object=]. - 1. [=Fire an event=] named [=fencedtreeclick=] at |navigable|'s - [=fenced navigable container=]. Initialize the event's {{Event/bubbles}} and {{Event/cancelable}} - attributes to `true`. When running the - inner event creation steps, - set the time to a user-agent-defined value that is consistent across all - invocations of this method. + 1. Let |parentNavigable| be |navigable|'s [=navigable/unfenced parent=]. + + 1. [=Queue a global task=] on the [=DOM manipulation task source=] given |parentNavigable|'s + [=navigable/active window=] to fire a "[=fencedtreeclick=]" event: + + 1. [=Fire an event=] named "[=fencedtreeclick=]" at |navigable|'s + [=fenced navigable container=]. Initialize the event's {{Event/bubbles}} and {{Event/cancelable}} attributes to `true`. When running the + inner event creation steps, set the time to a user-agent-defined value that is consistent across all invocations of this method. /fenced-frame/notify-event-iframe.https.html @@ -3004,38 +3006,9 @@ navigables=] algorithm with [=inclusive-dn-unfenced|unfenced=] set to true.

Events

-

fencedtreeclick event type

-The Events table in the -Index section of [[HTML]] is -modified to include a new row. - - - - - - - - - - - - - - - - - - -
EventInterfaceInteresting targetsDescription
fencedtreeclick{{Event}}Elements - Fired at a <{fencedframe}> element asynchronously after its - [=fenced navigable container/fenced navigable=]'s {{Document}} calls {{Fence/notifyEvent()}} -
- -

onfencedtreeclick event handler

+

[=onfencedtreeclick=] event handler

The table in the -event handlers on elements, Document objects, and Window objects section of [[HTML]] is modified -to include a new row. The [=event handler=] name is onfencedtreeclick, and the -[=event handler event type=] is fencedtreeclick. +event handlers on elements, Document objects, and Window objects section of [[HTML]] is modified to include a new row. @@ -3065,6 +3038,33 @@ in [[HTML]] is modified to include a new row: * [=onfencedtreeclick=] +

[=fencedtreeclick=] event type

+The Events table in the +Index section of [[HTML]] is +modified to include a new row. + +
+ + + + + + + + + + + + + + + + +
EventInterfaceInteresting targetsDescription
fencedtreeclick{{Event}}Elements + Fired at a <{fencedframe}> element asynchronously after its + [=fenced navigable container/fenced navigable=]'s {{Document}} calls {{Fence/notifyEvent()}} +
+

Interactions with other specifications

Due to the necessarily cross-cutting nature of the <{fencedframe}> element and its interactions with From 665404a1b8457f5ad6c9c5a9b03799180344530f Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Fri, 4 Oct 2024 20:43:18 +0000 Subject: [PATCH 7/8] Apply user activation to parent --- spec.bs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec.bs b/spec.bs index cd74c26..8894160 100644 --- a/spec.bs +++ b/spec.bs @@ -1859,6 +1859,8 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. 1. [=Queue a global task=] on the [=DOM manipulation task source=] given |parentNavigable|'s [=navigable/active window=] to fire a "[=fencedtreeclick=]" event: + 1. Perform the [=activation notification=] steps. + 1. [=Fire an event=] named "[=fencedtreeclick=]" at |navigable|'s [=fenced navigable container=]. Initialize the event's {{Event/bubbles}} and {{Event/cancelable}} attributes to `true`. When running the inner event creation steps, set the time to a user-agent-defined value that is consistent across all invocations of this method. From ef24bd3e5bfa15aff8f154f828b7d90389633a91 Mon Sep 17 00:00:00 2001 From: Andrew Verge Date: Tue, 8 Oct 2024 14:23:26 +0000 Subject: [PATCH 8/8] Address more comments --- spec.bs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec.bs b/spec.bs index 8894160..2456597 100644 --- a/spec.bs +++ b/spec.bs @@ -1644,7 +1644,7 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. undefined reportEvent(optional ReportEventType event = {}); undefined setReportEventDataForAutomaticBeacons(optional FenceEvent event = {}); sequence<FencedFrameConfig> getNestedConfigs(); - undefined notifyEvent(optional Event event = {}); + undefined notifyEvent(Event event); }; @@ -1841,8 +1841,6 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. 1. If any of the following conditions are met, throw a {{SecurityError}} {{DOMException}}: * |navigable| is not a [=fenced navigable container/fenced navigable=]; - - * |event| is null; * |event|'s {{Event/isTrusted}} is false; @@ -1857,13 +1855,13 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface. 1. Let |parentNavigable| be |navigable|'s [=navigable/unfenced parent=]. 1. [=Queue a global task=] on the [=DOM manipulation task source=] given |parentNavigable|'s - [=navigable/active window=] to fire a "[=fencedtreeclick=]" event: + [=navigable/active window=] to run these steps: 1. Perform the [=activation notification=] steps. 1. [=Fire an event=] named "[=fencedtreeclick=]" at |navigable|'s [=fenced navigable container=]. Initialize the event's {{Event/bubbles}} and {{Event/cancelable}} attributes to `true`. When running the - inner event creation steps, set the time to a user-agent-defined value that is consistent across all invocations of this method. + inner event creation steps, set the time to an [=implementation-defined=] value that is consistent across all invocations of this method. /fenced-frame/notify-event-iframe.https.html