summaryrefslogtreecommitdiffstats
path: root/toolkit/components/downloads/test/unit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/components/downloads/test/unit
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/downloads/test/unit')
-rw-r--r--toolkit/components/downloads/test/unit/common_test_Download.js35
-rw-r--r--toolkit/components/downloads/test/unit/head.js10
-rw-r--r--toolkit/components/downloads/test/unit/test_DownloadHistory.js2
-rw-r--r--toolkit/components/downloads/test/unit/test_DownloadLegacy.js2
-rw-r--r--toolkit/components/downloads/test/unit/test_DownloadList.js4
-rw-r--r--toolkit/components/downloads/test/unit/test_Download_noext_win.js2
6 files changed, 24 insertions, 31 deletions
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);