From e31a0e9014a95d876a4e166587cd1ac02027fe07 Mon Sep 17 00:00:00 2001 From: Jiewei Qian Date: Fri, 20 Sep 2024 14:16:53 +1000 Subject: [PATCH] WIP: spec: update in parallel steps to resolve or reject in enqueued tasks --- spec.bs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/spec.bs b/spec.bs index 4fe4ffd..fa7b2b2 100644 --- a/spec.bs +++ b/spec.bs @@ -639,14 +639,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 global task, perform the following steps: + 1. Let |result| be a list. + 1. [=list/For each=] returned prediction |pred|: + 1. Convert |pred| it into {{HandwritingPrediction}} |idl_pred|. + 1. [=list/Append=] |idl_pred| to |result|. + 1. Resolve |p| with |result|. + 1. Return |p|

{{HandwritingPrediction}} attributes

@@ -795,4 +800,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.