Skip to content

Commit a20ca78

Browse files
committed
Fix PromiseRejectionEvent's promise attribute
As discovered in whatwg/streams#1298 (comment), Promise<T> is actually not an appropriate type for it.
1 parent ecc06cd commit a20ca78

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source

+8-2
Original file line numberDiff line numberDiff line change
@@ -105918,19 +105918,25 @@ dictionary <dfn dictionary>ErrorEventInit</dfn> : <span>EventInit</span> {
105918105918
interface <dfn interface>PromiseRejectionEvent</dfn> : <span>Event</span> {
105919105919
<span data-x="dom-Event-constructor">constructor</span>(DOMString type, <span>PromiseRejectionEventInit</span> eventInitDict);
105920105920

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

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

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

105934+
<p class="note">Because of how Web IDL conversion rules for <code
105935+
data-x="">Promise&lt;<var>T</var>></code> types always wrap the input into a new promise, the
105936+
<code data-x="dom-PromiseRejectionEvent-promise">promise</code> attribute is of type <code
105937+
data-x="idl-object">object</code> instead, which is more appropriate for representing an opaque
105938+
handle to the original promise object.</p>
105939+
105934105940
<p>The <dfn attribute for="PromiseRejectionEvent"><code
105935105941
data-x="dom-PromiseRejectionEvent-reason">reason</code></dfn> attribute must return the value it
105936105942
was initialized to. It represents the rejection reason for the promise.</p>

0 commit comments

Comments
 (0)