- From: Domenic Denicola <notifications@github.com>
- Date: Thu, 18 Nov 2021 10:08:16 -0800
- To: w3c/clipboard-apis <clipboard-apis@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/clipboard-apis/pull/158/review/810273857@github.com>
@domenic commented on this pull request. > + + 1. For each (|key|, |value|) in |items|: + + 1. Let |mimeType| be the result of [=parse a mime type=] given |key|. + + 1. If |mimeType| is failure, then throw a {{TypeError}}. + + 1. Let |representation| be a new [=representation=]. + + 1. Set |representation|'s [=mime type=] to |key|. + + 1. Set |representation|'s [=data=] to |value|. + + 1. Append |representation| to [=this=]'s [=ClipboardItem/clipboard item=]'s [=list of representations=]. + + 1. Let |types| be the result of running [=create a frozen array=] of {{DOMString}}. This is creating an array, appending a single element to it, and then re-setting this's types array to that array every time. Also, you cannot append to a frozen array; you can only create it, from a list. You need to factor out the steps to create a list before the loop, append to the list in the loop, and then set this's types array to the result of creating a frozen array from the list after the loop. > - 1. If |r| is not "granted", then reject |p| with a "NotAllowedError" DOMException + 1. [=queue a global task=] on the [=permission task source=], given |realm|'s [=Realm/global object=], to perform the below steps: It would be cleaner to only queue the task if _r_ is not "granted". Also, in this case you probably do not want to perform the following steps, so you need to abort these steps. > + The <dfn>clipboard task source</dfn> is triggered in response to reading or writing of [=system clipboard data=]. + + The <dfn>permission task source</dfn> is triggered in response to [=request permission to use=]. I think you should cross-link to https://w3c.github.io/permissions/#dfn-permissions-task-source instead of defining a new task source. So just deleting this and using `[=permissions task source=]` should work. > @@ -693,34 +849,69 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; <h4 method for="Clipboard">write(|data|)</h4> The {{Clipboard/write(data)}} method must run these steps: - 1. Let |p| be a new [=Promise=]. + 1. Let |realm| be [=this=]'s [=relevant realm=]. + + 1. Let |p| be [=a new promise=] in |realm|. 1. Run the following steps [=in parallel=]: 1. Let |r| be the result of running [=check clipboard write permission=] [=in parallel=] ```suggestion 1. Let |r| be the result of running [=check clipboard write permission=]. ``` > + 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|: Here `|clipboardItem|` is a `{{ClipboardItem}}`, not a list. So you cannot loop over it. Maybe you want to loop over `|clipboardItem|'s [=ClipboardItem/clipboard item=]'s [=list of representations=]`? But that doesn't make much sense because there's no promises in the list of representations... I'm not sure what you're trying to do here. > - 1. If |r| is not "granted", then reject |p| with a "NotAllowedError" DOMException + 1. [=queue a global task=] on the [=permission task source=], given |realm|'s [=Realm/global object=], to perform the below steps: Here and elsewhere, don't forget to capitalize the first word in the sentence ("Queue"). -- 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#pullrequestreview-810273857
Received on Thursday, 18 November 2021 18:08:29 UTC