Re: [w3c/clipboard-apis] Add clipboard IDL description. (#158)

@domenic commented on this pull request.



> +    a user gesture event and the user must select the paste option from the native context menu that pops up
+    when read() is called from JS, otherwise, the promise will be rejected.
+
+    1. [=queue a global task=] on the [=permission task source=], given |realm|'s [=Realm/global object=], to perform the below steps:
+    
+     1. If |r| is not "granted", then reject |p| with {{"NotAllowedError"}} DOMException in |realm|.
+
+    1. [=queue a global task=] on the [=clipboard task source=], given |realm|'s [=Realm/global object=], to perform the below steps:
+
+     1. Let |itemList| and |cleanItemList| be an empty [=sequence=]<{{Blob}}>.
+
+     1. Let |clipboardItemList| be an empty [=clipboard items=].
+
+     1. For each |clipboardItem| in |data|:
+
+      1. For each |item| in |clipboardItem|:

Oh, I see, I think I misread the spec. A representation's data will be a promise, after all; the constructor step 4.5 sets it to |value|, which is a promise.

So yes, you should access |clipboardItem|'s [=ClipboardItem/clipboard item=]'s [=list of representations=]. But then for each representation, you need to "unwrap" its data. To do that, probably the best thing to do is use https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/158#discussion_r753547136

Received on Friday, 19 November 2021 21:37:36 UTC