Skip to content

Commit eceee65

Browse files
committed
Add more privacy mitigations to downloading
* Require and consume user activation. * Explicitly allow the user agent to show a prompt or download UI.
1 parent 5b66020 commit eceee65

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

index.bs

+17-1
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,22 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m
18081808
::
18091809
1. If |availability| is "{{Availability/downloadable}}", then:
18101810

1811+
1. If |realm|'s [=realm/global object=] does not have [=transient activation=], then:
1812+
1813+
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
1814+
1815+
1. Abort these steps.
1816+
1817+
1. [=Consume user activation=] given |realm|'s [=realm/global object=].
1818+
1819+
1. 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. If the user explicitly or implicitly signals that they do not want to start the download, then:
1820+
1821+
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
1822+
1823+
1. Abort these steps.
1824+
1825+
<p class="note">The case where the user cancels the download after it starts is handled later, as part of the download loop.
1826+
18111827
1. Let |startDownloadResult| be the result of performing |startDownload| given |options|.
18121828

18131829
1. If |startDownloadResult| is false, then:
@@ -1836,7 +1852,7 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m
18361852

18371853
1. While true:
18381854

1839-
1. If downloading has failed, then:
1855+
1. If downloading has failed, or the user has canceled the download, then:
18401856

18411857
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NetworkError}}" {{DOMException}}.
18421858

0 commit comments

Comments
 (0)