diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /uriloader/exthandler | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-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 'uriloader/exthandler')
17 files changed, 48 insertions, 46 deletions
diff --git a/uriloader/exthandler/ExtHandlerService.sys.mjs b/uriloader/exthandler/ExtHandlerService.sys.mjs index aad2c0b8d9..d7f3c9b9e0 100644 --- a/uriloader/exthandler/ExtHandlerService.sys.mjs +++ b/uriloader/exthandler/ExtHandlerService.sys.mjs @@ -324,7 +324,7 @@ HandlerService.prototype = { }, // nsIObserver - observe(subject, topic, data) { + observe(subject, topic) { if (topic != "handlersvc-json-replace") { return; } @@ -726,7 +726,7 @@ HandlerService.prototype = { this._mockedProtocol = protocol; this._mockedHandler = { QueryInterface: ChromeUtils.generateQI([Ci.nsILocalHandlerApp]), - launchWithURI(uri, context) { + launchWithURI(uri) { Services.obs.notifyObservers(uri, "mocked-protocol-handler"); }, name: "Mocked handler", diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 205f73cfa1..1f77e095db 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -544,8 +544,8 @@ class nsExternalAppHandler final : public nsIStreamListener, const nsString& path); /** - * Set in HelperAppDlg.jsm. This is always null after the user has chosen an - * action. + * Set in HelperAppDlg.sys.mjs. This is always null after the user has chosen + * an action. */ nsCOMPtr<nsIWebProgressListener2> mDialogProgressListener; /** diff --git a/uriloader/exthandler/tests/mochitest/HelperAppLauncherDialog_chromeScript.js b/uriloader/exthandler/tests/mochitest/HelperAppLauncherDialog_chromeScript.js index 4f66c99dc6..13084f92d6 100644 --- a/uriloader/exthandler/tests/mochitest/HelperAppLauncherDialog_chromeScript.js +++ b/uriloader/exthandler/tests/mochitest/HelperAppLauncherDialog_chromeScript.js @@ -34,7 +34,7 @@ Services.prefs.setCharPref("browser.download.dir", tmpDir.path); const FAKE_CID = Services.uuid.generateUUID(); function HelperAppLauncherDialog() {} HelperAppLauncherDialog.prototype = { - show(aLauncher, aWindowContext, aReason) { + show(aLauncher) { if ( Services.prefs.getBoolPref( "browser.download.always_ask_before_handling_new_types" @@ -49,13 +49,7 @@ HelperAppLauncherDialog.prototype = { } aLauncher.cancel(Cr.NS_BINDING_ABORTED); }, - promptForSaveToFileAsync( - appLauncher, - parent, - filename, - extension, - forceSave - ) { + promptForSaveToFileAsync(appLauncher, parent, filename) { if ( !Services.prefs.getBoolPref( "browser.download.always_ask_before_handling_new_types" diff --git a/uriloader/exthandler/tests/mochitest/browser_auto_close_window.js b/uriloader/exthandler/tests/mochitest/browser_auto_close_window.js index af60b59c4b..f5a08b854b 100644 --- a/uriloader/exthandler/tests/mochitest/browser_auto_close_window.js +++ b/uriloader/exthandler/tests/mochitest/browser_auto_close_window.js @@ -26,7 +26,7 @@ let curDialogResolve = null; function HelperAppLauncherDialog() {} HelperAppLauncherDialog.prototype = { - show(aLauncher, aWindowContext, aReason) { + show(aLauncher, aWindowContext) { ok(true, "Showing the helper app dialog"); curDialogResolve(aWindowContext); executeSoon(() => { diff --git a/uriloader/exthandler/tests/mochitest/browser_auto_close_window_nodialog.js b/uriloader/exthandler/tests/mochitest/browser_auto_close_window_nodialog.js index 4f1e8ab18e..a80d8aa656 100644 --- a/uriloader/exthandler/tests/mochitest/browser_auto_close_window_nodialog.js +++ b/uriloader/exthandler/tests/mochitest/browser_auto_close_window_nodialog.js @@ -26,13 +26,13 @@ let curSaveResolve = null; function HelperAppLauncherDialog() {} HelperAppLauncherDialog.prototype = { - show(aLauncher, aWindowContext, aReason) { + show(aLauncher) { ok(false, "Shouldn't be showing the helper app dialog"); executeSoon(() => { aLauncher.cancel(Cr.NS_ERROR_ABORT); }); }, - promptForSaveToFileAsync(aLauncher, aWindowContext, aReason) { + promptForSaveToFileAsync(aLauncher, aWindowContext) { ok(true, "Shouldn't be showing the helper app dialog"); curSaveResolve(aWindowContext); executeSoon(() => { diff --git a/uriloader/exthandler/tests/mochitest/browser_download_idn_blocklist.js b/uriloader/exthandler/tests/mochitest/browser_download_idn_blocklist.js index 0d49a898a0..a5de2870af 100644 --- a/uriloader/exthandler/tests/mochitest/browser_download_idn_blocklist.js +++ b/uriloader/exthandler/tests/mochitest/browser_download_idn_blocklist.js @@ -24,7 +24,10 @@ server.registerFile(`/${encodeURIComponent(TEST_FILE)}`, file); */ add_task(async function test_idn_blocklisted_char_not_escaped() { await SpecialPowers.pushPrefEnv({ - set: [["browser.download.always_ask_before_handling_new_types", false]], + set: [ + ["browser.download.always_ask_before_handling_new_types", false], + ["dom.block_download_insecure", false], + ], }); info("Testing with " + TEST_URL); diff --git a/uriloader/exthandler/tests/mochitest/browser_download_open_with_internal_handler.js b/uriloader/exthandler/tests/mochitest/browser_download_open_with_internal_handler.js index c73538fe19..35d93703cd 100644 --- a/uriloader/exthandler/tests/mochitest/browser_download_open_with_internal_handler.js +++ b/uriloader/exthandler/tests/mochitest/browser_download_open_with_internal_handler.js @@ -23,7 +23,7 @@ const HandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService( ); let MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); function waitForAcceptButtonToGetEnabled(doc) { let dialog = doc.querySelector("#unknownContentType"); diff --git a/uriloader/exthandler/tests/mochitest/browser_download_spam_permissions.js b/uriloader/exthandler/tests/mochitest/browser_download_spam_permissions.js index 0f80af5ac5..082c278b69 100644 --- a/uriloader/exthandler/tests/mochitest/browser_download_spam_permissions.js +++ b/uriloader/exthandler/tests/mochitest/browser_download_spam_permissions.js @@ -18,7 +18,7 @@ const TEST_PATH = getRootDirectory(gTestPath).replace( const AUTOMATIC_DOWNLOAD_TOPIC = "blocked-automatic-download"; var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); registerCleanupFunction(() => MockFilePicker.cleanup()); let gTempDownloadDir; @@ -140,7 +140,7 @@ async function savelink() { await popupShown; await new Promise(resolve => { - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { resolve(); let file = gTempDownloadDir.clone(); file.append("file_with__funny_name.png"); diff --git a/uriloader/exthandler/tests/mochitest/browser_download_urlescape.js b/uriloader/exthandler/tests/mochitest/browser_download_urlescape.js index ababcc095c..e153b696bf 100644 --- a/uriloader/exthandler/tests/mochitest/browser_download_urlescape.js +++ b/uriloader/exthandler/tests/mochitest/browser_download_urlescape.js @@ -9,7 +9,7 @@ const TEST_PATH = getRootDirectory(gTestPath).replace( ); var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); registerCleanupFunction(() => MockFilePicker.cleanup()); /** diff --git a/uriloader/exthandler/tests/mochitest/browser_extension_correction.js b/uriloader/exthandler/tests/mochitest/browser_extension_correction.js index 9d67bf7213..955b8cec8c 100644 --- a/uriloader/exthandler/tests/mochitest/browser_extension_correction.js +++ b/uriloader/exthandler/tests/mochitest/browser_extension_correction.js @@ -172,7 +172,7 @@ async function checkDownloadWithExtensionState( * we enforce a useful extension. */ add_task(async function test_enforce_useful_extension() { - await BrowserTestUtils.withNewTab("data:text/html,", async browser => { + await BrowserTestUtils.withNewTab("data:text/html,", async () => { await testLinkWithoutExtension("image/png", true); await testLinkWithoutExtension("audio/ogg", true); await testLinkWithoutExtension("video/webm", true); diff --git a/uriloader/exthandler/tests/mochitest/browser_local_files_open_doesnt_duplicate.js b/uriloader/exthandler/tests/mochitest/browser_local_files_open_doesnt_duplicate.js index d8e7c87c10..e708dd1acf 100644 --- a/uriloader/exthandler/tests/mochitest/browser_local_files_open_doesnt_duplicate.js +++ b/uriloader/exthandler/tests/mochitest/browser_local_files_open_doesnt_duplicate.js @@ -41,7 +41,7 @@ add_task(async function open_from_dialog() { let openingPromise = TestUtils.topicObserved( "test-only-opening-downloaded-file", - (subject, data) => { + subject => { subject.QueryInterface(Ci.nsISupportsPRBool); // Block opening the file: subject.data = false; @@ -92,7 +92,7 @@ add_task(async function open_directly() { let openingPromise = TestUtils.topicObserved( "test-only-opening-downloaded-file", - (subject, data) => { + subject => { subject.QueryInterface(Ci.nsISupportsPRBool); // Block opening the file: subject.data = false; diff --git a/uriloader/exthandler/tests/mochitest/browser_open_internal_choice_persistence.js b/uriloader/exthandler/tests/mochitest/browser_open_internal_choice_persistence.js index 424fd424f9..a663fd3223 100644 --- a/uriloader/exthandler/tests/mochitest/browser_open_internal_choice_persistence.js +++ b/uriloader/exthandler/tests/mochitest/browser_open_internal_choice_persistence.js @@ -66,7 +66,7 @@ function ensureMIMEState({ preferredAction, alwaysAskBeforeHandling }) { } function waitDelay(delay) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { /* eslint-disable mozilla/no-arbitrary-setTimeout */ window.setTimeout(resolve, delay); }); diff --git a/uriloader/exthandler/tests/mochitest/browser_pdf_save_as.js b/uriloader/exthandler/tests/mochitest/browser_pdf_save_as.js index a08fe342cc..5d4a2080a7 100644 --- a/uriloader/exthandler/tests/mochitest/browser_pdf_save_as.js +++ b/uriloader/exthandler/tests/mochitest/browser_pdf_save_as.js @@ -16,9 +16,9 @@ const TEST_PATH = getRootDirectory(gTestPath).replace( const { saveToDisk, alwaysAsk, handleInternally, useSystemDefault } = Ci.nsIHandlerInfo; const MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); -async function testPdfFilePicker(mimeInfo) { +async function testPdfFilePicker() { await BrowserTestUtils.withNewTab( `data:text/html,<a id="test-link" href="${TEST_PATH}/file_pdf_application_pdf.pdf">Test PDF Link</a>`, async browser => { @@ -37,12 +37,14 @@ async function testPdfFilePicker(mimeInfo) { let filePickerPromise = new Promise(resolve => { MockFilePicker.showCallback = fp => { ok(true, "filepicker should be visible"); - ok( - fp.defaultExtension === "pdf", + Assert.strictEqual( + fp.defaultExtension, + "pdf", "Default extension in filepicker should be pdf" ); - ok( - fp.defaultString === "file_pdf_application_pdf.pdf", + Assert.strictEqual( + fp.defaultString, + "file_pdf_application_pdf.pdf", "Default string name in filepicker should have the correct pdf file name" ); setTimeout(resolve, 0); diff --git a/uriloader/exthandler/tests/mochitest/browser_save_filenames.js b/uriloader/exthandler/tests/mochitest/browser_save_filenames.js index 46750d5c87..984d0dea21 100644 --- a/uriloader/exthandler/tests/mochitest/browser_save_filenames.js +++ b/uriloader/exthandler/tests/mochitest/browser_save_filenames.js @@ -55,7 +55,7 @@ const DEFAULT_FILENAME = const PROMISE_FILENAME_TYPE = "application/x-moz-file-promise-dest-filename"; let MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); let expectedItems; let sendAsAttachment = false; @@ -240,7 +240,7 @@ add_task(async function save_document() { tmpDir.append(baseFilename + "_document_files"); MockFilePicker.displayDirectory = tmpDir; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { MockFilePicker.setFiles([tmpFile]); MockFilePicker.filterIndex = 0; // kSaveAsType_Complete }; @@ -280,8 +280,9 @@ add_task(async function save_document() { fileIdx = filesSaved.indexOf(filename); } - ok( - fileIdx >= 0, + Assert.greaterOrEqual( + fileIdx, + 0, "file i" + idx + " " + @@ -562,7 +563,7 @@ add_task(async function saveas_files_modified_in_filepicker() { await new Promise(resolve => { MockFilePicker.displayDirectory = savedFile; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { MockFilePicker.filterIndex = 0; // kSaveAsType_Complete savedFile.append(items[idx].pickedfilename); MockFilePicker.setFiles([savedFile]); diff --git a/uriloader/exthandler/tests/mochitest/browser_shows_where_to_save_dialog.js b/uriloader/exthandler/tests/mochitest/browser_shows_where_to_save_dialog.js index 6bf375dfff..38cca8530d 100644 --- a/uriloader/exthandler/tests/mochitest/browser_shows_where_to_save_dialog.js +++ b/uriloader/exthandler/tests/mochitest/browser_shows_where_to_save_dialog.js @@ -16,7 +16,7 @@ const { handleInternally, useHelperApp, useSystemDefault, saveToDisk } = Ci.nsIHandlerInfo; let MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); add_setup(async function () { await SpecialPowers.pushPrefEnv({ @@ -50,7 +50,7 @@ add_task(async function aDownloadSavedToDiskPromptsForFolder() { await publicList.removeFinished(); }); let filePickerShownPromise = new Promise(resolve => { - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { setTimeout(resolve, 0); return Ci.nsIFilePicker.returnCancel; }; @@ -81,7 +81,7 @@ add_task(async function testFilesHandledInternally() { ); let filePickerShown = false; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { filePickerShown = true; return Ci.nsIFilePicker.returnCancel; }; @@ -120,7 +120,7 @@ add_task(async function testFilesHandledBySystemDefaultApp() { ensureMIMEState({ preferredAction: useSystemDefault }); let filePickerShown = false; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { filePickerShown = true; return Ci.nsIFilePicker.returnCancel; }; @@ -178,7 +178,7 @@ add_task(async function testFilesHandledByHelperApp() { }); let filePickerShown = false; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { filePickerShown = true; return Ci.nsIFilePicker.returnCancel; }; diff --git a/uriloader/exthandler/tests/mochitest/browser_txt_download_save_as.js b/uriloader/exthandler/tests/mochitest/browser_txt_download_save_as.js index 7155c35fd9..9d0f8db41c 100644 --- a/uriloader/exthandler/tests/mochitest/browser_txt_download_save_as.js +++ b/uriloader/exthandler/tests/mochitest/browser_txt_download_save_as.js @@ -25,7 +25,7 @@ const { } = Ci.nsIHandlerInfo; const testDir = createTemporarySaveDirectory(); const MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js", @@ -64,12 +64,14 @@ async function setupFilePicker() { MockFilePicker.displayDirectory = testDir; MockFilePicker.showCallback = fp => { ok(true, "filepicker should be visible"); - ok( - fp.defaultExtension === "txt", + Assert.strictEqual( + fp.defaultExtension, + "txt", "Default extension in filepicker should be txt" ); - ok( - fp.defaultString === "file_txt_attachment_test.txt", + Assert.strictEqual( + fp.defaultString, + "file_txt_attachment_test.txt", "Default string name in filepicker should have the correct file name" ); const destFile = testDir.clone(); diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index 7f6eaa46f2..fcc2e9f5ab 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -176,7 +176,7 @@ struct FileLocationCache { void Clear() { *this = {}; } }; - EnumeratedArray<FileKind, FileKind::Count, Entry> mEntries; + EnumeratedArray<FileKind, Entry, size_t(FileKind::Count)> mEntries; static const char* PrefFor(FileKind aKind) { switch (aKind) { |