Re: [w3c/clipboard-apis] Defer OS clipboard read from clipboard.read() to ClipboardItem.getType() (PR #248)

@EdgarChen commented on this pull request.



> +
+     1. If |representation|'s [=representation/data=] is not yet resolved, run the following steps [=in parallel=]:
+
+      Note: When a {{ClipboardItem}} is obtained from {{Clipboard/read()}}, its [=representation/data=] is initialized to an unresolved promise so that the OS clipboard read can be deferred to this point.
+
+      1. If |isCustom| is true, then:
+
+       1. Let |webCustomFormatMap| be the [=os specific custom map name=].
+
+       1. Read |webCustomFormatMap| from the [=system clipboard=].
+
+       1. Let |webCustomFormatMapString| be the JSON string deserialized from |webCustomFormatMap|.
+
+       1. Let |osFormatName| be the value in |webCustomFormatMapString| whose key matches |mimeType| [=serialize a MIME type|serialized=].
+
+       1. If |osFormatName| is not found, then [=queue a global task=] on the [=clipboard task source=], given |realm|'s [=realm/global object=], to [=reject=] |p| with a {{"NotFoundError"}} {{DOMException}} in |realm|, then abort these steps.

We reject the `p` which is new created Promise for `read()`, and then later we still `React to representationDataPromise`, is this intentional? Or when does the `representationDataPromise` be fulfilled or rejected? Or maybe I miss something.

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

Message ID: <w3c/clipboard-apis/pull/248/review/4242276311@github.com>

Received on Thursday, 7 May 2026 08:19:44 UTC