mozilla-kde.patch
branchfirefox112
changeset 1188 a2caa2a2494f
parent 1184 1c3d3217d679
child 1189 ba0c97b018a6
--- a/mozilla-kde.patch	Mon Apr 10 23:42:16 2023 +0200
+++ b/mozilla-kde.patch	Tue May 09 23:09:18 2023 +0200
@@ -3,7 +3,7 @@
 # Date 1559294891 -7200
 #      Fri May 31 11:28:11 2019 +0200
 # Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112
-# Parent  191cd9e24a9e0812f74c808ceef611c8b10141e1
+# Parent  b6b4d42b51c6a815116505bf7e9b34a5e2f0c65b
 Description: Add KDE integration to Firefox (toolkit parts)
 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
 Author: Lubos Lunak <lunak@suse.com>
@@ -31,7 +31,7 @@
  #ifdef MOZ_MEMORY
  #  include "mozmemory.h"
  #endif
-@@ -4882,16 +4883,27 @@ nsresult Preferences::InitInitialObjects
+@@ -4908,16 +4909,27 @@ nsresult Preferences::InitInitialObjects
      "unix.js"
  #  if defined(_AIX)
      ,
@@ -57,9 +57,9 @@
      NS_WARNING("Error parsing application default preferences.");
    }
  
- #if defined(MOZ_WIDGET_GTK)
-   // Under Flatpak/Snap package, load /etc/firefox/defaults/pref/*.js.
-@@ -4973,17 +4985,17 @@ nsresult Preferences::InitInitialObjects
+   // Load jar:$app/omni.jar!/defaults/preferences/*.js
+   // or jar:$gre/omni.jar!/defaults/preferences/*.js.
+@@ -4982,17 +4994,17 @@ nsresult Preferences::InitInitialObjects
        }
  
        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
@@ -73,11 +73,11 @@
      }
    }
  
-   if (XRE_IsParentProcess()) {
-     SetupTelemetryPref();
-   }
- 
-   if (aIsStartup) {
+ #if defined(MOZ_WIDGET_GTK)
+   // To ensure the system-wide preferences are not overwritten by
+   // firefox/browser/defauts/preferences/*.js we need to load
+   // the /etc/firefox/defaults/pref/*.js settings as last.
+   // Under Flatpak, the NS_OS_SYSTEM_CONFIG_DIR points to /app/etc/firefox
 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
 --- a/modules/libpref/moz.build
 +++ b/modules/libpref/moz.build
@@ -165,7 +165,7 @@
 diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm
 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
 +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
-@@ -1240,36 +1240,66 @@ nsUnknownContentTypeDialog.prototype = {
+@@ -1250,36 +1250,66 @@ nsUnknownContentTypeDialog.prototype = {
          params.handlerApp &&
          params.handlerApp.executable &&
          params.handlerApp.executable.isFile()
@@ -347,7 +347,7 @@
 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
 --- a/toolkit/xre/moz.build
 +++ b/toolkit/xre/moz.build
-@@ -92,17 +92,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "co
+@@ -91,17 +91,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "co
          "../components/printingui",
      ]
  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
@@ -1055,7 +1055,7 @@
 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
-@@ -1,46 +1,49 @@
+@@ -1,48 +1,51 @@
  /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
   *
   * This Source Code Form is subject to the terms of the Mozilla Public
@@ -1082,10 +1082,12 @@
  
  NS_IMETHODIMP
  nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) {
-   // if mDefaultApplication is set, it means the application has been set from
+   // if a default app is set, it means the application has been set from
    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
    // give the GNOME answer.
-   if (mDefaultApplication) return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
+   if (GetDefaultApplication()) {
+     return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
+   }
  
    *_retval = false;
  
@@ -1110,11 +1112,11 @@
    if (*_retval) return NS_OK;
  
    return NS_OK;
-@@ -50,16 +53,33 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWi
-   // if mDefaultApplication is set, it means the application has been set from
-   // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
+@@ -54,16 +57,33 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWi
    // give the GNOME answer.
-   if (mDefaultApplication) return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
+   if (GetDefaultApplication()) {
+     return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
+   }
  
    nsAutoCString nativePath;
    aFile->GetNativePath(nativePath);
@@ -1130,10 +1132,10 @@
 +      if( nsKDEUtils::command( command ))
 +        return NS_OK;
 +    }
-+    if (!mDefaultApplication)
++    if (!GetDefaultApplication())
 +      return NS_ERROR_FILE_NOT_FOUND;
 +
-+    return LaunchWithIProcess(mDefaultApplication, nativePath);
++    return LaunchWithIProcess(GetDefaultApplication(), nativePath);
 +  }
 +
    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
@@ -1245,7 +1247,7 @@
 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
 --- a/widget/gtk/moz.build
 +++ b/widget/gtk/moz.build
-@@ -147,16 +147,17 @@ FINAL_LIBRARY = "xul"
+@@ -142,16 +142,17 @@ FINAL_LIBRARY = "xul"
  
  LOCAL_INCLUDES += [
      "/layout/base",
@@ -1283,7 +1285,7 @@
  #include "nsGtkUtils.h"
  #include "nsIFileURL.h"
  #include "nsIGIOService.h"
-@@ -21,16 +22,18 @@
+@@ -23,16 +24,18 @@
  #include "nsArrayEnumerator.h"
  #include "nsEnumeratorUtils.h"
  #include "nsNetUtil.h"
@@ -1302,7 +1304,7 @@
  #  include "Units.h"
  extern mozilla::LazyLogModule gWidgetLog;
  #  define LOG(args) MOZ_LOG(gWidgetLog, mozilla::LogLevel::Debug, args)
-@@ -235,17 +238,19 @@ nsFilePicker::AppendFilters(int32_t aFil
+@@ -237,17 +240,19 @@ nsFilePicker::AppendFilters(int32_t aFil
    mAllowURLs = !!(aFilterMask & filterAllowURLs);
    return nsBaseFilePicker::AppendFilters(aFilterMask);
  }
@@ -1323,7 +1325,7 @@
  
    mFilters.AppendElement(filter);
    mFilterNames.AppendElement(name);
-@@ -345,16 +350,39 @@ nsresult nsFilePicker::Show(int16_t* aRe
+@@ -347,16 +352,39 @@ nsresult nsFilePicker::Show(nsIFilePicke
    return NS_OK;
  }
  
@@ -1339,7 +1341,7 @@
 +    NS_ADDREF_THIS();
 +    g_idle_add([](gpointer data) -> gboolean {
 +      nsFilePicker* queuedPicker = (nsFilePicker*) data;
-+      int16_t result;
++      nsIFilePicker::ResultCode result;
 +      queuedPicker->kdeFileDialog(&result);
 +      if (queuedPicker->mCallback) {
 +        queuedPicker->mCallback->Done(result);
@@ -1363,7 +1365,7 @@
    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  
    const gchar* accept_button;
-@@ -574,16 +602,244 @@ void nsFilePicker::Done(void* file_choos
+@@ -628,16 +656,244 @@ void nsFilePicker::Done(void* file_choos
      mCallback->Done(result);
      mCallback = nullptr;
    } else {
@@ -1395,7 +1397,7 @@
 +    return GDK_WINDOW_XID( gdk_window );
 +    }
 +
-+NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn)
++NS_IMETHODIMP nsFilePicker::kdeFileDialog(nsIFilePicker::ResultCode *aReturn)
 +    {
 +    NS_ENSURE_ARG_POINTER(aReturn);
 +
@@ -1569,7 +1571,7 @@
 +    }
 +
 +
-+NS_IMETHODIMP nsFilePicker::kdeAppsDialog(PRInt16 *aReturn)
++NS_IMETHODIMP nsFilePicker::kdeAppsDialog(nsIFilePicker::ResultCode *aReturn)
 +    {
 +    NS_ENSURE_ARG_POINTER(aReturn);
 +
@@ -1611,7 +1613,7 @@
 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
 --- a/widget/gtk/nsFilePicker.h
 +++ b/widget/gtk/nsFilePicker.h
-@@ -67,16 +67,22 @@ class nsFilePicker : public nsBaseFilePi
+@@ -69,16 +69,22 @@ class nsFilePicker : public nsBaseFilePi
    nsString mDefaultExtension;
  
    nsTArray<nsCString> mFilters;
@@ -1622,8 +1624,8 @@
  
 +  bool kdeRunning();
 +  bool getKdeRunning();
-+  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
-+  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
++  NS_IMETHODIMP kdeFileDialog(nsIFilePicker::ResultCode *aReturn);
++  NS_IMETHODIMP kdeAppsDialog(nsIFilePicker::ResultCode *aReturn);
 +  nsCString kdeMakeFilter( int index );
 +
    void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
@@ -1807,7 +1809,7 @@
  #  include "prmem.h"
  #  include "plbase64.h"
  
-@@ -2157,20 +2158,29 @@ nsLocalFile::SetPersistentDescriptor(con
+@@ -2167,20 +2168,29 @@ nsLocalFile::SetPersistentDescriptor(con
  
  NS_IMETHODIMP
  nsLocalFile::Reveal() {
@@ -1839,7 +1841,7 @@
      ::CFRelease(url);
      return rv;
    }
-@@ -2182,16 +2192,23 @@ nsLocalFile::Reveal() {
+@@ -2192,16 +2202,23 @@ nsLocalFile::Reveal() {
  
  NS_IMETHODIMP
  nsLocalFile::Launch() {