[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 52/73: Bug 1778714 - Fix the pdf download link in the All Downloads view. r=Gijs, a=RyanVM
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch geckoview-102.3.0esr-12.0-1
in repository tor-browser.
commit 5407f0f027aefb483cbc52096d9e8c10775e9f53
Author: Calixte <cdenizet@xxxxxxxxxxx>
AuthorDate: Mon Aug 8 18:56:24 2022 +0000
Bug 1778714 - Fix the pdf download link in the All Downloads view. r=Gijs, a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D151431
---
.../components/downloads/content/allDownloadsView.js | 17 +++++++++++------
.../pdfjs/test/browser_pdfjs_download_button.js | 14 ++++++++++++++
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/browser/components/downloads/content/allDownloadsView.js b/browser/components/downloads/content/allDownloadsView.js
index 502faf4bb33ab..55b9f47e4637a 100644
--- a/browser/components/downloads/content/allDownloadsView.js
+++ b/browser/components/downloads/content/allDownloadsView.js
@@ -125,7 +125,9 @@ HistoryDownloadElementShell.prototype = {
let displayName = DownloadsViewUI.getDisplayName(this.download);
return (
displayName.toLowerCase().includes(aTerm) ||
- this.download.source.url.toLowerCase().includes(aTerm)
+ (this.download.source.originalUrl || this.download.source.url)
+ .toLowerCase()
+ .includes(aTerm)
);
},
@@ -596,7 +598,10 @@ DownloadsPlacesView.prototype = {
case "cmd_copy":
return Array.prototype.some.call(
this._richlistbox.selectedItems,
- element => !!element._shell.download.source?.url
+ element => {
+ const { source } = element._shell.download;
+ return !!(source?.originalUrl || source?.url);
+ }
);
case "downloadsCmd_openReferrer":
case "downloadShowMenuItem":
@@ -616,10 +621,10 @@ DownloadsPlacesView.prototype = {
},
_copySelectedDownloadsToClipboard() {
- let urls = Array.from(
- this._richlistbox.selectedItems,
- element => element._shell.download.source?.url
- ).filter(Boolean);
+ let urls = Array.from(this._richlistbox.selectedItems, element => {
+ const { source } = element._shell.download;
+ return source?.originalUrl || source?.url;
+ }).filter(Boolean);
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)
diff --git a/toolkit/components/pdfjs/test/browser_pdfjs_download_button.js b/toolkit/components/pdfjs/test/browser_pdfjs_download_button.js
index fa6b6d6c978a9..7b7162c5d1642 100644
--- a/toolkit/components/pdfjs/test/browser_pdfjs_download_button.js
+++ b/toolkit/components/pdfjs/test/browser_pdfjs_download_button.js
@@ -109,6 +109,20 @@ add_task(async function test_downloading_pdf_nonprivate_window() {
tabCount,
"No new tab was opened to view the downloaded PDF"
);
+
+ SpecialPowers.clipboardCopyString("");
+ const downloadsLoaded = BrowserTestUtils.waitForEvent(
+ browser,
+ "InitialDownloadsLoaded",
+ true
+ );
+ BrowserTestUtils.loadURI(browser, "about:downloads");
+ await downloadsLoaded;
+
+ info("Wait for the clipboard to contain the url of the pdf");
+ await SimpleTest.promiseClipboardChange(pdfUrl, () => {
+ goDoCommand("cmd_copy");
+ });
}
);
});
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits