Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: spec: update in parallel steps to resolve or reject in tasks #36

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ Take the handwritten text "int" for example:
If the application wants to delete character "t", it can remove stroke 3 and 4 from the drawing.
</div>

<h2 id="api-idioms">API Idioms</h2>

The [=task source=] mentioned in this specification is the <dfn data-export id="handwriting-recognition-task-source">handwriting recognition task source</dfn>.

When an algorithm <dfn data-export id="queue-task">queues a Handwriting Recognition API task</dfn> |T|, the user agent *MUST* [=queue a global task=] |T| on the [=handwriting recognition task source=] using the [=global object=] of the [[ecma-262#current-realm|current realm]].
wacky6 marked this conversation as resolved.
Show resolved Hide resolved

Unless specified, the [[ecma-262#realm|realm]] for JavaScript objects constructed by algorithm steps is the [[ecma-262#current-realm|current realm]].
wacky6 marked this conversation as resolved.
Show resolved Hide resolved


<h2 id="api-query" data-dfn-for="Navigator">Feature Query</h2>

Feature query interface provides allows web applications to query implementation-specific capabilities, so they can decide whether to use its feature.
Expand Down Expand Up @@ -639,14 +648,19 @@ If the handwriting recognizer wasn't able to recognize anything, {{HandwritingDr
<div algorithm="handwriting-drawing-get-prediction">
When {{HandwritingDrawing/getPrediction()}} is invoked:

1. If `this`.[=HandwritingDrawing/recognizer=].[=HandwritingRecognizer/active=] isn't true, return a [=/a promise rejected with=] {{"InvalidStateError"}} {{DOMException}}.
1. If `this`.[=HandwritingDrawing/strokes=] is empty, return a [=a promise resolved with=] a new empty [=list=].
1. <a lt="convert">Convert `this` drawing into a format suitable</a> for [=handwriting recognizer=].
1. Let |p| be a new Promise, run the following step [=in parallel=]
1. If `this`.[=HandwritingDrawing/recognizer=].[=HandwritingRecognizer/active=] isn't true, reject |p| with a new {{DOMException}} whose name is {{"InvalidStateError"}} and abort.
1. If `this`.[=HandwritingDrawing/strokes=] is empty, resolve |p| with a new empty [=list=].
1. Let |result| be a list.
1. <a lt="convert">Convert `this` drawing into a format suitable</a> for [=handwriting recognizer=].
1. Send the converted drawing to [=handwriting recognizer=], and retrieves its prediction.
1. <a lt="convert">Convert the retrieved predictions into </a> {{HandwritingPrediction}}, then [=list/append=] the converted predictions to |result|.
1. Resolve |p| with |result|.
1. Send the converted drawing to [=handwriting recognizer=].
1. Wait for [=handwriting recognizer=] to return its predictions.
1. [=Queues a Handwriting Recognition API task=], perform the following steps:
wacky6 marked this conversation as resolved.
Show resolved Hide resolved
1. Let |result| be a list.
1. [=list/For each=] returned prediction |pred|:
1. <a lt="convert">Convert |pred| it into </a> {{HandwritingPrediction}} |idl_pred|.
wacky6 marked this conversation as resolved.
Show resolved Hide resolved
1. [=list/Append=] |idl_pred| to |result|.
1. Resolve |p| with |result|.
1. Return |p|
</div>

<h3 id="handwriting-prediction">{{HandwritingPrediction}} attributes</h3>
Expand Down Expand Up @@ -795,4 +809,4 @@ Below are some types of recognizer implementations, and their associated risks:

However, we aren't aware of any recognizer implementations that falls within this type. But we recommend using privacy protection for these models, or use a fresh / clean state for each session.

**Cost of fingerprinting**: the fingerprinting solution need to craft and curate a set of handwriting drawings (adversarial samples) to exploit differences across models. The cost of generating these samples may be high, but it's safe to assume a motivated party can obtain such samples.
**Cost of fingerprinting**: the fingerprinting solution need to craft and curate a set of handwriting drawings (adversarial samples) to exploit differences across models. The cost of generating these samples may be high, but it's safe to assume a motivated party can obtain such samples.
Loading