Open Bug 1381031 Opened 8 years ago Updated 2 years ago

downloadItem.exists does not change from true to false when a file is removed

Categories

(WebExtensions :: General, defect, P5)

54 Branch
defect

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

Details

Attachments

(1 file)

Attached file dowloads-exists.zip
STR: 1. Download attached extension. 2. Visit about:debugging, load extension. 3. Click on extension button. 4. Open the global console (or inspect the devtools of the extension's background page). Expected: - The extension downloads a file from example.com, waits until the download finishes and removes the file. Then it queries the DownloadItem information, and shows whether the API claims that the file exists. - The console should show (the following expectation is from Chrome 59): downloads.download callback with ID: 1 Download finished, going to remove downloaded file with ID 1 downloads.onChanged delta.exists = Object {current: false, previous: true} downloads.removeFile done undefined PASS: Downloaded file exists=false Actual (Firefox Developer edition v55.0b8, but same behavior is also seen in Firefox Nightly): downloads.download callback with ID: 1 downloads.onChanged delta.exists = Object { previous: false, current: true } Download finished, going to remove downloaded file with ID 1 downloads.removeFile done null FAIL: Downloaded file exists=true Notes: - The relevant part of the test is after the "Download finished, going to remove" message. - Firefox fires downloads.onChanged with a delta for "exists" from "false" to "true" when the download is created. Chrome does not. Either behavior is acceptable and NOT THE SUBJECT OF THIS BUG REPORT. - Firefox does NOT fire the downloads.onChanged event when the file is removed. - When downloads.search is used, the returned DownloadItem always has exists=true, even when the actual file has been removed.
Priority: -- → P5
My few cents about: downloads.DownloadItem - does not update the "exists" property -------------- A boolean indicating whether a downloaded file still exists (true) or not (false). This information might be out-of-date, as browsers do not automatically watch for file removal — to check whether a file exists, call the downloads.search() method, filtering for the file in question. https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/downloads/DownloadItem -------------- 1. download file 2. remove file from system 3. call "chrome.downloads.search" or "chrome.downloads.open" 4. DownloadItem.exists = true!
Product: Toolkit → WebExtensions
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: