Closed Bug 2003840 Opened 11 months ago Closed 7 months ago

A shutdown request for the browser should cancel or pause all active downloads

Categories

(Remote Protocol :: Agent, enhancement, P2)

enhancement
Points:
2

Tracking

(firefox150 fixed)

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: whimboo, Assigned: Sasha)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [webdriver:m19][webdriver:relnote])

Attachments

(2 external files)

I noticed for the shutdown hangs on bug 1630162 that we see a modal dialog on shutdown in case there are any active downloads. As a workaround for now Julian updated the tests to wait for the browsingContext.downloadEnd events (bug 1999473).

For a proper fix we should automatically cancel or pause any active download when a shutdown is requested. Ideally it should happen for both the Marionette and BiDi implementations.

We may actually also run into this problem when we can simulate the network offline state. In that case the prompt should be shown as well:
https://searchfox.org/firefox-main/source/toolkit/components/downloads/DownloadUIHelper.sys.mjs#133-135

It will also happen for Private Browsing but that shouldn't affect us yet given that it's not possible to open such a window at least at the moment.

Points: --- → 2
Priority: -- → P2
Whiteboard: [webdriver:m19]

As it looks like the problem still persists with shutdown hangs in wdspec tests even with the workaround put in place.

This is for a recent beta simulation: https://treeherder.mozilla.org/logviewer?job_id=539536109&repo=try&lineNumber=5131-5132

[task 2025-12-11T13:06:57.422+00:00] 13:06:57     INFO - PID 5408 | 1765458417421	Marionette	TRACE	[3] Prompt opened (type: "confirmEx", text: "If you exit now, 1 download will be canceled. Are you sure you want to exit?")
[task 2025-12-11T13:07:01.042+00:00] 13:07:01     INFO - TEST-UNEXPECTED-TIMEOUT | /webdriver/tests/bidi/browsing_context/download_end/download_end.py | expected OK
Assignee: nobody → aborovova
Status: NEW → ASSIGNED
Attachment #9549758 - Attachment description: Bug 2003840 - Add a method to clean up the public downloads and add a notification when the cancel download prompt is about to open. → Bug 2003840 - Add a notification to prevent the cancel download prompt from being open.
Attachment #9549759 - Attachment description: Bug 2003840 - Cancel downloads when "before-cancel-download-prompt" notification is received. → Bug 2003840 - Skip cancel download prompt when "before-cancel-download-prompt" notification is received.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #0)

I noticed for the shutdown hangs on bug 1630162 that we see a modal dialog on shutdown in case there are any active downloads. As a workaround for now Julian updated the tests to wait for the browsingContext.downloadEnd events (bug 1999473).

For a proper fix we should automatically cancel or pause any active download when a shutdown is requested. Ideally it should happen for both the Marionette and BiDi implementations.

For multiple downloads, can it just do multiple prompting? In other words, ask you if you would like to stop downloading or continue downloading for each one. This is the best and only way to truly give users the control over each specific download which is happening.

Blocks: 2022701
Pushed by aborovova@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/2eb316af09d0 https://hg.mozilla.org/integration/autoland/rev/8096a21eb554 Add a notification to prevent the cancel download prompt from being open. r=mak https://github.com/mozilla-firefox/firefox/commit/25d069d9288e https://hg.mozilla.org/integration/autoland/rev/a8c181a689f6 Skip cancel download prompt when "before-cancel-download-prompt" notification is received. r=whimboo
Pushed by rperta@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6236d5292ba2 https://hg.mozilla.org/integration/autoland/rev/0d2520acdfe5 Revert "Bug 2003840 - Skip cancel download prompt when "before-cancel-download-prompt" notification is received. r=whimboo" for causing wr failures at delete_session.py

Backed out for causing wd failures at delete_session.py
Backout link
Push with failures
Failure log(s)

Flags: needinfo?(aborovova)

I've missed updating the path to a helper in one of the new test files after bug 2022515 has landed.
It should be fixed now.

Flags: needinfo?(aborovova)
Pushed by nfay@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/de19af4f95d3 https://hg.mozilla.org/mozilla-central/rev/81adc19b420f Revert "Bug 2003840 - Skip cancel download prompt when "before-cancel-download-prompt" notification is received. r=whimboo" for causing wr failures at delete_session.py
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch

Since the patches were reverted, the bug is not done yet.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by aborovova@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a1f324c10963 https://hg.mozilla.org/integration/autoland/rev/89604572ae6a Add a notification to prevent the cancel download prompt from being open. r=mak https://github.com/mozilla-firefox/firefox/commit/e1397358b0cb https://hg.mozilla.org/integration/autoland/rev/09c078227d01 Skip cancel download prompt when "before-cancel-download-prompt" notification is received. r=whimboo
Status: REOPENED → RESOLVED
Closed: 7 months ago → 7 months ago
Resolution: --- → FIXED

(In reply to Worcester12345 from comment #5)

For multiple downloads, can it just do multiple prompting? In other words, ask you if you would like to stop downloading or continue downloading for each one. This is the best and only way to truly give users the control over each specific download which is happening.

This would not solve the problem with shutdown. If for a single download the choice is to not cancel it, the shutdown would be aborted because the opened dialog cannot be handled. As such users wouldn't have the possibility to quit the browser at all.

Whiteboard: [webdriver:m19] → [webdriver:m19][webdriver-relnote]
Whiteboard: [webdriver:m19][webdriver-relnote] → [webdriver:m19][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: