Re: [w3c/clipboard-apis] Add clipboard change checks to write algorithms (PR #256)

@roraja commented on this pull request.



> @@ -1373,6 +1389,14 @@ url: https://storage.spec.whatwg.org/#obtain-a-storage-key-for-non-storage-purpo
 
      1. Let |option| be set to "unspecified".
 
+     1. Let |currentChangeCount| be the current [=clipboard change count=].
+
+     1. If |currentChangeCount| is not equal to |snapshotChangeCount|, then follow the below steps:
+
+      1. [=Reject=] |p| with {{"InvalidStateError"}} {{DOMException}} in |realm|.

`InvalidStateError` is technically correct, but it may not make clear to web authors that the clipboard changed while the write was pending. Could we also provide a descriptive exception message, such as “Clipboard contents changed while the write was pending”? There is precedent in the [[Media Capture spec](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-getusermedia)](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-getusermedia), which allows an informative human-readable message when rejecting with `OverconstrainedError`.

This is **non-blocking** and could be a follow-up, since other Clipboard API rejection paths also do not specify descriptive messages.

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

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

Received on Tuesday, 1 December 2026 18:55:33 UTC