Skip to content

Commit

Permalink
Add non-normative and optional texts. (#208)
Browse files Browse the repository at this point in the history
* Add non-normative and optional texts.

* Address PR comments.
  • Loading branch information
snianu authored Feb 14, 2024
1 parent c1d37ae commit c858eb2
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -543,18 +543,23 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;
and suffix (after stripping out `"web "`) passes the [=parsing a MIME type=] check.

<h3 id="unsanitized-data-types-x"><dfn>Unsanitized data types</dfn></h3>
<em>This section is non-normative.</em>

These data types MUST NOT be sanitized by UAs:

* image/png

These data types MAY NOT be sanitized by UAs:

* [=optional unsanitized data types=]

<dfn>Optional unsanitized data types</dfn> are [=representation/mime type=]s specified by the web authors that MUST NOT be sanitized by the user agent.
<dfn>Optional unsanitized data types</dfn> are [=representation/mime type=]s specified by the web authors that MAY NOT be sanitized by the user agent.
The valid [=optional unsanitized data types=] are listed below:

* text/html

<p class=note> [=optional unsanitized data types=] may not be supported by a user agent due to their privacy requirements.</p>

<h2 id="async-clipboard-api">Asynchronous Clipboard API</h2>

<h3 id="navigator-interface">Navigator Interface</h3>
Expand Down Expand Up @@ -817,6 +822,8 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;

{{ClipboardUnsanitizedFormats/unsanitized}} is a [=sequence=] of {{DOMString}}s corresponding to the [=representation/mime type=] that the author wants to be treated as [=optional unsanitized data types=].

<p class=note> The {{ClipboardUnsanitizedFormats/unsanitized}} option MAY NOT be supported by the user agent. The web authors shouldn't assume that the content for the MIME types listed in {{ClipboardUnsanitizedFormats/unsanitized}} would be unsanitized as there could be privacy modes where this option may not be allowed. </p>

The <dfn>clipboard task source</dfn> is triggered in response to reading or writing of [=system clipboard data=].

<div id="clipboard-idl" dfn-for="Clipboard">
Expand Down Expand Up @@ -870,13 +877,13 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;

1. If |format| is equal to [=representation/MIME type=], set |isUnsanitized| to true.

1. Set |representation|'s [=representation/data=] to |systemClipboardRepresentation|'s [=system clipboard representation/data=].
1. Resolve |representation|'s [=representation/data=] with |systemClipboardRepresentation|'s [=system clipboard representation/data=].

Issue: It should be possible to read the data asynchronously from the system clipboard after the author calls getType, however, this set of steps implies that data will be provided at the time of read.

1. The user agent, MUST NOT sanitize |representation|'s [=representation/data=], if it satisfies the below conditions:
1. The user agent, MAY sanitize |representation|'s [=representation/data=], unless |representation|'s [=representation/MIME type=]'s essence is "image/png", which should remain unsanitized to preserve meta data, or if it satisfies the below conditions:

1. |representation|'s [=representation/MIME type=] is in [=unsanitized data types=] list.
1. |representation|'s [=representation/MIME type=] is in optional [=unsanitized data types=] list.

1. |isUnsanitized| is true.

Expand All @@ -885,20 +892,20 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;
1. Set |isUnsanitized| to |false|.

1. If |item|'s [=list of representations=] size is greater than 0, append |item| to |items|.
If |items| has a size > 0, then:

1. If |items| has a size > 0, then:

1. Let |firstItem| be |items|[0]
1. Let |firstItem| be |items|[0]

1. Run the [=read web custom format=] algorithm given |firstItem|.

1. Run the [=read web custom format=] algorithm given |firstItem|.

Else:
1. Else:

1. Let |customItem| be a new [=/clipboard item=].
1. Let |customItem| be a new [=/clipboard item=].

1. Run the [=read web custom format=] algorithm given |customItem|.
1. Run the [=read web custom format=] algorithm given |customItem|.

1. If |customItem|'s [=list of representations=] size is greater than 0, append |item| to |items|.
1. If |customItem|'s [=list of representations=] size is greater than 0, append |customItem| to |items|.


1. [=Queue a global task=] on the [=clipboard task source=], given |realm|'s [=realm/global object=], to perform the below steps:
Expand Down

0 comments on commit c858eb2

Please sign in to comment.