Closed
Bug 1503760
Opened 6 years ago
Closed 6 years ago
browser.downloads.search doesn't return 0 byte downloads
Categories
(WebExtensions :: General, defect, P5)
Tracking
(firefox65 verified, firefox66 verified)
VERIFIED
FIXED
mozilla65
People
(Reporter: jwensley2, Assigned: ben.armstrong22, Mentored)
References
Details
(Keywords: good-first-bug)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 Steps to reproduce: I generated a 0 byte file using the following code <?php header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="test.bin"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . 0); die; And then tried to query for the download using browser.downloads.search({}) Actual results: No results were returned Expected results: The download should have been returned
Comment 1•6 years ago
|
||
Does this actually get created on the filesystem and is it shown in the download section of the library?
Flags: needinfo?(jwensley2)
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to David Durst [:ddurst] (Regression Engineering Owner for 63) from comment #1) > Does this actually get created on the filesystem and is it shown in the > download section of the library? Yes, the files are created on the filesystem and they show up in the library.
Flags: needinfo?(jwensley2)
Comment 3•6 years ago
|
||
The issue is here: https://searchfox.org/mozilla-central/rev/007b66c1f5f7a1b9a900a2038652a16a020f010c/toolkit/components/extensions/parent/ext-downloads.js#269 If the totalBytesGreater query property isn't specified we default to 0 which means search() only returns those with a size > 0. Changing the default there to -1 should fix this. It could also use a test.
Comment 4•6 years ago
|
||
If this is your first contribution, please see https://wiki.mozilla.org/WebExtensions/Contribution_Onramp for information on getting started.
Assignee | ||
Comment 5•6 years ago
|
||
Hi, I'll be taking a look at trying to fix this, thanks.
Comment 6•6 years ago
|
||
Welcome, Ben! If you need any help, please needinfo :aswan, the bug mentor. Happy bug fixing!
Assignee: nobody → ben.armstrong22
Updated•6 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 7•6 years ago
|
||
Hi Andrew, To test this where do I execute the code Joseph Wensley provided to reproduce? Thanks!
Flags: needinfo?(aswan)
Comment 8•6 years ago
|
||
I don't think you need to use his specific code, just making a 0 byte file available via http (either by putting it on the filesystem where an http server can read it or by writing your own handler for your web server framework of choice) is fine.
Flags: needinfo?(aswan)
Assignee | ||
Comment 9•6 years ago
|
||
Updated the totalBytesGreater property in browser.downloads.search({}) to default to -1 so files with a byte size of 0 will be returned.
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Comment 10•6 years ago
|
||
Pushed by apavel@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e990a032ac3c Changed browser.downloads.search({}) to return 0 byte downloads. r=aswan
Keywords: checkin-needed
Comment 11•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e990a032ac3c
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Comment 12•5 years ago
|
||
I was able to reproduce this issue on Firefox 63.0.3(20181114214635) under Win 7 64-bit and Mac OS X 10.13.6. This issue is verified as fixed on Firefox 66.0a1(20181211093801) and 65.0b3(20181210164452) under Win 7 64-bit and Mac OS X 10.13.6. I used: https://github.com/mdn/webextensions-examples/tree/ec731d4ceee1df0ccdebd87ab9f95875f55eeee7/latest-download and Xampp for testing. Please see the attached screenshots.
You need to log in
before you can comment on or make changes to this bug.
Description
•