download attribute HTMLAnchorElement not used for file name download
Categories
(Core :: DOM: File, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox-esr78 | --- | unaffected |
firefox79 | --- | unaffected |
firefox80 | --- | unaffected |
firefox81 | --- | wontfix |
firefox82 | --- | fixed |
People
(Reporter: github.christian, Assigned: evilpie)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Steps to reproduce:
I try to save a text string in a txt file, using window.URL.createObjectURL , then passing the ObjectURL to an HTMLAnchorElement with the attribute download set to the desired file name ( see the attached index.html file )
Actual results:
With Firefox 79 everything is fine.
With Nightly 81.0a1 (2020-08-22) (64 bits), the code works also but the file name is '[object Object]'
Expected results:
The file name must be the name set in the download attribute of the HTMLAnchorElement.
Comment 1•4 years ago
|
||
Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=1cd6d2f9a603ad02a533b12c4602612e90f7da5a&tochange=5409c44e043f20344715ddb289316fc04f1b2bef
Comment 2•4 years ago
|
||
Baku, could you take a look at this?
Assignee | ||
Comment 3•4 years ago
|
||
I guess the filename specified by the download
attribute should be preferred over File.name
? We get this funny behavior because new File ( [ 'This is a sample of text file' ], { type : 'text/plain' } )
in the tescase is basically wrong. The second argument should be the filename.
Reporter | ||
Comment 4•4 years ago
|
||
Yes, I agree. The filename is missing in the parameters of the File constructor and when I add it, everything is fine.
But the filename is missing in my JS code since at least 3 years and this works without problems till this FF release 81. It's also working on browsers based on chrome (Brave, Vivaldi...).
I have added the filename in my JS code, so for me you can close, except, if you are expecting problems from others.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 5•4 years ago
•
|
||
I think I know a fix for this. Before https://hg.mozilla.org/integration/autoland/rev/67ea7d621ba6232179f9b8c1949ddcf03f429f33 we used to call SetContentDispositionFilename
during channel creation. But now we call it later in BlobURLInputStream::StoreBlobImplStream
, which probably overwrites the name set by nsDocShell::CreateAndConfigureRealChannelForLoadState
.
I think we could just not overwrite an existing name.
Assignee | ||
Comment 6•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/2bfe670b275d Use download attribute filename instead of File.name. r=baku
Comment 8•4 years ago
|
||
bugherder |
Description
•