Closed Bug 1999473 Opened 2 months ago Closed 2 months ago

[wdspec] Tests for "browsingContext.downloadWillBegin" and "browser.setDownloadBehavior" need to wait for the download to be finished

Categories

(Remote Protocol :: WebDriver BiDi, defect, P3)

defect
Points:
2

Tracking

(firefox147 fixed)

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: whimboo, Assigned: jdescottes)

References

(Blocks 2 open bugs, Regressed 1 open bug)

Details

(Whiteboard: [webdriver:m18], [wptsync upstream])

Attachments

(1 file, 1 obsolete file)

We have test timeouts like the following which are caused by a remaining active download when trying to shutdown Firefox. Here a prompt is opened and asking if the downloads should be canceled.

https://treeherder.mozilla.org/logviewer?job_id=534759574&repo=try&task=btsR6Ey3Rt-qURh708ebhw.0&lineNumber=12843-12846

[task 2025-11-07T10:46:46.515+00:00] 10:46:46     INFO - PID 6032 | 1762512406513	RemoteAgent	TRACE	PromptListener: Register prompt listeners for new "null" window
[task 2025-11-07T10:46:46.516+00:00] 10:46:46     INFO - PID 6032 | 1762512406514	RemoteAgent	TRACE	PromptListener: New prompt detected (type: "confirmEx", text: "If you exit now, 1 download will be canceled. Are you sure you want to exit?")
[task 2025-11-07T10:46:46.700+00:00] 10:46:46     INFO - PID 6032 | [Parent 6062, Main Thread] WARNING: g_object_get: assertion 'G_IS_OBJECT (object)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:201
[task 2025-11-07T10:47:13.033+00:00] 10:47:13     INFO - TEST-UNEXPECTED-TIMEOUT | /webdriver/tests/bidi/browsing_context/download_will_begin/download_will_begin.py | expected OK

Until we have a dedicated command for canceling a given download, we should figure out if there is a workaround in canceling these or finding a way to prevent this check for the time being. We could also wait for the downloadEnd event to be fired as first step.

Julian wanted to take a look at it.

Flags: needinfo?(jdescottes)

There is also set_download_behavior/user_context.py which needs to wait for the download to be finished.

Summary: [wdspec] Tests for "browsingContext.downloadWillBegin" need to wait for the download to be finished → [wdspec] Tests for "browsingContext.downloadWillBegin" and "browser.setDownloadBehavior" need to wait for the download to be finished

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

There is also set_download_behavior/user_context.py which needs to wait for the download to be finished.

I am not 100% sure this is the same issue. The trigger_download fixture seems to try to wait for download_end in the "regular" case. Maybe the 0.5s timeout is too short in some cases and we timeout before getting the event and then quickly shutdown the test? In any case here I would simply increase the timeout.

Flags: needinfo?(jdescottes)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Severity: -- → S3
Points: --- → 2
Priority: -- → P3
Whiteboard: [webdriver:m18]
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/56079 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m18] → [webdriver:m18], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Upstream PR merged by moz-wptsync-bot
Duplicate of this bug: 2003196

Julian, I see a lot of failures for this hang during shutdown on beta. We probably should consider uplifting the patch.

Flags: needinfo?(jdescottes)
Regressions: 2003243

As I said on https://bugzilla.mozilla.org/show_bug.cgi?id=1630162#c291 I don't think the patch helped that much? The failure frequency seems stable and now the tests fail while waiting for the fixture to receive a downloadEnd event. I think there's another root issue which leads to the hangs, unless we have a proper fix it doesn't seem useful to uplift?

Flags: needinfo?(jdescottes)

Ok all right that was only one failure which related to the new fixture. The other central/autoland failures seem linked to unrelated tests. We can try to uplift.

And to add... this fix is helpful so that we do not hang on an open dialog which prevents shutdown. The failure for the debug build is a timeout for waiting for the event, which is way better.

firefox-beta Uplift Approval Request

  • User impact if declined: Frequent shutdown hangs during wdspec tests
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: N/A
  • Risk associated with taking this patch: low
  • Explanation of risk level: Test only update
  • String changes made/needed: N/A
  • Is Android affected?: yes
Attachment #9530008 - Flags: approval-mozilla-beta?

Comment on attachment 9530008 [details]
Bug 1999473 - [wdspec] Wait for download_end events in bidi download tests

This missed the Fx146 beta cycle. It can ride with the 147 release. There is also an intermittent regression that should be looked at. Feel free to request a release uplift if you want it to be considered for the planned 146 dot release

Attachment #9530008 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
Attachment #9530008 - Attachment is obsolete: true

(In reply to Dianna Smith [:diannaS] from comment #15)

Comment on attachment 9530008 [details]
Bug 1999473 - [wdspec] Wait for download_end events in bidi download tests

This missed the Fx146 beta cycle. It can ride with the 147 release. There is also an intermittent regression that should be looked at. Feel free to request a release uplift if you want it to be considered for the planned 146 dot release

Oh right, this cycle is already at the end. The regression seems to be a very low intermittent failure (at least a lot less frequent than the initial intermittent this fixes), but not sure that's worth uplifting to release.

(In reply to Julian Descottes [:jdescottes] from comment #16)

Oh right, this cycle is already at the end. The regression seems to be a very low intermittent failure (at least a lot less frequent than the initial intermittent this fixes), but not sure that's worth uplifting to release.

The frequency of out tests run on beta/release is lower than on mozilla-central / autoland. So I would expect a lower volume. We can see and wait what results we get once beta is merged to release. We could request the uplift at any time if really needed, but probably not.

See Also: → 2003840
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: