From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- toolkit/components/downloads/DownloadCore.sys.mjs | 4 +-- .../components/downloads/DownloadHistory.sys.mjs | 4 +-- .../downloads/DownloadIntegration.sys.mjs | 2 +- .../components/downloads/DownloadLegacy.sys.mjs | 14 ++------- toolkit/components/downloads/DownloadList.sys.mjs | 2 +- .../downloads/test/unit/common_test_Download.js | 35 ++++++++++------------ toolkit/components/downloads/test/unit/head.js | 10 ++----- .../downloads/test/unit/test_DownloadHistory.js | 2 +- .../downloads/test/unit/test_DownloadLegacy.js | 2 ++ .../downloads/test/unit/test_DownloadList.js | 4 +-- .../downloads/test/unit/test_Download_noext_win.js | 2 +- 11 files changed, 32 insertions(+), 49 deletions(-) (limited to 'toolkit/components/downloads') diff --git a/toolkit/components/downloads/DownloadCore.sys.mjs b/toolkit/components/downloads/DownloadCore.sys.mjs index 1711a01784..62adf072f4 100644 --- a/toolkit/components/downloads/DownloadCore.sys.mjs +++ b/toolkit/components/downloads/DownloadCore.sys.mjs @@ -2027,7 +2027,7 @@ DownloadSaver.prototype = { * @resolves When the download has finished successfully. * @rejects JavaScript exception if the download failed. */ - async execute(aSetProgressBytesFn, aSetPropertiesFn) { + async execute() { throw new Error("Not implemented."); }, @@ -2052,7 +2052,7 @@ DownloadSaver.prototype = { * @resolves When the operation has finished successfully. * @rejects Never. */ - async removeData(canRemoveFinalTarget) {}, + async removeData() {}, /** * This can be called by the saver implementation when the download is already diff --git a/toolkit/components/downloads/DownloadHistory.sys.mjs b/toolkit/components/downloads/DownloadHistory.sys.mjs index 0077601d84..2ac1de45dc 100644 --- a/toolkit/components/downloads/DownloadHistory.sys.mjs +++ b/toolkit/components/downloads/DownloadHistory.sys.mjs @@ -728,7 +728,7 @@ class DownloadHistoryList extends DownloadList { } // nsINavHistoryResultObserver - containerStateChanged(node, oldState, newState) { + containerStateChanged(node) { this.invalidateContainer(node); } @@ -766,7 +766,7 @@ class DownloadHistoryList extends DownloadList { } // nsINavHistoryResultObserver - nodeRemoved(parent, placesNode, aOldIndex) { + nodeRemoved(parent, placesNode) { let slotsForUrl = this._slotsForUrl.get(placesNode.uri); for (let slot of slotsForUrl) { if (slot.sessionDownload) { diff --git a/toolkit/components/downloads/DownloadIntegration.sys.mjs b/toolkit/components/downloads/DownloadIntegration.sys.mjs index 5762f95cc2..8aed081df1 100644 --- a/toolkit/components/downloads/DownloadIntegration.sys.mjs +++ b/toolkit/components/downloads/DownloadIntegration.sys.mjs @@ -599,7 +599,7 @@ export var DownloadIntegration = { * @param [optional] aExtension * The file extension, which can match instead of the MIME type. */ - shouldViewDownloadInternally(aMimeType, aExtension) { + shouldViewDownloadInternally() { // Refuse all files by default, this is meant to be replaced with a check // for specific types via Integration.downloads.register(). return false; diff --git a/toolkit/components/downloads/DownloadLegacy.sys.mjs b/toolkit/components/downloads/DownloadLegacy.sys.mjs index ae38b0d26c..1cf05c5512 100644 --- a/toolkit/components/downloads/DownloadLegacy.sys.mjs +++ b/toolkit/components/downloads/DownloadLegacy.sys.mjs @@ -166,12 +166,7 @@ DownloadLegacyTransfer.prototype = { onLocationChange() {}, // nsIWebProgressListener - onStatusChange: function DLT_onStatusChange( - aWebProgress, - aRequest, - aStatus, - aMessage - ) { + onStatusChange: function DLT_onStatusChange(aWebProgress, aRequest, aStatus) { // The status change may optionally be received in addition to the state // change, but if no network request actually started, it is possible that // we only receive a status change with an error status code. @@ -243,12 +238,7 @@ DownloadLegacyTransfer.prototype = { _delayedMaxTotalProgress: 0, // nsIWebProgressListener2 - onRefreshAttempted: function DLT_onRefreshAttempted( - aWebProgress, - aRefreshURI, - aMillis, - aSameURI - ) { + onRefreshAttempted: function DLT_onRefreshAttempted() { // Indicate that refreshes and redirects are allowed by default. However, // note that download components don't usually call this method at all. return true; diff --git a/toolkit/components/downloads/DownloadList.sys.mjs b/toolkit/components/downloads/DownloadList.sys.mjs index 46f917d16b..b042ca20e9 100644 --- a/toolkit/components/downloads/DownloadList.sys.mjs +++ b/toolkit/components/downloads/DownloadList.sys.mjs @@ -653,7 +653,7 @@ export class DownloadSummary { } // DownloadList callback - onDownloadChanged(download) { + onDownloadChanged() { this._onListChanged(); } diff --git a/toolkit/components/downloads/test/unit/common_test_Download.js b/toolkit/components/downloads/test/unit/common_test_Download.js index 1360271686..c824030c56 100644 --- a/toolkit/components/downloads/test/unit/common_test_Download.js +++ b/toolkit/components/downloads/test/unit/common_test_Download.js @@ -85,7 +85,7 @@ async function expectNonZeroDownloadTargetSize(downloadTarget) { */ function waitForFileLaunched() { return new Promise(resolve => { - let waitFn = base => ({ + let waitFn = () => ({ launchFile(file, mimeInfo) { Integration.downloads.unregister(waitFn); if ( @@ -109,7 +109,7 @@ function waitForFileLaunched() { */ function waitForDirectoryShown() { return new Promise(resolve => { - let waitFn = base => ({ + let waitFn = () => ({ showContainingDirectory(path) { Integration.downloads.unregister(waitFn); resolve(path); @@ -716,7 +716,7 @@ add_task(async function test_empty_noprogress() { aResponse.setHeader("Content-Type", "text/plain", false); deferRequestReceived.resolve(); }, - function secondPart(aRequest, aResponse) {} + function secondPart() {} ); // Start the download, without allowing the request to finish. @@ -1892,7 +1892,7 @@ add_task(async function test_cancel_midway_restart_with_content_encoding() { * Download with parental controls enabled. */ add_task(async function test_blocked_parental_controls() { - let blockFn = base => ({ + let blockFn = () => ({ shouldBlockForParentalControls: () => Promise.resolve(true), }); @@ -2001,7 +2001,7 @@ add_task(async function test_blocked_applicationReputation() { add_task(async function test_blocked_applicationReputation_race() { let isFirstShouldBlockCall = true; - let blockFn = base => ({ + let blockFn = () => ({ shouldBlockForReputationCheck(download) { if (isFirstShouldBlockCall) { isFirstShouldBlockCall = false; @@ -2680,23 +2680,20 @@ add_task(async function test_partitionKey() { Services.prefs.setBoolPref("privacy.partition.network_state", true); function promiseVerifyDownloadChannel(url, partitionKey) { - return TestUtils.topicObserved( - "http-on-modify-request", - (subject, data) => { - let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); - if (httpChannel.URI.spec != url) { - return false; - } + return TestUtils.topicObserved("http-on-modify-request", subject => { + let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); + if (httpChannel.URI.spec != url) { + return false; + } - let reqLoadInfo = httpChannel.loadInfo; - let cookieJarSettings = reqLoadInfo.cookieJarSettings; + let reqLoadInfo = httpChannel.loadInfo; + let cookieJarSettings = reqLoadInfo.cookieJarSettings; - // Check the partitionKey of the cookieJarSettings. - Assert.equal(cookieJarSettings.partitionKey, partitionKey); + // Check the partitionKey of the cookieJarSettings. + Assert.equal(cookieJarSettings.partitionKey, partitionKey); - return true; - } - ); + return true; + }); } let test_url = httpUrl("source.txt"); diff --git a/toolkit/components/downloads/test/unit/head.js b/toolkit/components/downloads/test/unit/head.js index 19d85b6f7c..a67f600ec7 100644 --- a/toolkit/components/downloads/test/unit/head.js +++ b/toolkit/components/downloads/test/unit/head.js @@ -718,7 +718,7 @@ async function promiseBlockedDownload({ useLegacySaver, verdict = Downloads.Error.BLOCK_VERDICT_UNCOMMON, } = {}) { - let blockFn = base => ({ + let blockFn = () => ({ shouldBlockForReputationCheck: () => Promise.resolve({ shouldBlock: true, @@ -1159,13 +1159,7 @@ add_setup(function test_common_initialize() { // saved to disk without asking for a destination interactively. let mock = { QueryInterface: ChromeUtils.generateQI(["nsIHelperAppLauncherDialog"]), - promptForSaveToFileAsync( - aLauncher, - aWindowContext, - aDefaultFileName, - aSuggestedFileExtension, - aForcePrompt - ) { + promptForSaveToFileAsync(aLauncher) { // The dialog should create the empty placeholder file. let file = getTempFile(TEST_TARGET_FILE_NAME); file.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); diff --git a/toolkit/components/downloads/test/unit/test_DownloadHistory.js b/toolkit/components/downloads/test/unit/test_DownloadHistory.js index 69eb1c4728..7bcf097062 100644 --- a/toolkit/components/downloads/test/unit/test_DownloadHistory.js +++ b/toolkit/components/downloads/test/unit/test_DownloadHistory.js @@ -44,7 +44,7 @@ class TestView { } this.checkForExpectedDownloads(); } - onDownloadChanged(download) { + onDownloadChanged() { this.checkForExpectedDownloads(); } onDownloadRemoved(download) { diff --git a/toolkit/components/downloads/test/unit/test_DownloadLegacy.js b/toolkit/components/downloads/test/unit/test_DownloadLegacy.js index 972820f29e..839611ec22 100644 --- a/toolkit/components/downloads/test/unit/test_DownloadLegacy.js +++ b/toolkit/components/downloads/test/unit/test_DownloadLegacy.js @@ -11,6 +11,8 @@ // Execution of common tests +Services.prefs.setBoolPref("dom.block_download_insecure", false); + // This is used in common_test_Download.js // eslint-disable-next-line no-unused-vars var gUseLegacySaver = true; diff --git a/toolkit/components/downloads/test/unit/test_DownloadList.js b/toolkit/components/downloads/test/unit/test_DownloadList.js index f7d03900af..7045824c9c 100644 --- a/toolkit/components/downloads/test/unit/test_DownloadList.js +++ b/toolkit/components/downloads/test/unit/test_DownloadList.js @@ -322,7 +322,7 @@ add_task(async function test_history_expiration() { let deferred = Promise.withResolvers(); let removeNotifications = 0; let downloadView = { - onDownloadRemoved(aDownload) { + onDownloadRemoved() { if (++removeNotifications == 2) { deferred.resolve(); } @@ -369,7 +369,7 @@ add_task(async function test_history_clear() { let deferred = Promise.withResolvers(); let removeNotifications = 0; let downloadView = { - onDownloadRemoved(aDownload) { + onDownloadRemoved() { if (++removeNotifications == 2) { deferred.resolve(); } diff --git a/toolkit/components/downloads/test/unit/test_Download_noext_win.js b/toolkit/components/downloads/test/unit/test_Download_noext_win.js index 0e226229f6..b0e1466b52 100644 --- a/toolkit/components/downloads/test/unit/test_Download_noext_win.js +++ b/toolkit/components/downloads/test/unit/test_Download_noext_win.js @@ -47,7 +47,7 @@ add_task(async function () { */ function waitForDirectoryShown() { return new Promise(resolve => { - let waitFn = base => ({ + let waitFn = () => ({ showContainingDirectory(path) { Integration.downloads.unregister(waitFn); resolve(path); -- cgit v1.2.3