-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec for window.fence.notifyEvent and onfencedtreeclick #156
base: master
Are you sure you want to change the base?
Conversation
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.
attributes to `true`. When running the | ||
<a href="https://dom.spec.whatwg.org/#inner-event-creation-steps">inner event creation steps</a>, | ||
set the <var ignore=''>time</var> to a user-agent-defined value that is consistent across all | ||
invocations of this method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part special in some way, or unique to this kind of event? It seems a little funny.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the idea was to not provide specific timestamps from notifyEvent() to the embedder. Probably not strictly necessary given that the embedder can grab their own close-enough timestamp, but follows the principle of passing as little data to the embedder as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, well the event should actually be created inside the parent asynchronously as part of the task queued by the child anyways, so I'm not sure how useful that is at all since the parent is ultimately in charge of firing the event. There is no information in the event that the parent doesn't already have access to.
|
||
1. [=Consume user activation=] for [=this=]'s [=relevant global object=]. | ||
|
||
1. [=Fire an event=] named <code>[=fencedtreeclick=]</code> at |navigable|'s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't fire this synchronously from here. I assume the implementation doesn't either, right (I'm pretty sure we asyncly go through the browser process and mojo and so on)? It should be asynchronous probably posting a task to the unfenced parent's Window's event loop on the DOM manipulation task source to fire the event inside that outer event loop. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the impl does go through Mojo. I wasn't sure how specific we had to be about how the event gets to its destination.
I am not familiar with the specifics of task sources and event loops yet, but I understand that ultimately the parent should be the one responsible for firing the event. In the impl, the IPC is received by the <fencedframe>
, which essentially fires the event at itself. Does firing an event on an element inherently use the associated Window's event loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, firing an event at an element uses whatever event loop is on the stack. It's no different from calling a function really, and you can't call a JS function across documents that live in different processes.
That's why you have to queue a task from the child onto the parent's event loop, and the task will fire an event from entirely within the parent's context. Check out the usages of queue a task to see how to use it, or feel free to ask me specifics.
|
||
* |event|'s [=Event/dispatch flag=] is unset; | ||
|
||
* |event|'s {{Event/type}} is not <code>click</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* |event|'s {{Event/type}} is not <code>click</code> | |
* |event|'s {{Event/type}} is not "<code>click</code>" |
|
||
1. If any of the following conditions are met, throw a {{SecurityError}} {{DOMException}}: | ||
|
||
* |navigable| is not a [=fenced navigable container/fenced navigable=]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this hit? In an iframe inside of a fenced frame?
|
||
1. [=Consume user activation=] for [=this=]'s [=relevant global object=]. | ||
|
||
1. [=Fire an event=] named <code>[=fencedtreeclick=]</code> at |navigable|'s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, firing an event at an element uses whatever event loop is on the stack. It's no different from calling a function really, and you can't call a JS function across documents that live in different processes.
That's why you have to queue a task from the child onto the parent's event loop, and the task will fire an event from entirely within the parent's context. Check out the usages of queue a task to see how to use it, or feel free to ask me specifics.
</tbody> | ||
</table> | ||
|
||
<h4 id=onfencedtreeclick-header><code>onfencedtreeclick</code> event handler</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's link to the dfn of the onfencedtreeclick
handler here.
@@ -2792,6 +2843,69 @@ 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. | |||
|
|||
<h3 id=events>Events</h3> | |||
|
|||
<h4 id=fencedtreeclick-header><code>fencedtreeclick</code> event type</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's link to the dfn of fencedtreeclick
here.
</tbody> | ||
</table> | ||
|
||
<h4 id=onfencedtreeclick-header><code>onfencedtreeclick</code> event handler</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading it correctly, in HTML this table comes before the one you have above, so can you reorder these? (Unless I'm wrong about the ordering in HTML, and this was intentional.)
The table in the <a href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers-on-elements,-document-objects,-and-window-objects"> | ||
event handlers on elements, Document objects, and Window objects</a> section of [[HTML]] is modified | ||
to include a new row. The [=event handler=] name is <code>onfencedtreeclick</code>, and the | ||
[=event handler event type=] is <code>fencedtreeclick</code>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This last sentence doesn't seem all that useful, I'd remove it.
attributes to `true`. When running the | ||
<a href="https://dom.spec.whatwg.org/#inner-event-creation-steps">inner event creation steps</a>, | ||
set the <var ignore=''>time</var> to a user-agent-defined value that is consistent across all | ||
invocations of this method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, well the event should actually be created inside the parent asynchronously as part of the task queued by the child anyways, so I'm not sure how useful that is at all since the parent is ultimately in charge of firing the event. There is no information in the event that the parent doesn't already have access to.
This adds event handlers for
onfencedtreeclick
, and describes the algorithm forwindow.fence.notifyEvent()
, which firesfencedtreeclick
events from the fenced frame's document to theHTMLFencedFrameElement
in the embedder.Preview | Diff