diff --git a/spec.bs b/spec.bs index 4fe4ffd..529dcbb 100644 --- a/spec.bs +++ b/spec.bs @@ -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. +

API Idioms

+ +The [=task source=] mentioned in this specification is the handwriting recognition task source. + +When an algorithm queues a Handwriting Recognition API task |T|, the user agent *MUST* [=queue a global task=] |T| on the [=handwriting recognition task source=] using the [=/global object=] of [=ECMAScript/the current realm record=]. + +Unless specified, the [=ECMAScript/realm=] for JavaScript objects constructed by algorithm steps is [=ECMAScript/the current realm record=]. + +

Feature Query

Feature query interface provides allows web applications to query implementation-specific capabilities, so they can decide whether to use its feature. @@ -639,14 +648,19 @@ If the handwriting recognizer wasn't able to recognize anything, {{HandwritingDr
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. Convert `this` drawing into a format suitable 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. Convert `this` drawing into a format suitable for [=handwriting recognizer=]. - 1. Send the converted drawing to [=handwriting recognizer=], and retrieves its prediction. - 1. Convert the retrieved predictions into {{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. [=Queue a Handwriting Recognition API task=] to perform the following steps: + 1. Let |result| be a list. + 1. [=list/For each=] returned prediction |pred|: + 1. Convert |pred| into {{HandwritingPrediction}} |idl_pred|. + 1. [=list/Append=] |idl_pred| to |result|. + 1. Resolve |p| with |result|. + 1. Return |p|

{{HandwritingPrediction}} attributes

@@ -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. \ No newline at end of file +**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.