--- a/mozilla-kde.patch Sat Jul 29 14:34:45 2023 +0200
+++ b/mozilla-kde.patch Fri Aug 04 12:30:24 2023 +0200
@@ -3,18 +3,22 @@
# Date 1559294891 -7200
# Fri May 31 11:28:11 2019 +0200
# Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112
-# Parent 0086fcc0d5c86a31cbac0a261ed7b526dd2df2e8
+# Parent eaadcfc5cb5ee0eed248051a657a69646334aad7
Description: Add KDE integration to Firefox (toolkit parts)
Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
Author: Lubos Lunak <lunak@suse.com>
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
https://bugzilla.novell.com/show_bug.cgi?id=170055
-Index: firefox-115.0/modules/libpref/Preferences.cpp
-===================================================================
---- firefox-115.0.orig/modules/libpref/Preferences.cpp
-+++ firefox-115.0/modules/libpref/Preferences.cpp
-@@ -95,6 +95,7 @@
+diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
+--- a/modules/libpref/Preferences.cpp
++++ b/modules/libpref/Preferences.cpp
+@@ -90,16 +90,17 @@
+ #include "PLDHashTable.h"
+ #include "prdtoa.h"
+ #include "prlink.h"
+ #include "xpcpublic.h"
+ #include "js/RootingAPI.h"
#ifdef MOZ_BACKGROUNDTASKS
# include "mozilla/BackgroundTasks.h"
#endif
@@ -22,7 +26,17 @@
#ifdef DEBUG
# include <map>
-@@ -4911,6 +4912,16 @@ nsresult Preferences::InitInitialObjects
+ #endif
+
+ #ifdef MOZ_MEMORY
+ # include "mozmemory.h"
+ #endif
+@@ -4901,16 +4902,26 @@ nsresult Preferences::InitInitialObjects
+ "unix.js"
+ # if defined(_AIX)
+ ,
+ "aix.js"
+ # endif
#endif
};
@@ -39,7 +53,17 @@
rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles,
ArrayLength(specialFiles));
if (NS_FAILED(rv)) {
-@@ -4985,7 +4996,7 @@ nsresult Preferences::InitInitialObjects
+ NS_WARNING("Error parsing application default preferences.");
+ }
+
+ // Load jar:$app/omni.jar!/defaults/preferences/*.js
+ // or jar:$gre/omni.jar!/defaults/preferences/*.js.
+@@ -4975,17 +4986,17 @@ nsresult Preferences::InitInitialObjects
+ }
+
+ nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
+ if (!path) {
+ continue;
}
// Do we care if a file provided by this process fails to load?
@@ -48,11 +72,20 @@
}
}
-Index: firefox-115.0/modules/libpref/moz.build
-===================================================================
---- firefox-115.0.orig/modules/libpref/moz.build
-+++ firefox-115.0/modules/libpref/moz.build
-@@ -126,6 +126,10 @@ UNIFIED_SOURCES += [
+ #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
+@@ -121,16 +121,20 @@ EXPORTS.mozilla += [
+ ]
+ EXPORTS.mozilla += sorted(["!" + g for g in gen_h])
+
+ UNIFIED_SOURCES += [
+ "Preferences.cpp",
"SharedPrefMap.cpp",
]
@@ -63,11 +96,20 @@
gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)
GeneratedFile(
-Index: firefox-115.0/python/mozbuild/mozpack/chrome/flags.py
-===================================================================
---- firefox-115.0.orig/python/mozbuild/mozpack/chrome/flags.py
-+++ firefox-115.0/python/mozbuild/mozpack/chrome/flags.py
-@@ -234,6 +234,7 @@ class Flags(OrderedDict):
+ *gen_all_tuple,
+ script="init/generate_static_pref_list.py",
+ entry_point="emit_code",
+ inputs=["init/StaticPrefList.yaml"]
+ )
+diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
+--- a/python/mozbuild/mozpack/chrome/flags.py
++++ b/python/mozbuild/mozpack/chrome/flags.py
+@@ -229,16 +229,17 @@ class Flags(OrderedDict):
+ "os": StringFlag,
+ "osversion": VersionFlag,
+ "abi": StringFlag,
+ "platform": Flag,
+ "xpcnativewrappers": Flag,
"tablet": Flag,
"process": StringFlag,
"backgroundtask": StringFlag,
@@ -75,11 +117,20 @@
}
RE = re.compile(r"([!<>=]+)")
-Index: firefox-115.0/python/mozbuild/mozpack/chrome/manifest.py
-===================================================================
---- firefox-115.0.orig/python/mozbuild/mozpack/chrome/manifest.py
-+++ firefox-115.0/python/mozbuild/mozpack/chrome/manifest.py
-@@ -43,6 +43,7 @@ class ManifestEntry(object):
+ def __init__(self, *flags):
+ """
+ Initialize a set of flags given in string form.
+ flags = Flags('contentaccessible=yes', 'appversion>=3.5')
+ """
+diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
+--- a/python/mozbuild/mozpack/chrome/manifest.py
++++ b/python/mozbuild/mozpack/chrome/manifest.py
+@@ -38,16 +38,17 @@ class ManifestEntry(object):
+ "os",
+ "osversion",
+ "abi",
+ "xpcnativewrappers",
+ "tablet",
"process",
"contentaccessible",
"backgroundtask",
@@ -87,11 +138,20 @@
]
def __init__(self, base, *flags):
-Index: firefox-115.0/toolkit/components/downloads/moz.build
-===================================================================
---- firefox-115.0.orig/toolkit/components/downloads/moz.build
-+++ firefox-115.0/toolkit/components/downloads/moz.build
-@@ -51,5 +51,9 @@ if CONFIG["MOZ_PLACES"]:
+ """
+ Initialize a manifest entry with the given base path and flags.
+ """
+ self.base = base
+ self.flags = Flags(*flags)
+diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
+--- a/toolkit/components/downloads/moz.build
++++ b/toolkit/components/downloads/moz.build
+@@ -46,10 +46,14 @@ XPCOM_MANIFESTS += [
+
+ if CONFIG["MOZ_PLACES"]:
+ EXTRA_JS_MODULES += [
+ "DownloadHistory.sys.mjs",
+ ]
FINAL_LIBRARY = "xul"
@@ -101,11 +161,15 @@
+
with Files("**"):
BUG_COMPONENT = ("Toolkit", "Downloads API")
-Index: firefox-115.0/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
-===================================================================
---- firefox-115.0.orig/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
-+++ firefox-115.0/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
-@@ -1246,26 +1246,56 @@ nsUnknownContentTypeDialog.prototype = {
+diff --git a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
+--- a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
++++ b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
+@@ -1241,36 +1241,66 @@ nsUnknownContentTypeDialog.prototype = {
+ params.handlerApp &&
+ params.handlerApp.executable &&
+ params.handlerApp.executable.isFile()
+ ) {
+ // Remember the file they chose to run.
this.chosenApp = params.handlerApp;
}
} else if ("@mozilla.org/applicationchooser;1" in Cc) {
@@ -182,11 +246,20 @@
} else {
var nsIFilePicker = Ci.nsIFilePicker;
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
-Index: firefox-115.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
-===================================================================
---- firefox-115.0.orig/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
-+++ firefox-115.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
-@@ -16,6 +16,8 @@
+ fp.init(
+ this.mDialog,
+ this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
+ nsIFilePicker.modeOpen
+ );
+diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
++++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+@@ -11,16 +11,18 @@
+ #include "prenv.h"
+ #include "nsInterfaceHashtable.h"
+ #include "nsHashtablesFwd.h"
+ #include "nsHashKeys.h"
+ #include "nsNetUtil.h"
#include "nsISupportsPrimitives.h"
#include "nsIGSettingsService.h"
#include "nsReadableUtils.h"
@@ -195,7 +268,17 @@
using namespace mozilla;
-@@ -39,6 +41,8 @@ class nsUnixSystemProxySettings final :
+ class nsUnixSystemProxySettings final : public nsISystemProxySettings {
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISYSTEMPROXYSETTINGS
+
+@@ -34,16 +36,18 @@ class nsUnixSystemProxySettings final :
+ nsCOMPtr<nsIGSettingsCollection> mProxySettings;
+ nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection>
+ mSchemeProxySettings;
+ nsresult GetProxyFromGSettings(const nsACString& aScheme,
+ const nsACString& aHost, int32_t aPort,
nsACString& aResult);
nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
nsACString& aResult);
@@ -204,7 +287,17 @@
};
NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
-@@ -396,6 +400,9 @@ nsresult nsUnixSystemProxySettings::GetP
+
+ NS_IMETHODIMP
+ nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
+ // dbus prevents us from being threadsafe, but this routine should not block
+ // anyhow
+@@ -391,21 +395,46 @@ nsresult nsUnixSystemProxySettings::GetP
+ return NS_OK;
+ }
+
+ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
+ const nsACString& aScheme,
const nsACString& aHost,
const int32_t aPort,
nsACString& aResult) {
@@ -214,7 +307,8 @@
if (mProxySettings) {
nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
if (NS_SUCCEEDED(rv)) return rv;
-@@ -404,6 +411,28 @@ nsresult nsUnixSystemProxySettings::GetP
+ }
+
return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
}
@@ -243,11 +337,17 @@
NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
auto result = MakeRefPtr<nsUnixSystemProxySettings>();
result->Init();
-Index: firefox-115.0/toolkit/xre/moz.build
-===================================================================
---- firefox-115.0.orig/toolkit/xre/moz.build
-+++ firefox-115.0/toolkit/xre/moz.build
-@@ -96,7 +96,9 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "ui
+ return result.forget().downcast<nsISupports>();
+ }
+diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
+--- a/toolkit/xre/moz.build
++++ b/toolkit/xre/moz.build
+@@ -91,17 +91,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "co
+ "../components/printingui",
+ ]
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
+ UNIFIED_SOURCES += [
+ "nsNativeAppSupportDefault.cpp",
"UIKitDirProvider.mm",
]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
@@ -257,10 +357,15 @@
"nsNativeAppSupportUnix.cpp",
]
CXXFLAGS += CONFIG["MOZ_X11_SM_CFLAGS"]
-Index: firefox-115.0/toolkit/xre/nsKDEUtils.cpp
-===================================================================
+ else:
+ UNIFIED_SOURCES += [
+ "nsNativeAppSupportDefault.cpp",
+ ]
+
+diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
+new file mode 100644
--- /dev/null
-+++ firefox-115.0/toolkit/xre/nsKDEUtils.cpp
++++ b/toolkit/xre/nsKDEUtils.cpp
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
@@ -548,10 +653,10 @@
+ commandFile); // done as \E, so it cannot happen in normal data
+ fflush(commandFile);
+}
-Index: firefox-115.0/toolkit/xre/nsKDEUtils.h
-===================================================================
+diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h
+new file mode 100644
--- /dev/null
-+++ firefox-115.0/toolkit/xre/nsKDEUtils.h
++++ b/toolkit/xre/nsKDEUtils.h
@@ -0,0 +1,53 @@
+/* -*- 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
@@ -606,11 +711,15 @@
+};
+
+#endif // nsKDEUtils
-Index: firefox-115.0/uriloader/exthandler/HandlerServiceParent.cpp
-===================================================================
---- firefox-115.0.orig/uriloader/exthandler/HandlerServiceParent.cpp
-+++ firefox-115.0/uriloader/exthandler/HandlerServiceParent.cpp
-@@ -18,7 +18,7 @@
+diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
+--- a/uriloader/exthandler/HandlerServiceParent.cpp
++++ b/uriloader/exthandler/HandlerServiceParent.cpp
+@@ -13,17 +13,17 @@
+ #include "ContentHandlerService.h"
+ #include "nsIExternalProtocolService.h"
+ #include "nsStringEnumerator.h"
+ #include "nsIMutableArray.h"
+ #include "nsCExternalHandlerService.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZ_WIDGET_GTK
@@ -619,7 +728,17 @@
#endif
using mozilla::dom::ContentHandlerService;
-@@ -310,8 +310,8 @@ mozilla::ipc::IPCResult HandlerServicePa
+ using mozilla::dom::HandlerApp;
+ using mozilla::dom::HandlerInfo;
+ using mozilla::dom::RemoteHandlerApp;
+
+ namespace {
+@@ -305,18 +305,18 @@ mozilla::ipc::IPCResult HandlerServicePa
+ mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS(
+ const nsACString& aProtocolScheme, bool* aHandlerExists) {
+ if (aProtocolScheme.Length() > MAX_SCHEME_LENGTH) {
+ *aHandlerExists = false;
+ return IPC_OK();
}
#ifdef MOZ_WIDGET_GTK
// Check the GNOME registry for a protocol handler
@@ -630,11 +749,20 @@
#else
*aHandlerExists = false;
#endif
-Index: firefox-115.0/uriloader/exthandler/moz.build
-===================================================================
---- firefox-115.0.orig/uriloader/exthandler/moz.build
-+++ firefox-115.0/uriloader/exthandler/moz.build
-@@ -86,7 +86,9 @@ else:
+ return IPC_OK();
+ }
+
+ /*
+ * Check if a handler exists for the provided protocol. Check the datastore
+diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
+--- a/uriloader/exthandler/moz.build
++++ b/uriloader/exthandler/moz.build
+@@ -81,17 +81,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "ui
+ else:
+ # These files can't be built in unified mode because they redefine LOG.
+ SOURCES += [
+ osdir + "/nsOSHelperAppService.cpp",
+ ]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
UNIFIED_SOURCES += [
@@ -644,7 +772,17 @@
"unix/nsMIMEInfoUnix.cpp",
]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
-@@ -134,6 +136,7 @@ LOCAL_INCLUDES += [
+ UNIFIED_SOURCES += [
+ "android/nsMIMEInfoAndroid.cpp",
+ ]
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
+ UNIFIED_SOURCES += [
+@@ -129,16 +131,17 @@ include("/ipc/chromium/chromium-config.m
+ FINAL_LIBRARY = "xul"
+
+ LOCAL_INCLUDES += [
+ "/docshell/base",
+ "/dom/base",
"/dom/ipc",
"/netwerk/base",
"/netwerk/protocol/http",
@@ -652,10 +790,15 @@
]
if CONFIG["MOZ_ENABLE_DBUS"]:
-Index: firefox-115.0/uriloader/exthandler/unix/nsCommonRegistry.cpp
-===================================================================
+ CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"]
+
+ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
+ CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
+diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
+new file mode 100644
--- /dev/null
-+++ firefox-115.0/uriloader/exthandler/unix/nsCommonRegistry.cpp
++++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
@@ -0,0 +1,42 @@
+/* -*- 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
@@ -699,10 +842,10 @@
+ if (nsKDEUtils::kdeSupport()) return nsKDERegistry::GetFromType(aMIMEType);
+ return nsGNOMERegistry::GetFromType(aMIMEType);
+}
-Index: firefox-115.0/uriloader/exthandler/unix/nsCommonRegistry.h
-===================================================================
+diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h
+new file mode 100644
--- /dev/null
-+++ firefox-115.0/uriloader/exthandler/unix/nsCommonRegistry.h
++++ b/uriloader/exthandler/unix/nsCommonRegistry.h
@@ -0,0 +1,28 @@
+/* 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
@@ -732,10 +875,10 @@
+};
+
+#endif
-Index: firefox-115.0/uriloader/exthandler/unix/nsKDERegistry.cpp
-===================================================================
+diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp
+new file mode 100644
--- /dev/null
-+++ firefox-115.0/uriloader/exthandler/unix/nsKDERegistry.cpp
++++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
@@ -0,0 +1,75 @@
+/* -*- 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
@@ -812,10 +955,10 @@
+ }
+ return nullptr;
+}
-Index: firefox-115.0/uriloader/exthandler/unix/nsKDERegistry.h
-===================================================================
+diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h
+new file mode 100644
--- /dev/null
-+++ firefox-115.0/uriloader/exthandler/unix/nsKDERegistry.h
++++ b/uriloader/exthandler/unix/nsKDERegistry.h
@@ -0,0 +1,35 @@
+/* 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
@@ -852,11 +995,14 @@
+};
+
+#endif // nsKDERegistry_h__
-Index: firefox-115.0/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
-===================================================================
---- firefox-115.0.orig/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
-+++ firefox-115.0/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
-@@ -5,16 +5,19 @@
+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,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
+ * 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 "nsMIMEInfoUnix.h"
@@ -878,7 +1024,14 @@
}
NS_IMETHODIMP
-@@ -29,15 +32,15 @@ nsMIMEInfoUnix::GetHasDefaultHandler(boo
+ nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) {
+ // 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 (GetDefaultApplication()) {
+ return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
+ }
+
*_retval = false;
if (mClass == eProtocolInfo) {
@@ -897,7 +1050,17 @@
}
}
if (mimeInfo) *_retval = true;
-@@ -59,6 +62,21 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWi
+ }
+
+ if (*_retval) return NS_OK;
+
+ return NS_OK;
+@@ -54,16 +57,31 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWi
+ // give the GNOME answer.
+ if (GetDefaultApplication()) {
+ return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
+ }
+
nsAutoCString nativePath;
aFile->GetNativePath(nativePath);
@@ -919,11 +1082,20 @@
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
if (!giovfs) {
return NS_ERROR_FAILURE;
-Index: firefox-115.0/uriloader/exthandler/unix/nsOSHelperAppService.cpp
-===================================================================
---- firefox-115.0.orig/uriloader/exthandler/unix/nsOSHelperAppService.cpp
-+++ firefox-115.0/uriloader/exthandler/unix/nsOSHelperAppService.cpp
-@@ -10,7 +10,7 @@
+ }
+
+ // nsGIOMimeApp->Launch wants a URI string instead of local file
+ nsresult rv;
+ nsCOMPtr<nsIIOService> ioservice =
+diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
++++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+@@ -5,17 +5,17 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
#include "nsOSHelperAppService.h"
#include "nsMIMEInfoUnix.h"
#ifdef MOZ_WIDGET_GTK
@@ -932,7 +1104,17 @@
# ifdef MOZ_BUILD_APP_IS_BROWSER
# include "nsIToolkitShellService.h"
# include "nsIGNOMEShellService.h"
-@@ -1106,7 +1106,7 @@ nsresult nsOSHelperAppService::OSProtoco
+ # endif
+ #endif
+ #include "nsISupports.h"
+ #include "nsString.h"
+ #include "nsReadableUtils.h"
+@@ -1101,17 +1101,17 @@ nsresult nsOSHelperAppService::GetHandle
+
+ nsresult nsOSHelperAppService::OSProtocolHandlerExists(
+ const char* aProtocolScheme, bool* aHandlerExists) {
+ nsresult rv = NS_OK;
+
if (!XRE_IsContentProcess()) {
#ifdef MOZ_WIDGET_GTK
// Check the GNOME registry for a protocol handler
@@ -941,7 +1123,17 @@
#else
*aHandlerExists = false;
#endif
-@@ -1126,7 +1126,7 @@ nsresult nsOSHelperAppService::OSProtoco
+ } else {
+ *aHandlerExists = false;
+ nsCOMPtr<nsIHandlerService> handlerSvc =
+ do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv);
+ if (NS_SUCCEEDED(rv) && handlerSvc) {
+@@ -1121,17 +1121,17 @@ nsresult nsOSHelperAppService::OSProtoco
+ }
+
+ return rv;
+ }
+
NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(
const nsACString& aScheme, nsAString& _retval) {
#ifdef MOZ_WIDGET_GTK
@@ -950,7 +1142,17 @@
return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
#else
return NS_ERROR_NOT_AVAILABLE;
-@@ -1231,7 +1231,7 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
+ #endif
+ }
+
+ NS_IMETHODIMP nsOSHelperAppService::IsCurrentAppOSDefaultForProtocol(
+ const nsACString& aScheme, bool* _retval) {
+@@ -1226,17 +1226,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
+ nsresult rv =
+ LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
+ minorType, mime_types_description, true);
+
+ if (NS_FAILED(rv) || majorType.IsEmpty()) {
#ifdef MOZ_WIDGET_GTK
LOG("Looking in GNOME registry\n");
RefPtr<nsMIMEInfoBase> gnomeInfo =
@@ -959,7 +1161,17 @@
if (gnomeInfo) {
LOG("Got MIMEInfo from GNOME registry\n");
return gnomeInfo.forget();
-@@ -1344,7 +1344,7 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
+ }
+ #endif
+
+ rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
+ minorType, mime_types_description, false);
+@@ -1339,17 +1339,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
+
+ // Now look up our extensions
+ nsAutoString extensions, mime_types_description;
+ LookUpExtensionsAndDescription(majorType, minorType, extensions,
+ mime_types_description);
#ifdef MOZ_WIDGET_GTK
if (handler.IsEmpty()) {
@@ -968,23 +1180,40 @@
if (gnomeInfo) {
LOG("Got MIMEInfo from GNOME registry without extensions; setting them "
"to %s\n",
-Index: firefox-115.0/widget/gtk/moz.build
-===================================================================
---- firefox-115.0.orig/widget/gtk/moz.build
-+++ firefox-115.0/widget/gtk/moz.build
-@@ -149,6 +149,7 @@ LOCAL_INCLUDES += [
+ NS_LossyConvertUTF16toASCII(extensions).get());
+
+ NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
+ gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
+ return gnomeInfo.forget();
+diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
+--- a/widget/gtk/moz.build
++++ b/widget/gtk/moz.build
+@@ -146,16 +146,17 @@ FINAL_LIBRARY = "xul"
+
+ LOCAL_INCLUDES += [
+ "/layout/base",
+ "/layout/forms",
+ "/layout/generic",
"/layout/xul",
"/other-licenses/atk-1.0",
"/third_party/cups/include",
+ "/toolkit/xre",
"/widget",
"/widget/headless",
+ "/widget/x11",
]
-Index: firefox-115.0/widget/gtk/nsFilePicker.cpp
-===================================================================
---- firefox-115.0.orig/widget/gtk/nsFilePicker.cpp
-+++ firefox-115.0/widget/gtk/nsFilePicker.cpp
-@@ -5,6 +5,7 @@
+
+ DEFINES["CAIRO_GFX"] = True
+
+ DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"]
+diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
+--- a/widget/gtk/nsFilePicker.cpp
++++ b/widget/gtk/nsFilePicker.cpp
+@@ -1,15 +1,16 @@
+ /* -*- 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 <dlfcn.h>
#include <gtk/gtk.h>
@@ -992,7 +1221,17 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-@@ -28,6 +29,8 @@
+
+ #include "mozilla/Types.h"
+ #include "nsGtkUtils.h"
+ #include "nsIFileURL.h"
+ #include "nsIGIOService.h"
+@@ -23,16 +24,18 @@
+ #include "nsArrayEnumerator.h"
+ #include "nsEnumeratorUtils.h"
+ #include "nsNetUtil.h"
+ #include "nsReadableUtils.h"
+ #include "MozContainer.h"
#include "WidgetUtilsGtk.h"
#include "nsFilePicker.h"
@@ -1001,7 +1240,17 @@
#undef LOG
#ifdef MOZ_LOGGING
-@@ -242,7 +245,8 @@ NS_IMETHODIMP
+ # include "mozilla/Logging.h"
+ # include "nsTArray.h"
+ # include "Units.h"
+ extern mozilla::LazyLogModule gWidgetLog;
+ # define LOG(args) MOZ_LOG(gWidgetLog, mozilla::LogLevel::Debug, args)
+@@ -237,17 +240,18 @@ nsFilePicker::AppendFilters(int32_t aFil
+ mAllowURLs = !!(aFilterMask & filterAllowURLs);
+ return nsBaseFilePicker::AppendFilters(aFilterMask);
+ }
+
+ NS_IMETHODIMP
nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) {
if (aFilter.EqualsLiteral("..apps")) {
// No platform specific thing we can do here, really....
@@ -1011,7 +1260,17 @@
}
nsAutoCString filter, name;
-@@ -352,6 +356,31 @@ nsFilePicker::Open(nsIFilePickerShownCal
+ CopyUTF16toUTF8(aFilter, filter);
+ CopyUTF16toUTF8(aTitle, name);
+
+ mFilters.AppendElement(filter);
+ mFilterNames.AppendElement(name);
+@@ -347,16 +351,41 @@ nsresult nsFilePicker::Show(nsIFilePicke
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP
+ nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
// Can't show two dialogs concurrently with the same filepicker
if (mRunning) return NS_ERROR_NOT_AVAILABLE;
@@ -1043,7 +1302,17 @@
NS_ConvertUTF16toUTF8 title(mTitle);
GtkWindow* parent_widget =
-@@ -633,6 +662,205 @@ void nsFilePicker::Done(void* file_choos
+ GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
+
+ GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
+
+ const gchar* accept_button;
+@@ -628,16 +657,215 @@ void nsFilePicker::Done(void* file_choos
+ mCallback->Done(result);
+ mCallback = nullptr;
+ } else {
+ mResult = result;
+ }
NS_RELEASE_THIS();
}
@@ -1249,11 +1518,20 @@
// All below functions available as of GTK 3.20+
void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent,
GtkFileChooserAction action,
-Index: firefox-115.0/widget/gtk/nsFilePicker.h
-===================================================================
---- firefox-115.0.orig/widget/gtk/nsFilePicker.h
-+++ firefox-115.0/widget/gtk/nsFilePicker.h
-@@ -74,6 +74,12 @@ class nsFilePicker : public nsBaseFilePi
+ const gchar* accept_label) {
+ static auto sGtkFileChooserNativeNewPtr =
+ (void* (*)(const gchar*, GtkWindow*, GtkFileChooserAction, const gchar*,
+ const gchar*))dlsym(RTLD_DEFAULT,
+ "gtk_file_chooser_native_new");
+diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
+--- a/widget/gtk/nsFilePicker.h
++++ b/widget/gtk/nsFilePicker.h
+@@ -69,16 +69,22 @@ class nsFilePicker : public nsBaseFilePi
+ nsString mDefaultExtension;
+
+ nsTArray<nsCString> mFilters;
+ nsTArray<nsCString> mFilterNames;
+
private:
static nsIFile* mPrevDisplayDirectory;
@@ -1266,11 +1544,20 @@
void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
GtkFileChooserAction action,
const gchar* accept_label);
-Index: firefox-115.0/xpcom/components/ManifestParser.cpp
-===================================================================
---- firefox-115.0.orig/xpcom/components/ManifestParser.cpp
-+++ firefox-115.0/xpcom/components/ManifestParser.cpp
-@@ -43,6 +43,7 @@
+ void GtkFileChooserShow(void* file_chooser);
+ void GtkFileChooserDestroy(void* file_chooser);
+ void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget,
+ gboolean modal);
+
+diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
+--- a/xpcom/components/ManifestParser.cpp
++++ b/xpcom/components/ManifestParser.cpp
+@@ -38,16 +38,17 @@
+ #include "nsTextFormatter.h"
+ #include "nsVersionComparator.h"
+ #include "nsXPCOMCIDInternal.h"
+
+ #include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
@@ -1278,7 +1565,17 @@
using namespace mozilla;
-@@ -394,6 +395,7 @@ void ParseManifest(NSLocationType aType,
+ struct ManifestDirective {
+ const char* directive;
+ int argc;
+
+ bool ischrome;
+@@ -389,16 +390,17 @@ void ParseManifest(NSLocationType aType,
+ constexpr auto kRemoteEnabled = u"remoteenabled"_ns;
+ constexpr auto kRemoteRequired = u"remoterequired"_ns;
+ constexpr auto kApplication = u"application"_ns;
+ constexpr auto kAppVersion = u"appversion"_ns;
+ constexpr auto kGeckoVersion = u"platformversion"_ns;
constexpr auto kOs = u"os"_ns;
constexpr auto kOsVersion = u"osversion"_ns;
constexpr auto kABI = u"abi"_ns;
@@ -1286,7 +1583,17 @@
constexpr auto kProcess = u"process"_ns;
#if defined(MOZ_WIDGET_ANDROID)
constexpr auto kTablet = u"tablet"_ns;
-@@ -453,6 +455,7 @@ void ParseManifest(NSLocationType aType,
+ #endif
+ // You might expect this to be guarded by MOZ_BACKGROUNDTASKS, but it's not
+ // possible to have conditional manifest contents, so we need to recognize and
+ // discard these tokens even when MOZ_BACKGROUNDTASKS is not set.
+ constexpr auto kBackgroundTask = u"backgroundtask"_ns;
+@@ -448,39 +450,44 @@ void ParseManifest(NSLocationType aType,
+ CopyUTF8toUTF16(s, abi);
+ abi.Insert(char16_t('_'), 0);
+ abi.Insert(osTarget, 0);
+ }
+ }
}
nsAutoString osVersion;
@@ -1294,7 +1601,8 @@
#if defined(XP_WIN)
# pragma warning(push)
# pragma warning(disable : 4996) // VC12+ deprecates GetVersionEx
-@@ -461,14 +464,17 @@ void ParseManifest(NSLocationType aType,
+ OSVERSIONINFO info = {sizeof(OSVERSIONINFO)};
+ if (GetVersionEx(&info)) {
nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion,
info.dwMinorVersion);
}
@@ -1312,7 +1620,7 @@
#elif defined(MOZ_WIDGET_ANDROID)
bool isTablet = false;
if (jni::IsAvailable()) {
-@@ -476,6 +482,7 @@ void ParseManifest(NSLocationType aType,
+ jni::String::LocalRef release = java::sdk::Build::VERSION::RELEASE();
osVersion.Assign(release->ToString());
isTablet = java::GeckoAppShell::IsTablet();
}
@@ -1320,7 +1628,17 @@
#endif
if (XRE_IsContentProcess()) {
-@@ -576,6 +583,7 @@ void ParseManifest(NSLocationType aType,
+ process = kContent;
+ } else {
+ process = kMain;
+ }
+
+@@ -571,25 +578,27 @@ void ParseManifest(NSLocationType aType,
+ // When in background task mode, default to not registering
+ // category directivies unless backgroundtask=1 is specified.
+ TriState stBackgroundTask = (BackgroundTasks::IsBackgroundTaskMode() &&
+ strcmp("category", directive->directive) == 0)
+ ? eBad
: eUnspecified;
#endif
int flags = 0;
@@ -1328,7 +1646,9 @@
while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
ok) {
-@@ -585,6 +593,7 @@ void ParseManifest(NSLocationType aType,
+ ToLowerCase(token);
+ NS_ConvertASCIItoUTF16 wtoken(token);
+
if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
CheckOsFlag(kOs, wtoken, osTarget, stOs) ||
CheckStringFlag(kABI, wtoken, abi, stABI) ||
@@ -1336,7 +1656,17 @@
CheckStringFlag(kProcess, wtoken, process, stProcess) ||
CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
-@@ -644,6 +653,7 @@ void ParseManifest(NSLocationType aType,
+ CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion,
+ stGeckoVersion)) {
+ continue;
+ }
+
+@@ -639,16 +648,17 @@ void ParseManifest(NSLocationType aType,
+
+ LogMessageWithContext(
+ aFile, line, "Unrecognized chrome manifest modifier '%s'.", token);
+ ok = false;
+ }
if (!ok || stApp == eBad || stAppVersion == eBad ||
stGeckoVersion == eBad || stOs == eBad || stOsVersion == eBad ||
@@ -1344,11 +1674,20 @@
#ifdef MOZ_WIDGET_ANDROID
stTablet == eBad ||
#endif
-Index: firefox-115.0/xpcom/components/moz.build
-===================================================================
---- firefox-115.0.orig/xpcom/components/moz.build
-+++ firefox-115.0/xpcom/components/moz.build
-@@ -71,6 +71,7 @@ LOCAL_INCLUDES += [
+ #ifdef MOZ_BACKGROUNDTASKS
+ stBackgroundTask == eBad ||
+ #endif
+ stABI == eBad || stProcess == eBad) {
+ continue;
+diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
+--- a/xpcom/components/moz.build
++++ b/xpcom/components/moz.build
+@@ -66,16 +66,17 @@ LOCAL_INCLUDES += [
+ "!..",
+ "../base",
+ "../build",
+ "../ds",
+ "/chrome",
"/js/xpconnect/loader",
"/layout/build",
"/modules/libjar",
@@ -1356,11 +1695,20 @@
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
-Index: firefox-115.0/xpcom/io/nsLocalFileUnix.cpp
-===================================================================
---- firefox-115.0.orig/xpcom/io/nsLocalFileUnix.cpp
-+++ firefox-115.0/xpcom/io/nsLocalFileUnix.cpp
-@@ -51,6 +51,7 @@
+ CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
+ if CONFIG["MOZ_ENABLE_DBUS"]:
+ CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
+
+ include("/ipc/chromium/chromium-config.mozbuild")
+diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
+--- a/xpcom/io/nsLocalFileUnix.cpp
++++ b/xpcom/io/nsLocalFileUnix.cpp
+@@ -46,16 +46,17 @@
+ #include "nsString.h"
+ #include "nsIDirectoryEnumerator.h"
+ #include "nsSimpleEnumerator.h"
+ #include "private/pprio.h"
+ #include "prlink.h"
#ifdef MOZ_WIDGET_GTK
# include "nsIGIOService.h"
@@ -1368,7 +1716,17 @@
#endif
#ifdef MOZ_WIDGET_COCOA
-@@ -2172,10 +2173,18 @@ nsLocalFile::Reveal() {
+ # include <Carbon/Carbon.h>
+ # include "CocoaFileUtils.h"
+ # include "prmem.h"
+ # include "plbase64.h"
+
+@@ -2167,20 +2168,28 @@ nsLocalFile::SetPersistentDescriptor(con
+
+ NS_IMETHODIMP
+ nsLocalFile::Reveal() {
+ if (!FilePreferences::IsAllowedPath(mPath)) {
+ return NS_ERROR_FILE_ACCESS_DENIED;
}
#ifdef MOZ_WIDGET_GTK
@@ -1389,7 +1747,17 @@
return giovfs->RevealFile(this);
#elif defined(MOZ_WIDGET_COCOA)
CFURLRef url;
-@@ -2197,6 +2206,13 @@ nsLocalFile::Launch() {
+ if (NS_SUCCEEDED(GetCFURL(&url))) {
+ nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
+ ::CFRelease(url);
+ return rv;
+ }
+@@ -2192,16 +2201,23 @@ nsLocalFile::Reveal() {
+
+ NS_IMETHODIMP
+ nsLocalFile::Launch() {
+ if (!FilePreferences::IsAllowedPath(mPath)) {
+ return NS_ERROR_FILE_ACCESS_DENIED;
}
#ifdef MOZ_WIDGET_GTK
@@ -1403,3 +1771,8 @@
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
if (!giovfs) {
return NS_ERROR_FAILURE;
+ }
+
+ return giovfs->LaunchFile(mPath);
+ #elif defined(MOZ_WIDGET_ANDROID)
+ // Not supported on GeckoView