8000 [WebDriver BiDi] download process automation · whatwg/html@caa3623 · GitHub
[go: up one dir, main page]

Skip to content

Commit caa3623

Browse files
[WebDriver BiDi] download process automation
1 parent 69e858f commit caa3623

File tree

1 file changed

+92
-22
lines changed

1 file changed

+92
-22
lines changed

source

Lines changed: 92 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4654,11 +4654,15 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
46544654
<li><dfn data-x="navigation-status-complete" data-x-href="https://w3c.github.io/webdriver-bidi/#navigation-status-complete">navigation status complete</dfn></li>
46554655
<li><dfn data-x="navigation-status-url" data-x-href="https://w3c.github.io/webdriver-bidi/#navigation-status-url">navigation status url</dfn></li>
46564656
<li><dfn data-x="navigation-status-suggested-filename" data-x-href="https://w3c.github.io/webdriver-bidi/#navigation-status-suggested-filename">navigation status suggested filename</dfn></li>
4657+
<li><dfn data-x="download-behavior-struct-allowed" data-x-href="https://w3c.github.io/webdriver-bidi/#download-behavior-struct-allowed">download behavior allowed</dfn></li>
4658+
<li><dfn data-x="download-behavior-struct-destination-folder" data-x-href="https://w3c.github.io/webdriver-bidi/#download-behavior-struct-destination-folder">download behavior destination folder</dfn></li>
4659+
<li><dfn data-x="navigation-status-downloaded-filepath" data-x-href="https://w3c.github.io/webdriver-bidi/#navigation-status-downloaded-filepath">navigation status downloaded filepath</dfn></li>
46574660
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-navigation-aborted">WebDriver BiDi navigation aborted</dfn></li>
46584661
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-navigation-committed">WebDriver BiDi navigation committed</dfn></li>
46594662
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-navigation-failed">WebDriver BiDi navigation failed</dfn></li>
46604663
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-navigation-started">WebDriver BiDi navigation started</dfn></li>
4661-
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-download-started">WebDriver BiDi download started</dfn></li>
4664+
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-download-end">WebDriver BiDi download end</dfn></li>
4665+
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-download-will-begin">WebDriver BiDi download will begin</dfn></li>
46624666
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-fragment-navigated">WebDriver BiDi fragment navigated</dfn></li>
46634667
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-dom-content-loaded">WebDriver BiDi DOM content loaded</dfn></li>
46644668
<li><dfn data-x-href="https://w3c.github.io/webdriver-bidi/#webdriver-bidi-load-complete">WebDriver BiDi load complete</dfn></li>
@@ -26096,24 +26100,101 @@ document.body.appendChild(wbr);</code></pre>
2609626100
data-x="concept-request-destination">destination</span> is the empty string, and whose
2609726101
<span>synchronous flag</span> and <span>use-URL-credentials flag</span> are set.</p></li>
2609826102

26099-
<!--FETCH--><li><p><span>Handle as a download</span> the result of <span
26100-
data-x="concept-fetch">fetching</span> <var>request</var>.</p></li>
26103+
<li><p>Let <var>response</var> be the result of <span data-x="concept-fetch">fetching</span>
26104+
<var>request</var>.</p></li>
26105+
26106+
<!--FETCH--><li><p><span>Handle as a download</span> <var>response</var> with
26107+
<var>subject</var>'s <span>node navigable</span> and null.</p></li>
2610126108
</ol>
2610226109
</li>
2610326110
</ol>
2610426111

2610526112
<p>To <dfn>handle as a download</dfn> a <span data-x="concept-response">response</span>
26106-
<var>response</var>:</p>
26113+
<var>response</var> with a <span data-x="navigable">navigable</span>
26114+
<var>navigable</var> and a <span>navigation ID</span> or null <var>navigationId</var>:</p>
2610726115

2610826116
<ol>
2610926117
<li><p>Let <var>suggestedFilename</var> be the result of <span>getting the suggested
2611026118
filename</span> for <var>response</var>.</p></li>
2611126119

26112-
<li><p>Provide the user with a way to save <var>response</var> for later use. If the user agent
26113-
needs a filename, it should use <var>suggestedFilename</var>. Report any problems downloading the
26114-
file to the user.</p></li>
26120+
<li><p>Let <var>download behavior</var> be the result of <span>WebDriver BiDi download will
26121+
begin</span> with <var>navigable</var> and a new <span>WebDriver BiDi navigation status</span>
26122+
whose <span data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
26123+
data-x="navigation-status-status">status</span> is "<code
26124+
data-x="navigation-status-pending">pending</code>", <span
26125+
data-x="navigation-status-url">url</span> is <var>response</var>'s <span
26126+
data-x="concept-response-url">URL</span>, and <span
26127+
data-x="navigation-status-suggested-filename">suggestedFilename</span> is
26128+
<var>suggestedFilename</var>.</p></li>
26129+
26130+
<li>
26131+
<p>If <var>download behavior</var> is not null and <var>download behavior</var>'s
26132+
<span data-x="download-behavior-struct-allowed">allowed</span> is false:</p>
26133+
26134+
<ol>
26135+
<li><p>Invoke <span>WebDriver BiDi download end</span> with <var>navigable</var> and a new
26136+
<span>WebDriver BiDi navigation status</span> whose <span
26137+
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
26138+
data-x="navigation-status-status">status</span> is "<code
26139+
data-x="navigation-status-canceled">canceled</code>", <span
26140+
data-x="navigation-status-url">url</span> is <var>response</var>'s <span
26141+
data-x="concept-response-url">URL</span>.</p></li>
26142+
26143+
<li><p>Return.</p></li>
26144+
</ol>
26145+
</li>
26146+
26147+
<li><p>If <var>download behavior</var> is not null, let <var>destinationFolder</var> be
26148+
<var>download behavior</var>'s <span
26149+
data-x="download-behavior-struct-destination-folder">destinationFolder</span>.</p></li>
2611526150

26116-
<li><p>Return <var>suggestedFilename</var>.</p></li>
26151+
<li>
26152+
<p>Run these steps <span>in parallel</span>:</p>
26153+
26154+
<ol>
26155+
<li><p>Run <span>implementation-defined</span> steps to save <var>response</var> for later use.
26156+
If <var>destinationFolder</var> is not null, the user agent should save the file to that path.
26157+
If the user agent needs a filename, the user agent should use the
26158+
<var>suggestedFilename</var>.</p></li>
26159+
26160+
<li>
26161+
<p>If any of the following are true:</p>
26162+
26163+
<ul class="brief">
26164+
<li><p>the download is canceled by the user;</p></li>
26165+
26166+
<li><p>the download is canceled by the user agent;</p></li>
26167+
26168+
<li><p>an error occurs (for example, a network error, not enough storage, an unavailable
26169+
destination folder);</p></li>
26170+
</ul>
26171+
26172+
<p>then:</p>
26173+
26174+
<ol>
26175+
<li><p>Invoke <span>WebDriver BiDi download end</span> with <var>navigable</var> and a new
26176+
<span>WebDriver BiDi navigation status</span> whose <span
26177+
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
26178+
data-x="navigation-status-status">status</span> is "<code
26179+
data-x="navigation-status-canceled">canceled</code>", <span
26180+
data-x="navigation-status-url">url</span> is <var>response</var>'s <span
26181+
data-x="concept-response-url">URL</span>.</p></li>
26182+
26183+
<li><p>Return.</p></li>
26184+
</ol>
26185+
</li>
26186+
26187+
<li><p>When the download completes successfully, invoke <span>WebDriver BiDi download
26188+
end</span> with <var>navigable</var> and a new <span>WebDriver BiDi navigation status</span>
26189+
whose <span data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
26190+
data-x="navigation-status-status">status</span> is "<code
26191+
data-x="navigation-status-complete">complete</code>", <span
26192+
data-x="navigation-status-downloaded-filepath">downloadedFilepath</span> is an absolute path
26193+
of the downloaded file if available, otherwise null, <span
26194+
data-x="navigation-status-url">url</span> is <var>response</var>'s <span
26195+
data-x="concept-response-url">URL</span>.</p></li>
26196+
</ol>
26197+
</li>
2611726198
</ol>
2611826199

2611926200
<p>To <dfn data-x="getting the suggested filename">get the suggested filename</dfn> for a <span
@@ -104445,20 +104526,9 @@ location.href = '#foo';</code></pre>
104445104526
<var>uaAllowsDownloading</var> are true, then:</p>
104446104527

104447104528
<ol>
104448-
<li><p>Let <var>suggestedFilename</var> be the result of <span data-x="handle as a
104449-
download">handling as a download</span> <var>navigationParams</var>'s <span
104450-
data-x="navigation-params-response">response</span>.</p></li>
104451-
104452-
<li><p>Invoke <span>WebDriver BiDi download started</span> with <var>navigable</var> and a
104453-
new <span>WebDriver BiDi navigation status</span> whose <span
104454-
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
104455-
data-x="navigation-status-status">status</span> is "<code
104456-
data-x="navigation-status-complete">complete</code>", <span
104457-
data-x="navigation-status-url">url</span> is <var>navigationParams</var>'s <span
104458-
data-x="navigation-params-response">response</span>'s <span
104459-
data-x="concept-response-url">URL</span>, and <span
104460-
data-x="navigation-status-suggested-filename">suggestedFilename</span> is
104461-
<var>suggestedFilename</var>.</p></li>
104529+
<li><p><span data-x="handle as a download">Handle as a download</span>
104530+
<var>navigationParams</var>'s <span data-x="navigation-params-response">response</span>
104531+
with <var>navigable</var> and <var>navigationId</var>.</p></li>
104462104532
</ol>
104463104533
</li>
104464104534
</ol>

0 commit comments

Comments
 (0)
0