diff --git a/index.bs b/index.bs index de706bb..46f74b6 100644 --- a/index.bs +++ b/index.bs @@ -45,6 +45,9 @@ Complain about:accidental-2119 yes, missing-example-ids yes } } +
+spec:storage; type:dfn; text:storage key +
This section is non-normative.
+ +This section is non-normative.
+ +This section is normative.
@@ -345,6 +452,15 @@ interface SpeechRecognitionPhrase {+ When {{SpeechRecognition/processLocally}} is `false`, user speech data might be sent to a remote server for processing; user agents SHOULD be transparent with users about where speech processing occurs (see Cloud-Based vs. On-Device Implementations). +
++ Regardless of the value of {{SpeechRecognition/processLocally}}, implementations MUST NOT train or fine-tune on-device speech recognition models on user speech input obtained through this API, or otherwise store user speech input in a way that models can consult in the future (e.g., for personalization beyond the current session or across origins; see User Input and Speech Data). +
++ When delegating on-device speech recognition to models or capabilities provided by the underlying operating system, user agents MUST ensure that all privacy and security requirements of this specification are met, even if the user agent has less control over the model's behavior (see OS-Provided Models). +
+ To prevent cross-origin fingerprinting and site collusion, user agents MUST partition on-device language pack availability by [=storage key=]. User agents MUST mask the current download status by returning {{"downloadable"}} from {{SpeechRecognition/available()}} by default when {{SpeechRecognitionOptions/processLocally}} is `true`, even if the actual underlying language pack is {{"available"}} or {{"downloading"}} on the user's device (see this step of the [=availability algorithm=] and Download Masking). + This download masking state is established for each (options, [=storage key=]) tuple (specifically, per language in {{SpeechRecognitionOptions/langs}} and {{SpeechRecognitionOptions/quality}} of options for a given [=storage key=], ignoring {{SpeechRecognitionOptions/processLocally}}). The user agent MUST only set the state to "unmasked" for a specific (options, [=storage key=]) tuple after a web page within that key explicitly calls {{SpeechRecognition/install()}} with a given set of options, and that call either successfully initiates (or joins an ongoing) download or resolves to `true` (indicating the language pack is ready; see this step of {{SpeechRecognition/install()}}). + Implementations MUST ensure that this [=storage key=]-based [=download masking state=] is cleared whenever other storage for that [=storage key=] is cleared. +
+ ++ User agents SHOULD limit the number of possible on-device model versions that a single user agent version can be paired with when determining if a language pack is {{"available"}} via {{SpeechRecognition/available()}} (for example, by tying model updates to user agent updates or ignoring already-downloaded models below a minimum version threshold after a user agent update and reporting {{"downloadable"}} for a newer version instead; see Model Version). +
+ When invoked, run these steps: 1. Let promise be a new promise. 1. Run the availability algorithm with options and promise. @@ -416,6 +542,7 @@ See [=default allowlist/'self'=]. When invoked, run these steps: @@ -424,12 +551,18 @@ See If {{SpeechRecognition/available()}} would resolve to {{"downloadable"}} for options (evaluated as if {{SpeechRecognitionOptions/processLocally}} of options weretrue), that is, if, as far as the calling web page can observe, this call would initiate a download, then:
+ 1. If the [=current settings object=]'s [=relevant global object=] does not have [=transient activation=], reject promise with a {{NotAllowedError}}, abort these steps, returning promise.
+ 1. [=Consume user activation=] given the [=current settings object=]'s [=relevant global object=].
+
+ + Note: Because {{SpeechRecognition/available()}} is subject to [=download masking state=] rules, this check is based on the masked availability status rather than on the true download status. As a result, whether {{SpeechRecognition/install()}} requires [=transient activation=] does not reveal the true download status to a web page for which it is still masked. +
1. [=In parallel=], run the following steps: - 1. For each lang in {{SpeechRecognitionOptions/langs}} of options, initiate the download of the on-device speech recognition language pack for lang matching the requested {{SpeechRecognitionOptions/quality}} level floor. -- Note: The user agent can prompt the user for explicit permission to download the on-device speech recognition language pack. -
- 1. Wait for the download of all languages specified by {{SpeechRecognitionOptions/langs}} of options to either succeed or fail. + 1. The user agent MAY prompt the user for explicit permission to download the on-device speech recognition language pack(s), or MAY decline to initiate the download based on implicit signals (such as an observed pattern of abuse; see Installation-Time Friction) or storage pressure. In the event of storage pressure, user agents SHOULD balance the utility of on-device speech recognition with the disk space its language packs take up (possibly by declining new downloads or freeing up disk space in other ways, subject to the eviction requirements below; see Disk Space for Language Packs), and MAY involve the user in these decisions (e.g., via the download-time permission prompt or a browser UI for managing downloaded language packs). If the download is not permitted, [=queue a task=] on the [=relevant global object=]'s [=task queue=] to resolve promise withfalse, and abort these steps.
+ 1. For each lang in {{SpeechRecognitionOptions/langs}} of options, initiate the download of the on-device speech recognition language pack for lang matching the requested {{SpeechRecognitionOptions/quality}} level floor (if not already installed or downloading).
+ 1. If the download was successfully initiated (or the language pack is already installed or downloading) for every lang in {{SpeechRecognitionOptions/langs}} of options, set the [=download masking state=] for (options, [=storage key=]) to "unmasked".
+ 1. Wait for the download of all languages specified by {{SpeechRecognitionOptions/langs}} of options to either succeed or fail. User agents MAY artificially fake a download (e.g., by adding a delay before resolving promise) if they believe it would be helpful for privacy reasons, instead of resolving instantly if the language pack is already present (see Sensitive Language Information). During such a fake download, the user agent MUST report the availability status for that [=storage key=] as {{"downloading"}} (and treat the language pack as not yet installed for other purposes observable by that [=storage key=], including in the [=start session algorithm=] and the {{SpeechRecognitionOptions/processLocally}} `false` branch of the [=availability algorithm=]) so that the web page cannot distinguish a fake delay from a real download.
1. If the download of all those languages succeeded, let result be true, otherwise let result be false.
1. [=Queue a task=] on the [=relevant global object=]'s [=task queue=] to resolve promise with result.
@@ -437,8 +570,16 @@ See + User agents MAY cancel ongoing language pack downloads when the requesting document is destroyed or navigated away from, in accordance with their standard resource management policies, provided that doing so does not change the availability status observable by any other [=storage key=] (e.g., not canceling an underlying download that another [=storage key=] is also waiting on; see Download Cancelation). +
+ ++ User agents SHOULD NOT implement systems which allow web pages to control the eviction of downloaded language packs, including via indirect triggers such as further subsequent downloads (for example, quota-based or least-recently-used eviction in response to web page-initiated storage pressure; see Download Eviction). Evicting downloads in response to user-controlled actions (e.g., via a browser settings UI) is permitted. +
@@ -482,7 +623,7 @@ See language in langs, let status be {{AvailabilityStatus/available}}. 1. Else, let status be {{AvailabilityStatus/unavailable}}. 1. If {{SpeechRecognitionOptions/processLocally}} of options is `true`:+ If a previously installed language pack is evicted (e.g., by the user or due to extreme storage pressure) while it might be in use or expected to be available, subsequent attempts to use it (e.g., via {{SpeechRecognition/start()}} with {{SpeechRecognition/lang}} set to that language and {{SpeechRecognition/processLocally}} set to `true`) SHOULD fail gracefully (such as {{SpeechRecognition/available()}} returning {{"downloadable"}} (or {{"unavailable"}} if no longer supported), and {{SpeechRecognition/start()}} firing a {{SpeechRecognitionErrorEvent}} with an appropriate error code like {{SpeechRecognitionErrorCode/service-not-allowed}} (or {{SpeechRecognitionErrorCode/language-not-supported}} if no longer supported); see Disk Space for Language Packs). +
++ User agents SHOULD ensure that one web page's use of on-device speech recognition does not overly interfere with another web page's use of the API, or another web page's general operation, or the overall system stability (for example, by queuing requests, rate limiting, prioritizing foreground tabs, or detecting abusive behavior; see Runtime Shared Resources). If necessary to prevent resource exhaustion or instability, the user agent MAY cause speech recognition operations to fail (e.g., by firing a {{SpeechRecognitionErrorEvent}} with {{SpeechRecognitionErrorCode/service-not-allowed}}). On-device speech recognition sessions are also subject to the user input retention rules and the OS-provided model rules under {{SpeechRecognition/processLocally}}. +
+The DOM Level 2 Event Model is used for speech recognition events.