Skip to content

[WebDriver BiDi] report download complete / failed / canceled #11289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 67 additions & 18 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -25785,17 +25785,77 @@ document.body.appendChild(wbr);</code></pre>
</ol>

<p>To <dfn>handle as a download</dfn> a <span data-x="concept-response">response</span>
<var>response</var>:</p>
<var>response</var> with an optional <span data-x="navigable">navigable</span>-or-null
<var>navigable</var> (default null) and an optional <span>navigation ID</span>-or-null
<var>navigationId</var> (default null):</p>

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

<li><p>Provide the user with a way to save <var>response</var> for later use. If the user agent
needs a filename, it should use <var>suggestedFilename</var>. Report any problems downloading the
file to the user.</p></li>
needs a filename, it should use <var>suggestedFilename</var>.</p></li>

<li><p>Return <var>suggestedFilename</var>.</p></li>
<li><p>If <var>navigable</var> is not null and <var>navigationId</var> is not null, then invoke
<span>WebDriver BiDi download started</span> with <var>navigable</var> and a
new <span>WebDriver BiDi navigation status</span> whose <span
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
data-x="navigation-status-status">status</span> is "<code
data-x="navigation-status-complete">complete</code>", <span
data-x="navigation-status-url">url</span> is <var>response</var>'s <span
data-x="concept-response-url">URL</span>, and <span
data-x="navigation-status-suggested-filename">suggestedFilename</span> is
<var>suggestedFilename</var>.</p></li>

<li>
<p>If the file downloading was canceled by user or by the user agent, then:</p>

<ol>
<li><p>If <var>navigable</var> is not null and <var>navigationId</var> is not null, then
invoke <span>WebDriver BiDi download finished</span> with <var>navigable</var> and a new
<span>WebDriver BiDi navigation status</span> whose <span
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
data-x="navigation-status-status">status</span> is "<code
data-x="navigation-status-canceled">canceled</code>", <span
data-x="navigation-status-details">details</span> is <span>implementation-defined</span>
string, <span data-x="navigation-status-url">url</span> is <var>response</var>'s <span
data-x="concept-response-url">URL</span>.</p></li>
</ol>
</li>

<li>
<p>If the file downloading faced any problems, then:</p>

<ol>
<li><p>If <var>navigable</var> is not null and <var>navigationId</var> is not null, then
invoke <span>WebDriver BiDi download finished</span> with <var>navigable</var> and a new
<span>WebDriver BiDi navigation status</span> whose <span
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
data-x="navigation-status-status">status</span> is "<code
data-x="navigation-status-failed">failed</code>", <span
data-x="navigation-status-details">details</span> is <span>implementation-defined</span>
string describing the problem, <span data-x="navigation-status-url">url</span> is
<var>response</var>'s <span data-x="concept-response-url">URL</span>.</p></li>

<li><p>Report the problem to the user.</p></li>
</ol>
</li>

<li>
<p>When the file downloading successfully completed:</p>

<ol>
<li><p>If <var>navigable</var> is not null and <var>navigationId</var> is not null, then
invoke <span>WebDriver BiDi download finished</span> with <var>navigable</var> and a new
<span>WebDriver BiDi navigation status</span> whose <span
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
data-x="navigation-status-status">status</span> is "<code
data-x="navigation-status-completed">completed</code>", <span
data-x="navigation-status-details">details</span> is null, <span
data-x="navigation-status-url">url</span> is <var>response</var>'s <span
data-x="concept-response-url">URL</span>.</p></li>
</ol>
</li>
</ol>

<p>To <dfn data-x="getting the suggested filename">get the suggested filename</dfn> for a <span
Expand Down Expand Up @@ -103384,20 +103444,9 @@ location.href = '#foo';</code></pre>
<var>uaAllowsDownloading</var> are true, then:</p>

<ol>
<li><p>Let <var>suggestedFilename</var> be the result of <span data-x="handle as a
download">handling as a download</span> <var>navigationParams</var>'s <span
data-x="navigation-params-response">response</span>.</p></li>

<li><p>Invoke <span>WebDriver BiDi download started</span> with <var>navigable</var> and a
new <span>WebDriver BiDi navigation status</span> whose <span
data-x="navigation-status-id">id</span> is <var>navigationId</var>, <span
data-x="navigation-status-status">status</span> is "<code
data-x="navigation-status-complete">complete</code>", <span
data-x="navigation-status-url">url</span> is <var>navigationParams</var>'s <span
data-x="navigation-params-response">response</span>'s <span
data-x="concept-response-url">URL</span>, and <span
data-x="navigation-status-suggested-filename">suggestedFilename</span> is
<var>suggestedFilename</var>.</p></li>
<li><p><span data-x="handle as a download">Handle as a download</span>
<var>navigationParams</var>'s <span data-x="navigation-params-response">response</span>
with <var>navigable</var> and <var>navigationId</var>.</p></li>
</ol>
</li>
</ol>
Expand Down
Loading