mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
Bug 945707 - Pausing a download fails when done after a retry + follow up (see the description)
Issue #121 [follow up] Bug 92737 - Part 9: Download multiple files when multiple items are dropped on Downloads view in Library Window
This commit is contained in:
parent
e40f171756
commit
fea1a4d195
2 changed files with 16 additions and 21 deletions
|
|
@ -40,22 +40,6 @@ const DOWNLOAD_VIEW_SUPPORTED_COMMANDS =
|
||||||
|
|
||||||
const NOT_AVAILABLE = Number.MAX_VALUE;
|
const NOT_AVAILABLE = Number.MAX_VALUE;
|
||||||
|
|
||||||
/**
|
|
||||||
* Download a URL.
|
|
||||||
*
|
|
||||||
* @param aURL
|
|
||||||
* the url to download (nsIURI object)
|
|
||||||
* @param [optional] aFileName
|
|
||||||
* the destination file name
|
|
||||||
*/
|
|
||||||
function DownloadURL(aURL, aFileName) {
|
|
||||||
// For private browsing, try to get document out of the most recent browser
|
|
||||||
// window, or provide our own if there's no browser window.
|
|
||||||
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
|
||||||
let initiatingDoc = browserWin ? browserWin.document : document;
|
|
||||||
saveURL(aURL, aFileName, null, true, true, undefined, initiatingDoc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A download element shell is responsible for handling the commands and the
|
* A download element shell is responsible for handling the commands and the
|
||||||
* displayed data for a single download view element. The download element
|
* displayed data for a single download view element. The download element
|
||||||
|
|
@ -654,7 +638,10 @@ DownloadElementShell.prototype = {
|
||||||
// In future we may try to download into the same original target uri, when
|
// In future we may try to download into the same original target uri, when
|
||||||
// we have it. Though that requires verifying the path is still valid and
|
// we have it. Though that requires verifying the path is still valid and
|
||||||
// may surprise the user if he wants to be requested every time.
|
// may surprise the user if he wants to be requested every time.
|
||||||
DownloadURL(this.downloadURI, this.getDownloadMetaData().fileName);
|
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||||
|
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||||
|
DownloadURL(this.downloadURI, this.getDownloadMetaData().fileName,
|
||||||
|
initiatingDoc);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* nsIController */
|
/* nsIController */
|
||||||
|
|
@ -1450,7 +1437,9 @@ DownloadsPlacesView.prototype = {
|
||||||
|
|
||||||
_downloadURLFromClipboard: function DPV__downloadURLFromClipboard() {
|
_downloadURLFromClipboard: function DPV__downloadURLFromClipboard() {
|
||||||
let [url, name] = this._getURLFromClipboardData();
|
let [url, name] = this._getURLFromClipboardData();
|
||||||
DownloadURL(url, name);
|
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||||
|
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||||
|
DownloadURL(url, name, initiatingDoc);
|
||||||
},
|
},
|
||||||
|
|
||||||
doCommand: function DPV_doCommand(aCommand) {
|
doCommand: function DPV_doCommand(aCommand) {
|
||||||
|
|
@ -1504,6 +1493,11 @@ DownloadsPlacesView.prototype = {
|
||||||
else
|
else
|
||||||
contextMenu.removeAttribute("state");
|
contextMenu.removeAttribute("state");
|
||||||
|
|
||||||
|
if (state == nsIDM.DOWNLOAD_DOWNLOADING) {
|
||||||
|
// The resumable property of a download may change at any time, so
|
||||||
|
// ensure we update the related command now.
|
||||||
|
goUpdateCommand("downloadsCmd_pauseResume");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1597,10 +1591,12 @@ DownloadsPlacesView.prototype = {
|
||||||
let links = Services.droppedLinkHandler.dropLinks(aEvent);
|
let links = Services.droppedLinkHandler.dropLinks(aEvent);
|
||||||
if (!links.length)
|
if (!links.length)
|
||||||
return;
|
return;
|
||||||
|
let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
||||||
|
let initiatingDoc = browserWin ? browserWin.document : document;
|
||||||
for (let link of links) {
|
for (let link of links) {
|
||||||
if (link.url.startsWith("about:"))
|
if (link.url.startsWith("about:"))
|
||||||
continue;
|
continue;
|
||||||
DownloadURL(link.url, link.name);
|
DownloadURL(link.url, link.name, initiatingDoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -507,8 +507,7 @@ const DownloadsPanel = {
|
||||||
|
|
||||||
let uri = NetUtil.newURI(url);
|
let uri = NetUtil.newURI(url);
|
||||||
DownloadsCommon.log("Pasted URL seems valid. Starting download.");
|
DownloadsCommon.log("Pasted URL seems valid. Starting download.");
|
||||||
saveURL(uri.spec, name || uri.spec, null, true, true,
|
DownloadURL(uri.spec, name, document);
|
||||||
undefined, document);
|
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue