Skip to content

Commit

Permalink
Update to use new "report an exception" algorithm in HTML
Browse files Browse the repository at this point in the history
It's necessary to specify which global these are reported to. This seems
to be the event listener callback's realm's global in the event listener
case, and the custom element constructor's realm, based on a combination
of consistency with the related sites in HTML and browser behavior --
though browser behavior for custom elements isn't consistent in the
(unusual) case of custom elements across realms.

Part of whatwg/html#10516.
  • Loading branch information
jeremyroman authored Aug 15, 2024
1 parent ad422be commit 054356d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1636,10 +1636,13 @@ and an optional <var>legacyOutputDidListenersThrowFlag</var>, run these steps:
<li>
<p><a>Call a user object's operation</a> with <var>listener</var>'s
<a for="event listener">callback</a>, "<code>handleEvent</code>", « <var>event</var> », and
<var>event</var>'s {{Event/currentTarget}} attribute value. If this throws an exception, then:
<var>event</var>'s {{Event/currentTarget}} attribute value. If this throws an exception
<var>exception</var>, then:

<ol>
<li><p><a>Report the exception</a>.
<li><p><a lt="report an exception">Report</a> <var>exception</var> for <var>listener</var>'s
<a for="event listener">callback</a>'s corresponding JavaScript object's
<a>associated realm</a>'s <a for="realm">global object</a>.

<li>
<p>Set <var>legacyOutputDidListenersThrowFlag</var> if given.
Expand Down Expand Up @@ -6320,10 +6323,12 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
<li><p><a lt="upgrade an element">Upgrade</a> <var>element</var> using <var>definition</var>.
</ol>

<p>If this step threw an exception, then:</p>
<p>If this step threw an exception <var>exception</var>:

<ol>
<li><p><a>Report the exception</a>.
<li><p><a lt="report an exception">Report</a> <var>exception</var> for <var>definition</var>'s
<a for="custom element definition">constructor</a>'s corresponding JavaScript object's
<a>associated realm</a>'s <a for="realm">global object</a>.

<li><p>Set <var>result</var>'s <a for=Element>custom element state</a> to
"<code>failed</code>".
Expand All @@ -6336,7 +6341,7 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
</li>

<li>
<p>Otherwise, if <var>definition</var> is non-null, then:
<p>Otherwise, if <var>definition</var> is non-null:

<ol>
<li>
Expand Down Expand Up @@ -6379,10 +6384,12 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
<li><p>Set <var>result</var>'s <a for=Element><code>is</code> value</a> to null.
</ol>

<p>If any of these steps threw an exception, then:</p>
<p>If any of these steps threw an exception <var>exception</var>:

<ol>
<li><p><a>Report the exception</a>.
<li><p><a lt="report an exception">Report</a> <var>exception</var> for <var>definition</var>'s
<a for="custom element definition">constructor</a>'s corresponding JavaScript object's
<a>associated realm</a>'s <a for="realm">global object</a>.

<li><p>Set <var>result</var> to a new <a for=/>element</a> that implements the
{{HTMLUnknownElement}} interface, with no attributes, <a for=Element>namespace</a> set to the
Expand Down

0 comments on commit 054356d

Please sign in to comment.