Accepting request 964625 from home:DarkWav

Change mozilla-kde.patch to follow the GNOME registry behavior for new MIME types to avoid opening downloaded files without any inquiries (bsc#1197319)

In Firefox 98.0, improvements to the download panel have been made to just download files instead of asking the user what to do with them. Unfortunately this causes some unwanted behavior inside nsKDERegistry as its unconditional call to the function 

mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);

results in the browser opening many file types after download without any inquiries.
By replacing this unconditional call with the conditional one found in nsGNOMERegistry as of 98.0, this issue can be avoided:
3b6a1dc7fb/uriloader/exthandler/unix/nsGNOMERegistry.cpp (L98)

If you have any suggestions for improvement, please let me know!

OBS-URL: https://build.opensuse.org/request/show/964625
OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox?expand=0&rev=967
This commit is contained in:
Wolfgang Rosenauer 2022-03-24 22:11:50 +00:00 committed by Git OBS Bridge
parent e338663852
commit eb06ba482c
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Mar 23 15:14:22 UTC 2022 - Simon Vogl <simon.vogl@gmx.net>
- Change mozilla-kde.patch to follow the GNOME registry
behavior for new MIME types to avoid opening downloaded files
without any inquiries (bsc#1197319)
-------------------------------------------------------------------
Tue Mar 22 12:22:51 UTC 2022 - Guillaume GARDET <guillaume.gardet@opensuse.org>

View File

@ -941,12 +941,13 @@ diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/
new file mode 100644
--- /dev/null
+++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
@@ -0,0 +1,86 @@
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/StaticPrefs_browser.h"
+#include "nsKDERegistry.h"
+#include "prlink.h"
+#include "prmem.h"
@ -1022,8 +1023,10 @@ new file mode 100644
+ nsCString description = output[ 1 ];
+ mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description));
+ nsCString handlerAppName = output[ 2 ];
+ mozilla::StaticPrefs::browser_download_improvements_to_download_panel()
+ ? mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk)
+ : mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
+ mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName));
+ mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
+ return mimeInfo.forget();
+ }
+ return nullptr;