Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16637 from nullaus/bug952695
Browse files Browse the repository at this point in the history
bug 952695
  • Loading branch information
nullaus committed Feb 26, 2014
2 parents 88f2359 + 16e4f12 commit 4d2d6f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/system/js/download/download_manager.js
Expand Up @@ -24,6 +24,12 @@ var DownloadManager = (function() {
var notifications = {};
var started = false;

// Clear all previously completed downloads from the Downloads API
// We don't need those in there anymore since we're tracking everything
// in our own datastore (see download_store.js).
mozDownloadManager.clearAllDone();

// Set our download start handler.
mozDownloadManager.ondownloadstart = function onDownloadStart(ev) {
if (started) {
createDownloadNotification(ev.download);
Expand Down
16 changes: 16 additions & 0 deletions apps/system/test/unit/mock_navigator_moz_download_manager.js
Expand Up @@ -4,7 +4,23 @@
var realMozDownloadManager = navigator.mozDownloadManager;

navigator.mozDownloadManager = {
// Should always be an array of DOM Download like objects.
mDownloads: [],

mSuiteTeardown: function mdm_mSuiteTeardown() {
window.navigator.mozDownloadManager = realMozDownloadManager;
},

clearAllDone: function() {
this.mDownloads = this.mDownloads.filter(function(download) {
if (download.state === 'succeeded' || download.state === 'finalized') {
return false;
}
return true;
});
},

getDownloads: function() {
return this.mDownloads;
}
};

0 comments on commit 4d2d6f8

Please sign in to comment.