Closed EdgarChen closed 1 year ago
How I've always imagined this to work is that Web IDL essentially does a .then()
on the passed in promise and in its .then()
it does the type conversion and then resolves or rejects as appropriate. I.e., this is not something each specification should have to handle individually.
cc @domenic
Consider following example:
And per steps 3.3.4.1.2 of https://w3c.github.io/clipboard-apis/#dom-clipboard-write
The result seems undefined, because
object
isn't aDOMString
orBlob
.But
ClipboardItemData
is defined asPromise<(DOMString or Blob)>
in idl, see https://w3c.github.io/clipboard-apis/#clipboard-item-interface andobject
actually could be converted to aDOMString or Blob
per https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value.Should we convert the value
v
toDOMString or Blob
idl type first while handling the data promise resolved value, like https://encoding.spec.whatwg.org/#decode-and-enqueue-a-chunk, which should cover above example.