Skip to content

Commit 86a502c

Browse files
committed
Prevent firing downloadprogress events after aborting
Closes #50.
1 parent 75f7941 commit 86a502c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

index.bs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,14 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m
17561756

17571757
1. If |document| is not [=allowed to use=] |permissionsPolicyFeature|, then return [=a promise rejected with=] a "{{NotAllowedError}}" {{DOMException}}.
17581758

1759+
1. Let |abortedDuringDownload| be false.
1760+
1761+
<p class="note">This variable will be written to from the [=event loop=], but read from [=in parallel=].
1762+
1763+
1. If |options|["`signal`"] [=map/exists=], then [=AbortSignal/add|add the following abort steps=] to |options|["`signal`"]:
1764+
1765+
1. Set |abortedDuringDownload| to true.
1766+
17591767
1. Let |fireProgressEvent| be an algorithm taking one argument that does nothing.
17601768

17611769
1. If |options|["`monitor`"] [=map/exists=], then:
@@ -1772,15 +1780,9 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m
17721780

17731781
1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to perform the following steps:
17741782

1775-
1. [=Fire an event=] named {{CreateMonitor/downloadprogress}} at |monitor|, using {{ProgressEvent}}, with the {{ProgressEvent/loaded}} attribute initialized to |loaded|, the {{ProgressEvent/total}} attribute initialized to 1, and the {{ProgressEvent/lengthComputable}} attribute initialized to true.
1783+
1. If |abortedDuringDownload| is true, then abort these steps.
17761784

1777-
1. Let |abortedDuringDownload| be false.
1778-
1779-
<p class="note">This variable will be written to from the [=event loop=], but read from [=in parallel=].
1780-
1781-
1. If |options|["`signal`"] [=map/exists=], then [=AbortSignal/add|add the following abort steps=] to |options|["`signal`"]:
1782-
1783-
1. Set |abortedDuringDownload| to true.
1785+
1. [=Fire an event=] named {{CreateMonitor/downloadprogress}} at |monitor|, using {{ProgressEvent}}, with the {{ProgressEvent/loaded}} attribute initialized to |loaded|, the {{ProgressEvent/total}} attribute initialized to 1, and the {{ProgressEvent/lengthComputable}} attribute initialized to true.
17841786

17851787
1. Let |promise| be [=a new promise=] created in |realm|.
17861788

0 commit comments

Comments
 (0)