Closed Bug 536225 Opened 15 years ago Closed 15 years ago

[shared module] Need a way to cancel all active downloads (DownloadsAPI)

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: u279076, Assigned: u279076)

References

Details

(Whiteboard: [mozmill-doc-complete])

Attachments

(2 files)

In the DownloadsAPI, we do not have a way to cancel active downloads.  cleanUp() only acts on inactive downloads and deleteDownloadedFiles() only acts on files.
Currently, there is no method for canceling a download.  This should be integrated into our cleanUp() process as just doing delete and cleanup in teardownModule will result in a single active download remaining.

Naturally, I have a fix for this.  I'll post a minimized test case and a patch shortly.
Attached file Minimized test case
Here is a "minimized" test case.  I say that in quotes because it includes a few methods copied from the DownloadsAPI.  This way you can just copy and paste into the Mozmill IDE and run it (no importing of modules necessary).

I left out dm.close() from this test so you can see the state of the Download Manager prior to closing.  As you can see, the download is still active because it was never canceled, and active downloads are not taken care of with dm.cleanUp() -- clearly stated in the nsIDownloadManager API: https://developer.mozilla.org/en/NsIDownloadManager#cleanUp.28.29
Attached patch Initial PatchSplinter Review
Here is the patch to add a cancelActiveDownloads() method to the DownloadsAPI.  I suggest a follow up patch to this to possibly call this method from within the dm.cleanUp() method.
Assignee: nobody → anthony.s.hughes
Status: NEW → ASSIGNED
Attachment #418701 - Flags: review?(hskupin)
A quick reminder for myself...I'll add API documentation for this method if/when the patch is checked in.
Blocks: 524827
Attachment #418701 - Flags: review?(hskupin) → review+
Comment on attachment 418701 [details] [diff] [review]
Initial Patch

Looks good so far. I will just make two little changes here. We can use Ci instead of Components.interfaces and a better variable name would be nice. Checkin upcoming.
Comment on attachment 418701 [details] [diff] [review]
Initial Patch

>+  var enum = this._dms.activeDownloads;

Oh, and enum should not be used.
Landed as:
http://hg.mozilla.org/qa/mozmill-tests/rev/35d158df548e
http://hg.mozilla.org/qa/mozmill-tests/rev/eaf4af799781
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [mozmill-doc-needed]
Docs are complete:
https://developer.mozilla.org/en/Mozmill_Tests/Shared_Modules/DownloadsAPI/downloadManager
Summary: Need a way to cancel all active downloads → [shared module] Need a way to cancel all active downloads (DownloadsAPI)
Whiteboard: [mozmill-doc-needed] → [mozmill-doc-complete]
Mass move of Mozmill Test related project bugs to newly created components. You can filter out those emails by using "Mozmill-Tests-to-MozillaQA" as criteria.
Component: Mozmill → Mozmill Tests
Product: Testing → Mozilla QA
QA Contact: mozmill → mozmill-tests
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: