Skip to content

Commit

Permalink
Fix PromiseRejectionEvent's promise attribute
Browse files Browse the repository at this point in the history
As discovered in whatwg/streams#1298 (comment), Promise<T> is actually not an appropriate type for it.
  • Loading branch information
domenic committed Dec 12, 2023
1 parent ecc06cd commit a20ca78
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -105918,19 +105918,25 @@ dictionary <dfn dictionary>ErrorEventInit</dfn> : <span>EventInit</span> {
interface <dfn interface>PromiseRejectionEvent</dfn> : <span>Event</span> {
<span data-x="dom-Event-constructor">constructor</span>(DOMString type, <span>PromiseRejectionEventInit</span> eventInitDict);

readonly attribute Promise&lt;any&gt; <span data-x="dom-PromiseRejectionEvent-promise">promise</span>;
readonly attribute <span data-x="idl-object">object</span> <span data-x="dom-PromiseRejectionEvent-promise">promise</span>;
readonly attribute any <span data-x="dom-PromiseRejectionEvent-reason">reason</span>;
};

dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
required Promise&lt;any&gt; promise;
required <span data-x="idl-object">object</span> promise;
any reason;
};</code></pre>

<p>The <dfn attribute for="PromiseRejectionEvent"><code
data-x="dom-PromiseRejectionEvent-promise">promise</code></dfn> attribute must return the value it
was initialized to. It represents the promise which this notification is about.</p>

<p class="note">Because of how Web IDL conversion rules for <code
data-x="">Promise&lt;<var>T</var>></code> types always wrap the input into a new promise, the
<code data-x="dom-PromiseRejectionEvent-promise">promise</code> attribute is of type <code
data-x="idl-object">object</code> instead, which is more appropriate for representing an opaque
handle to the original promise object.</p>

<p>The <dfn attribute for="PromiseRejectionEvent"><code
data-x="dom-PromiseRejectionEvent-reason">reason</code></dfn> attribute must return the value it
was initialized to. It represents the rejection reason for the promise.</p>
Expand Down

0 comments on commit a20ca78

Please sign in to comment.