"save file as" dialog does not open anymore in Firefox frontend tests
Categories
(Remote Protocol :: Agent, defect, P2)
Tracking
(firefox-esr115 unaffected, firefox-esr140 unaffected, firefox146 unaffected, firefox147 fixed, firefox148 fixed)
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox146 | --- | unaffected |
| firefox147 | --- | fixed |
| firefox148 | --- | fixed |
People
(Reporter: aryx, Assigned: jdescottes)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [webdriver:m18])
Attachments
(3 files)
Affected: Firefox 147+
The "Save file as" dialog does not open anymore in Firefox frontend tests.
Example: https://github.com/mozilla/fx-desktop-qa-automation/blob/baeea19b5c9ba890ee628cd05b6b31dfb874ca96/tests/downloads/test_download_pdf.py
Steps to reproduce the issue by Ben Chatterton:
The following steps should reproduce the issues we’re seeing in automated sessions re: downloading.
- Have Python >3.11.0 installed.
- Have Selenium 4.23.1 installed via pip.
- Have the version of Firefox under test installed and get its location in the filesystem.
- Download and run the attached script with selenium in the python env:
python wait_for_manual_download.py <location of Fx executable> - An automation window should open to the USCIS page for the I-9 form. You could change the link in the script to point to any pdf. You have 100 seconds to do any actions you like. This can be changed in the script.
- Open the devtools console if you are checking for the error message.
- Click the download button in the pdf.js frame.
- You have reproduced the bug if a Save As alert/modal does NOT appear and the file is NOT saved.
- The previous behavior was that the Save As modal appeared, and when OK was pressed, the file was downloaded, as shown by the progress icon and by inspecting the Downloads from the Panel UI.
- You can exit the script by the normal keyboard interrupts or wait for it to time out.
Comment 1•7 months ago
|
||
When I try to save a file I see the following JavaScript error in the console:
console.error: [Exception... "JavaScript component does not have a method named: "appendFilter"'JavaScript component does not have a method named: "appendFilter"' when calling method: [nsIFilePicker::appendFilter]" nsresult: "0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED)" location: "JS frame :: chrome://global/content/contentAreaUtils.js :: appendFiltersForContentType :: line 940" data: no]
I assume this is because we setup a mock file picker which landed as:
https://github.com/mozilla-firefox/firefox/commit/75ac0fc100a3#diff-cc7fa355eaeaf461512254a5fa2a9ba122864b689ac65adb382771868efeb168
Updated•7 months ago
|
Comment 2•7 months ago
•
|
||
This is also easy to reproduce:
- Start Firefox with
mach run --setpref="remote.log.level=Trace" --setpref="remote.log.truncate=false" --remote-debugging-port --remote-allow-origins=https://juliandescottes.github.io - Load https://juliandescottes.github.io/bidi-web-client/web/ in your normal browser
- Click the
Connectbutton - Click the
Sendbutton for thesession.newcommand - Try to save the open web page
Comment 3•7 months ago
|
||
Commenting out the following line fixes it for me:
https://github.com/mozilla-firefox/firefox/blob/438a3ce10eb77fb50d968463b7741117aec5bb4a/remote/shared/webdriver/Session.sys.mjs#L292
Maybe as a quick workaround we could only setup the file picker mock for BiDi, but finally we should still discuss when the mock should be used. There are still cases when the real file picker needs to be shown to users. Maybe we have to let test frameworks decide if the mock needs to be used or not by eg. providing a preference.
| Assignee | ||
Comment 4•7 months ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #3)
Commenting out the following line fixes it for me:
https://github.com/mozilla-firefox/firefox/blob/438a3ce10eb77fb50d968463b7741117aec5bb4a/remote/shared/webdriver/Session.sys.mjs#L292Maybe as a quick workaround we could only setup the file picker mock for BiDi, but finally we should still discuss when the mock should be used. There are still cases when the real file picker needs to be shown to users. Maybe we have to let test frameworks decide if the mock needs to be used or not by eg. providing a preference.
For the time being, let's both only setup the file picker for BiDi and add a preference.
Normally whether file pickers are allowed or dismissed automatically should fully be handled by the user prompt behavior, which is Bug 1999693, so this will make the preference redundant in the long run.
The other issue is that at the moment, the file picker handler intercepts any file picker, and we would only want to intercept the ones from content pages.
| Assignee | ||
Comment 5•7 months ago
|
||
Updated•7 months ago
|
Comment 8•7 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Prevents firefox frontend tests from running correctly due to automatically dismissed file pickers
- Code covered by automated testing: no
- 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: Only impacts webdriver / marionette, simple JS patch.
- String changes made/needed: N/A
- Is Android affected?: no
| Assignee | ||
Comment 9•7 months ago
|
||
Adds a new hidden preference to enable dismissing file pickers: remote.bidi.dismiss_file_pickers.enabled , defaults to false.
Dismissing file pickers is now only ever possible for sessions handling bidi commands
The FilePickerHandler.allowFilePickers is now a no-op if there was no matching call for dismissFilePickers
Original Revision: https://phabricator.services.mozilla.com/D276167
Updated•7 months ago
|
Updated•7 months ago
|
Comment 10•7 months ago
|
||
| uplift | ||
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 11•6 months ago
|
||
Created a PR for puppeteer at https://github.com/puppeteer/puppeteer/pull/14540
Previous PR for Playwright created by Holger at https://github.com/microsoft/playwright/pull/38563
| Assignee | ||
Updated•6 months ago
|
Description
•