Skip to content

Commit e9b871c

Browse files
committed
Add download id to download events.
1 parent fcd2302 commit e9b871c

1 file changed

Lines changed: 40 additions & 7 deletions

File tree

index.bs

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ spec: ECMASCRIPT; urlPrefix: https://tc39.es/ecma262/
187187
text: test; url: #sec-regexp.prototype.test
188188
text: time value; url: sec-time-values-and-time-range
189189
text: undefined; url: sec-undefined-value
190+
spec: FETCH; urlPrefix: https://fetch.spec.whatwg.org/
191+
type: dfn
192+
text: response; url: #concept-response
190193
spec: GEOMETRY; urlPrefix: https://drafts.fxtf.org/geometry/
191194
type: dfn
192195
text: rectangle; url: rectangle
@@ -3253,6 +3256,9 @@ The progress of navigation is communicated using an immutable [=struct=]
32533256
<dt><dfn export for="WebDriver BiDi navigation status" id="navigation-status-downloaded-filepath">downloadedFilepath</dfn></dt>
32543257
<dd>If the navigation is a download which is finished and the downloaded file is
32553258
available, absolute filepath of the downloaded file, otherwise null.</dd>
3259+
3260+
<dt><dfn export for="WebDriver BiDi navigation status" id="navigation-status-download-response">downloadResponse</dfn></dt>
3261+
<dd>If the navigation is a download, [=response=], otherwise null.</dd>
32563262
</dl>
32573263

32583264
### Definition ### {#module-browsingContext-definition}
@@ -3362,6 +3368,9 @@ weak map between [=user context|user contexts=] and [=unhandled prompt behavior
33623368
A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
33633369
map between [=/navigables=] or [=user context|user contexts=] and boolean.
33643370

3371+
A [=remote end=] has a <dfn>download id map</dfn> which is is a weak map between
3372+
[=response=] and download ids. It is initially empty.
3373+
33653374
### Types ### {#module-browsingcontext-types}
33663375

33673376
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -3633,6 +3642,16 @@ navigation.
36333642

36343643
TODO: Link to the definition in the HTML spec.
36353644

3645+
#### The browsingContext.Download Type #### {#type-browsingContext-Download}
3646+
3647+
{^remote end definition^} and {^local end definition^}
3648+
3649+
<pre class="cddl" data-cddl-module="remote-cddl,local-cddl">
3650+
browsingContext.Download = text;
3651+
</pre>
3652+
3653+
The <code>browsingContext.Download</code> type is a unique string identifying a download.
3654+
36363655

36373656
#### The browsingContext.NavigationInfo Type #### {#type-browsingContext-NavigationInfo}
36383657

@@ -5748,6 +5767,7 @@ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi load complete
57485767
)
57495768

57505769
browsingContext.DownloadWillBeginParams = {
5770+
download: browsingContext.Download,
57515771
suggestedFilename: text,
57525772
browsingContext.BaseNavigationInfo
57535773
}
@@ -5763,14 +5783,19 @@ The [=remote end event trigger=] is the
57635783
1. Let |navigation info| be the result of [=get the navigation info=] given
57645784
|navigable| and |navigation status|.
57655785

5786+
1. Let |download| be the string representation of a [[!RFC9562|UUID]].
5787+
5788+
1. [=map/Set=] [=download id map=][|navigation status|'s [=WebDriver BiDi navigation status/downloadResponse=]] to |download|.
5789+
57665790
1. Let |params| be a [=/map=] matching the
57675791
<code>browsingContext.DownloadWillBeginParams</code> production, with the
57685792
<code>context</code> field set to |navigation info|["<code>context</code>"], the
57695793
<code>navigation</code> field set to |navigation info|["<code>navigation</code>"],
57705794
the <code>timestamp</code> field set to
57715795
|navigation info|["<code>timestamp</code>"], the <code>url</code> field set to
5772-
|navigation info|["<code>url</code>"] and <code>suggestedFilename</code> field set
5773-
to |navigation status|'s [=WebDriver BiDi navigation status/suggestedFilename=].
5796+
|navigation info|["<code>url</code>"], the <code>download</code> field set to |download|
5797+
and the <code>suggestedFilename</code> field set to
5798+
|navigation status|'s [=WebDriver BiDi navigation status/suggestedFilename=].
57745799

57755800
1. Let |body| be a [=/map=] matching the
57765801
<code>browsingContext.DownloadWillBegin</code> production, with the
@@ -5814,11 +5839,13 @@ The [=remote end event trigger=] is the
58145839

58155840
browsingContext.DownloadCanceledParams = (
58165841
status: "canceled",
5842+
download: browsingContext.Download,
58175843
browsingContext.BaseNavigationInfo
58185844
)
58195845

58205846
browsingContext.DownloadCompleteParams = (
58215847
status: "complete",
5848+
download: browsingContext.Download,
58225849
filepath: text / null,
58235850
browsingContext.BaseNavigationInfo
58245851
)
@@ -5837,10 +5864,16 @@ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi download end<
58375864
1. Assert |navigation info|["<code>status</code>"] is equal to either
58385865
"<code>complete</code>" or "<code>canceled</code>".
58395866

5867+
1. Let |download response| be |navigation status|'s [=WebDriver BiDi navigation status/downloadResponse=].
5868+
5869+
1. If [=download id map=] [=map/contains=] |download response|, let |download| be
5870+
[=download id map=][|download response|], otherwise let |download| be
5871+
the string representation of a [[!RFC9562|UUID]].
5872+
58405873
1. If |navigation info|["<code>status</code>"] is "<code>complete</code>", let
58415874
|params| be a [=/map=] matching the
5842-
<code>browsingContext.DownloadCompleteParams</code> production, with the
5843-
<code>filepath</code> field set to
5875+
<code>browsingContext.DownloadCompleteParams</code> production, with the <code>download</code> field
5876+
set to |download|, the <code>filepath</code> field set to
58445877
|navigation status|'s [=WebDriver BiDi navigation status/downloadedFilepath=], the
58455878
<code>context</code> field set to |navigation info|["<code>context</code>"], the
58465879
<code>navigation</code> field set to |navigation info|["<code>navigation</code>"],
@@ -5852,9 +5885,9 @@ The [=remote end event trigger=] is the <dfn export>WebDriver BiDi download end<
58525885
not available for whatever reason.
58535886

58545887
1. Otherwise, let |params| be a [=/map=] matching the
5855-
<code>browsingContext.DownloadCanceledParams</code> production, with the
5856-
<code>context</code> field set to |navigation info|["<code>context</code>"], the
5857-
<code>navigation</code> field set to |navigation info|["<code>navigation</code>"],
5888+
<code>browsingContext.DownloadCanceledParams</code> production, with the <code>download</code> field
5889+
set to |download|, the <code>context</code> field set to |navigation info|["<code>context</code>"],
5890+
the <code>navigation</code> field set to |navigation info|["<code>navigation</code>"],
58585891
the <code>timestamp</code> field set to
58595892
|navigation info|["<code>timestamp</code>"], and the <code>url</code> field set to
58605893
|navigation info|["<code>url</code>"].

0 commit comments

Comments
 (0)