Skip to content

Commit 0e5c08e

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 a628691 commit 0e5c08e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

index.bs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,22 @@ enum RewriterLength { "as-is", "shorter", "longer" };
949949
::
950950
1. If |availability| is "{{Availability/downloadable}}", then:
951951

952+
1. If |realm|'s [=realm/global object=] does not have [=transient activation=], then:
953+
954+
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
955+
956+
1. Abort these steps.
957+
958+
1. [=Consume user activation=] given |realm|'s [=realm/global object=].
959+
960+
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:
961+
962+
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.
963+
964+
1. Abort these steps.
965+
966+
<p class="note">The case where the user cancels the download after it starts is handled later, as part of the download loop.
967+
952968
1. Let |startDownloadResult| be the result of performing |startDownload| given |options|.
953969

954970
1. If |startDownloadResult| is false, then:
@@ -977,7 +993,7 @@ enum RewriterLength { "as-is", "shorter", "longer" };
977993

978994
1. While true:
979995

980-
1. If downloading has failed, then:
996+
1. If downloading has failed, or the user has canceled the download, then:
981997

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

0 commit comments

Comments
 (0)