Skip to content

Commit b013863

Browse files
authored
Relax user activation requirements for session creation (#86)
This change updates the specification to require sticky user activation instead of transient user activation for creating sessions under certain conditions, as discussed in issue #83. Fixes: #83
1 parent 19fa04f commit b013863

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

index.bs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ enum SummarizerLength { "short", "medium", "long" };
113113
<div algorithm>
114114
The static <dfn method for="Summarizer">create(|options|)</dfn> method steps are:
115115

116-
1. Return the result of [=creating an AI model object=] given |options|, "{{summarizer}}", [=validate and canonicalize summarizer options=], [=computing summarizer options availability=], [=download the summarizer model=], [=initialize the summarizer model=], and [=create a summarizer object=].
116+
1. Return the result of [=creating an AI model object=] given |options|, "{{summarizer}}", [=validate and canonicalize summarizer options=], [=computing summarizer options availability=], [=download the summarizer model=], [=initialize the summarizer model=], [=create a summarizer object=], and false.
117117
</div>
118118

119119
<div algorithm>
@@ -699,7 +699,7 @@ enum WriterLength { "short", "medium", "long" };
699699
<div algorithm>
700700
The static <dfn method for="Writer">create(|options|)</dfn> method steps are:
701701

702-
1. Return the result of [=creating an AI model object=] given |options|, "{{writer}}", [=validate and canonicalize writer options=], [=computing writer options availability=], [=download the writer model=], [=initialize the writer model=], and [=create a writer object=].
702+
1. Return the result of [=creating an AI model object=] given |options|, "{{writer}}", [=validate and canonicalize writer options=], [=computing writer options availability=], [=download the writer model=], [=initialize the writer model=], [=create a writer object=], and false.
703703
</div>
704704

705705
<div algorithm>
@@ -1214,7 +1214,7 @@ enum RewriterLength { "as-is", "shorter", "longer" };
12141214
<div algorithm>
12151215
The static <dfn method for="Rewriter">create(|options|)</dfn> method steps are:
12161216

1217-
1. Return the result of [=creating an AI model object=] given |options|, "{{rewriter}}", [=validate and canonicalize rewriter options=], [=computing rewriter options availability=], [=download the rewriter model=], [=initialize the rewriter model=], and [=create a rewriter object=].
1217+
1. Return the result of [=creating an AI model object=] given |options|, "{{rewriter}}", [=validate and canonicalize rewriter options=], [=computing rewriter options availability=], [=download the rewriter model=], [=initialize the rewriter model=], [=create a rewriter object=], and false.
12181218
</div>
12191219

12201220
<div algorithm>
@@ -1745,7 +1745,7 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m
17451745
* an algorithm |getAvailability| taking an [=ordered map=] and returning an {{Availability}} or null,
17461746
* an algorithm |startDownload| taking an [=ordered map=] and returning a boolean,
17471747
* an algorithm |initialize| taking an [=ordered map=] and returning an error information or null, and
1748-
* an algorithm |create| taking a [=ECMAScript/realm=] and an [=ordered map=] and returning a Web IDL object representing the model,
1748+
* an algorithm |create| taking a [=ECMAScript/realm=], an [=ordered map=] and an optional boolean |requireTransientActivation| (default true) and returning a Web IDL object representing the model,
17491749

17501750
perform the following steps:
17511751

@@ -1827,13 +1827,20 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m
18271827
::
18281828
1. If |availability| is "{{Availability/downloadable}}", then:
18291829

1830-
1. If |realm|'s [=realm/global object=] does not have [=transient activation=], then:
1830+
1. If |requireTransientActivation| is true, then:
1831+
1. If |realm|'s [=realm/global object=] does not have [=transient activation=], then:
18311832

1832-
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
1833+
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
18331834

1834-
1. Abort these steps.
1835+
1. Abort these steps.
18351836

1836-
1. [=Consume user activation=] given |realm|'s [=realm/global object=].
1837+
1. [=Consume user activation=] given |realm|'s [=realm/global object=].
1838+
1. Otherwise:
1839+
1. If |realm|'s [=realm/global object=] does not have [=sticky activation=], then:
1840+
1841+
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
1842+
1843+
1. Abort these steps.
18371844

18381845
1. <span id="step-download-user-interface"></span>The user agent may display a user interface to the user to confirm that they want to perform the download operation given by |startDownload|, or to show the progress of the download. Alternately, the user agent may decide to deny the ability to perform |startDownload| based on implicit signals of the user's intent, including the considerations in [[#privacy-availability-eviction]] and [[#security-disk-space]]. If the user explicitly or implicitly signals that they do not want to start the download, then:
18391846

0 commit comments

Comments
 (0)