- From: Zgroza (Luke Klimek) <notifications@github.com>
- Date: Tue, 11 Nov 2025 16:42:49 -0800
- To: w3c/clipboard-apis <clipboard-apis@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/clipboard-apis/pull/239/review/3450742510@github.com>
@zgroza commented on this pull request.
> @@ -224,12 +227,166 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;
* Scripts that use the [[#async-clipboard-api]] to write to the clipboard
* Actions that update the clipboard outside the user agent
- If the clipboard contents are changed outside the user agent, then the
- {{GlobalEventHandlers/clipboardchange}} event MUST fire when the user agent regains focus.
+ <div class="algorithm" data-algorithm="fire-clipboardchange-event">
+ <h5 id="h-fire-clipboardchange-event">To fire a clipboardchange event</h5>
+
+ To <dfn export>fire a clipboardchange event</dfn> given a {{Document}} <var>document</var>:
+
+ 1. If <var>document</var> does not have [=sticky activation=] and <var>document</var> does not have permission to read from the clipboard, then return.
+
+ 2. Let <var>global</var> be <var>document</var>'s [=relevant global object=].
+
+ 3. If <var>document</var> has [=system focus=]:
+ 1. Let <var>types</var> be a list of [=mandatory data types=] available on the [=system clipboard=].
+ 2. Let <var>changeId</var> be a unique identifier for this clipboard change, generated by applying a partition-specific transformation to a system-level clipboard change identifier, ensuring that different [=partitions=] receive different identifiers for the same clipboard change while maintaining consistency within the same [=partition=].
Summarizing a bit a TPAC corridor conversation (please correct me if I remember something wrong):
* Let's re-add the normative algorithm and add hashing of a global `changeId` against some (possibly user agent internal) binary representation of the [storage key](https://storage.spec.whatwg.org/#storage-key) (getting the key via [obtain-a-storage-key-for-non-storage-purposes](https://storage.spec.whatwg.org/#obtain-a-storage-key-for-non-storage-purposes))
* With the planned [Client-side Storage Partitioning](https://privacycg.github.io/storage-partitioning/)-related changes in storage key definitions this should be enough to soon also anonymize this across partitions
* Let's forgo the need for the (partition, origin) identifier to have the lifetime of local storage, as the final `changeId` will change anyway when:
* The browser restarts (listeners obviously won't persist this, and every new event relates to a new change and thus will have a new ID)
* User clears site data (this should trigger refresh of all the relevant tabs, which will cause re-attaching of all the listeners, thus making only the future events with new IDs available)
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/239#discussion_r2516280810
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/clipboard-apis/pull/239/review/3450742510@github.com>
Received on Wednesday, 12 November 2025 00:42:52 UTC