diff -r 78bbadb03249 -r 954851a35787 mozilla-kde.patch --- a/mozilla-kde.patch Fri Oct 13 11:06:11 2023 +0200 +++ b/mozilla-kde.patch Wed Oct 25 11:49:20 2023 +0200 @@ -1,24 +1,57 @@ -# HG changeset patch -# User msirringhaus@suse.de -# Date 1559294891 -7200 -# Fri May 31 11:28:11 2019 +0200 -# Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112 -# Parent eaadcfc5cb5ee0eed248051a657a69646334aad7 -Description: Add KDE integration to Firefox (toolkit parts) -Author: Wolfgang Rosenauer -Author: Lubos Lunak +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Wolfgang Rosenauer +Date: Tue, 8 Aug 2023 16:13:48 +0300 +Subject: [PATCH] Add KDE integration to Firefox (toolkit parts) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 - https://bugzilla.novell.com/show_bug.cgi?id=170055 +Bug: https://bugzilla.suse.com/show_bug.cgi?id=170055 + +EDIT: Björn Bidar: Removed handling for obsolete special files + +Co-authored-by: Wolfgang Rosenauer +Co-authored-by: Lubos Lunak +Co-authored-by: Björn Bidar +--- + modules/libpref/Preferences.cpp | 1 + + modules/libpref/moz.build | 4 + + python/mozbuild/mozpack/chrome/flags.py | 1 + + python/mozbuild/mozpack/chrome/manifest.py | 1 + + toolkit/components/downloads/moz.build | 4 + + .../mozapps/downloads/HelperAppDlg.sys.mjs | 70 +++-- + .../unixproxy/nsUnixSystemProxySettings.cpp | 29 ++ + toolkit/xre/moz.build | 2 + + toolkit/xre/nsKDEUtils.cpp | 286 ++++++++++++++++++ + toolkit/xre/nsKDEUtils.h | 53 ++++ + uriloader/exthandler/HandlerServiceParent.cpp | 6 +- + uriloader/exthandler/moz.build | 3 + + .../exthandler/unix/nsCommonRegistry.cpp | 42 +++ + uriloader/exthandler/unix/nsCommonRegistry.h | 28 ++ + uriloader/exthandler/unix/nsKDERegistry.cpp | 75 +++++ + uriloader/exthandler/unix/nsKDERegistry.h | 35 +++ + uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 28 +- + .../exthandler/unix/nsOSHelperAppService.cpp | 10 +- + widget/gtk/moz.build | 1 + + widget/gtk/nsFilePicker.cpp | 230 +++++++++++++- + widget/gtk/nsFilePicker.h | 6 + + xpcom/components/ManifestParser.cpp | 10 + + xpcom/components/moz.build | 1 + + xpcom/io/nsLocalFileUnix.cpp | 20 +- + 24 files changed, 910 insertions(+), 36 deletions(-) + create mode 100644 toolkit/xre/nsKDEUtils.cpp + create mode 100644 toolkit/xre/nsKDEUtils.h + create mode 100644 uriloader/exthandler/unix/nsCommonRegistry.cpp + create mode 100644 uriloader/exthandler/unix/nsCommonRegistry.h + create mode 100644 uriloader/exthandler/unix/nsKDERegistry.cpp + create mode 100644 uriloader/exthandler/unix/nsKDERegistry.h diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp +index 94a5aa0f3f169563d570e18fc1a525994293ad99..c1cf316d05b742502f7b07da1b7f25024b09f4e8 100644 --- 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" +@@ -95,6 +95,7 @@ #ifdef MOZ_BACKGROUNDTASKS # include "mozilla/BackgroundTasks.h" #endif @@ -26,66 +59,11 @@ #ifdef DEBUG # include - #endif - - #ifdef MOZ_MEMORY - # include "mozmemory.h" - #endif -@@ -4901,16 +4902,26 @@ nsresult Preferences::InitInitialObjects - "unix.js" - # if defined(_AIX) - , - "aix.js" - # endif - #endif - }; - -+ if (nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires -+ // the helper? -+ for (int i = 0; i < MOZ_ARRAY_LENGTH(specialFiles); ++i) { -+ if (*specialFiles[i] == '\0') { -+ specialFiles[i] = "kde.js"; -+ break; -+ } -+ } -+ } -+ - rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, - ArrayLength(specialFiles)); - if (NS_FAILED(rv)) { - 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 path = do_QueryInterface(elem); - if (!path) { - continue; - } - - // Do we care if a file provided by this process fails to load? -- pref_LoadPrefsInDir(path, nullptr, 0); -+ pref_LoadPrefsInDir(path, specialFiles, ArrayLength(specialFiles)); - } - } - - #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 +index e8f8b97170d32c1d3ac342dd93da7265bf707c8f..831001cee4b1eb33171d83d524ee9e453a800257 100644 --- 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", +@@ -126,6 +126,10 @@ UNIFIED_SOURCES += [ "SharedPrefMap.cpp", ] @@ -96,20 +74,11 @@ gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs) GeneratedFile( - *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 +index 6b096c862aaac5e02d9d7dacda42d9321d5e89cc..2b46d9294b93fda17117e9c84b240c52f96c9b74 100644 --- 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, +@@ -234,6 +234,7 @@ class Flags(OrderedDict): "tablet": Flag, "process": StringFlag, "backgroundtask": StringFlag, @@ -117,20 +86,11 @@ } RE = re.compile(r"([!<>=]+)") - 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 +index 14c11d4c1daa8cbb03abf3cd2e1a7b60a981abc8..41b9969e7277fa2400f299863c83145342cd7b43 100644 --- 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", +@@ -43,6 +43,7 @@ class ManifestEntry(object): "process", "contentaccessible", "backgroundtask", @@ -138,20 +98,11 @@ ] def __init__(self, base, *flags): - """ - 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 +index 3818e8c0db1ed3cfc068d89b18b1fe2f1bf750a9..b70986db811191952919531cfb79e04b801491a2 100644 --- 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", - ] +@@ -51,5 +51,9 @@ if CONFIG["MOZ_PLACES"]: FINAL_LIBRARY = "xul" @@ -162,14 +113,10 @@ with Files("**"): BUG_COMPONENT = ("Toolkit", "Downloads API") diff --git a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs +index 66f77d38e4ed7b3802303194e8df675a5db81272..f8839c446683620d6df6c6eb2ea0a0ca3549af95 100644 --- 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. +@@ -1246,26 +1246,56 @@ nsUnknownContentTypeDialog.prototype = { this.chosenApp = params.handlerApp; } } else if ("@mozilla.org/applicationchooser;1" in Cc) { @@ -246,20 +193,11 @@ } else { var nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); - 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 +index 185dc1e22a903cec95b212d1713dddf764b9b198..bdb4ed6f9f86583d02dd80278f858d064584f82a 100644 --- 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" +@@ -16,6 +16,8 @@ #include "nsISupportsPrimitives.h" #include "nsIGSettingsService.h" #include "nsReadableUtils.h" @@ -268,17 +206,7 @@ using namespace mozilla; - class nsUnixSystemProxySettings final : public nsISystemProxySettings { - public: - NS_DECL_ISUPPORTS - NS_DECL_NSISYSTEMPROXYSETTINGS - -@@ -34,16 +36,18 @@ class nsUnixSystemProxySettings final : - nsCOMPtr mProxySettings; - nsInterfaceHashtable - mSchemeProxySettings; - nsresult GetProxyFromGSettings(const nsACString& aScheme, - const nsACString& aHost, int32_t aPort, +@@ -39,6 +41,8 @@ class nsUnixSystemProxySettings final : public nsISystemProxySettings { nsACString& aResult); nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult); @@ -287,17 +215,7 @@ }; NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings) - - 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, +@@ -397,6 +401,9 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec, const nsACString& aHost, const int32_t aPort, nsACString& aResult) { @@ -307,8 +225,7 @@ if (mProxySettings) { nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult); if (NS_SUCCEEDED(rv)) return rv; - } - +@@ -405,6 +412,28 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec, return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult); } @@ -337,17 +254,11 @@ NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) { auto result = MakeRefPtr(); result->Init(); - return result.forget().downcast(); - } diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build +index de05e0cc29752855138b4d189ce6a13c2121d715..c89faad7bfca4ab1d60390766b2e7befd9e3831d 100644 --- 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", +@@ -96,7 +96,9 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": "UIKitDirProvider.mm", ] elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": @@ -357,13 +268,9 @@ "nsNativeAppSupportUnix.cpp", ] CXXFLAGS += CONFIG["MOZ_X11_SM_CFLAGS"] - else: - UNIFIED_SOURCES += [ - "nsNativeAppSupportDefault.cpp", - ] - diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp new file mode 100644 +index 0000000000000000000000000000000000000000..e282de40618e0be06a4247891d9ab1a26cba2126 --- /dev/null +++ b/toolkit/xre/nsKDEUtils.cpp @@ -0,0 +1,286 @@ @@ -655,6 +562,7 @@ +} diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h new file mode 100644 +index 0000000000000000000000000000000000000000..7fa6eb8e83b32c8e2c62a0035d253e06e135e3d2 --- /dev/null +++ b/toolkit/xre/nsKDEUtils.h @@ -0,0 +1,53 @@ @@ -712,14 +620,10 @@ + +#endif // nsKDEUtils diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp +index ab77657dd5f378af0955c43ef958a8abea620134..18b4d85560699bbc3c69b82ee91dfb5cbe700e7b 100644 --- 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" +@@ -18,7 +18,7 @@ #include "nsComponentManagerUtils.h" #include "nsServiceManagerUtils.h" #ifdef MOZ_WIDGET_GTK @@ -728,17 +632,7 @@ #endif using mozilla::dom::ContentHandlerService; - 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(); +@@ -310,8 +310,8 @@ mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS( } #ifdef MOZ_WIDGET_GTK // Check the GNOME registry for a protocol handler @@ -749,20 +643,11 @@ #else *aHandlerExists = false; #endif - 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 +index 0fb126a7f3f7a45d53e6fb81aef74147c711cb77..8cc0006f3045e14e83fd51926ac7856eacbe7357 100644 --- 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", - ] +@@ -86,7 +86,9 @@ else: if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": UNIFIED_SOURCES += [ @@ -772,17 +657,7 @@ "unix/nsMIMEInfoUnix.cpp", ] elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": - 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", +@@ -134,6 +136,7 @@ LOCAL_INCLUDES += [ "/dom/ipc", "/netwerk/base", "/netwerk/protocol/http", @@ -790,13 +665,9 @@ ] if CONFIG["MOZ_ENABLE_DBUS"]: - 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 +index 0000000000000000000000000000000000000000..3371a756e2c240bfe5fe31ef0ee9c393368dab60 --- /dev/null +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp @@ -0,0 +1,42 @@ @@ -844,6 +715,7 @@ +} diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h new file mode 100644 +index 0000000000000000000000000000000000000000..075413e2fbb165862956c7753a750bfdfb5d389b --- /dev/null +++ b/uriloader/exthandler/unix/nsCommonRegistry.h @@ -0,0 +1,28 @@ @@ -877,6 +749,7 @@ +#endif diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp new file mode 100644 +index 0000000000000000000000000000000000000000..082035566f0b82c14f866c2fbed34c0884f27d34 --- /dev/null +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp @@ -0,0 +1,75 @@ @@ -957,6 +830,7 @@ +} diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h new file mode 100644 +index 0000000000000000000000000000000000000000..c6a41b331b2b5ead6142171f08d8b8a7872ca516 --- /dev/null +++ b/uriloader/exthandler/unix/nsKDERegistry.h @@ -0,0 +1,35 @@ @@ -996,13 +870,10 @@ + +#endif // nsKDERegistry_h__ diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +index 330c4411597f1a19105601e256a2c3bc71c61780..c96c1f3ca5a05c3b6bce321d7a975aa040865fa8 100644 --- 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 +@@ -5,16 +5,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsMIMEInfoUnix.h" @@ -1024,14 +895,7 @@ } NS_IMETHODIMP - 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); - } - +@@ -29,15 +32,15 @@ nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) { *_retval = false; if (mClass == eProtocolInfo) { @@ -1050,17 +914,7 @@ } } if (mimeInfo) *_retval = true; - } - - 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); - } - +@@ -59,6 +62,21 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile* aFile) { nsAutoCString nativePath; aFile->GetNativePath(nativePath); @@ -1082,20 +936,11 @@ nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); if (!giovfs) { return NS_ERROR_FAILURE; - } - - // nsGIOMimeApp->Launch wants a URI string instead of local file - nsresult rv; - nsCOMPtr ioservice = diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp +index 7f6eaa46f2ee0d5155b83bfb07d8040584935772..f7627e790c47e1ae007b072b4bb47b18de1ae417 100644 --- 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 - #include - +@@ -10,7 +10,7 @@ #include "nsOSHelperAppService.h" #include "nsMIMEInfoUnix.h" #ifdef MOZ_WIDGET_GTK @@ -1104,17 +949,7 @@ # ifdef MOZ_BUILD_APP_IS_BROWSER # include "nsIToolkitShellService.h" # include "nsIGNOMEShellService.h" - # 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; - +@@ -1106,7 +1106,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists( if (!XRE_IsContentProcess()) { #ifdef MOZ_WIDGET_GTK // Check the GNOME registry for a protocol handler @@ -1123,17 +958,7 @@ #else *aHandlerExists = false; #endif - } else { - *aHandlerExists = false; - nsCOMPtr handlerSvc = - do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv) && handlerSvc) { -@@ -1121,17 +1121,17 @@ nsresult nsOSHelperAppService::OSProtoco - } - - return rv; - } - +@@ -1126,7 +1126,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists( NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription( const nsACString& aScheme, nsAString& _retval) { #ifdef MOZ_WIDGET_GTK @@ -1142,17 +967,7 @@ return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK; #else return NS_ERROR_NOT_AVAILABLE; - #endif - } - - NS_IMETHODIMP nsOSHelperAppService::IsCurrentAppOSDefaultForProtocol( - const nsACString& aScheme, bool* _retval) { -@@ -1226,17 +1226,17 @@ already_AddRefed nsOSHel - nsresult rv = - LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType, - minorType, mime_types_description, true); - - if (NS_FAILED(rv) || majorType.IsEmpty()) { +@@ -1231,7 +1231,7 @@ already_AddRefed nsOSHelperAppService::GetFromExtension( #ifdef MOZ_WIDGET_GTK LOG("Looking in GNOME registry\n"); RefPtr gnomeInfo = @@ -1161,17 +976,7 @@ if (gnomeInfo) { LOG("Got MIMEInfo from GNOME registry\n"); return gnomeInfo.forget(); - } - #endif - - rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType, - minorType, mime_types_description, false); -@@ -1339,17 +1339,17 @@ already_AddRefed nsOSHel - - // Now look up our extensions - nsAutoString extensions, mime_types_description; - LookUpExtensionsAndDescription(majorType, minorType, extensions, - mime_types_description); +@@ -1344,7 +1344,7 @@ already_AddRefed nsOSHelperAppService::GetFromType( #ifdef MOZ_WIDGET_GTK if (handler.IsEmpty()) { @@ -1180,20 +985,11 @@ if (gnomeInfo) { LOG("Got MIMEInfo from GNOME registry without extensions; setting them " "to %s\n", - 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 +index c6a765df9e5a4c95f77e9ee1b4ebbf9913a81e15..6e9028169ac594a24f90a4f58dc493c8332c6bf8 100644 --- 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", +@@ -161,6 +161,7 @@ LOCAL_INCLUDES += [ "/layout/xul", "/other-licenses/atk-1.0", "/third_party/cups/include", @@ -1201,19 +997,11 @@ "/widget", "/widget/headless", "/widget/x11", - ] - - 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 +index 22d0f46b9563734c7afb4292417124f3cd171a12..b2a68711eb344d5ac41a7133751b2c19d574f532 100644 --- 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/. */ +@@ -5,6 +5,7 @@ #include #include @@ -1221,17 +1009,7 @@ #include #include #include - - #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" +@@ -28,6 +29,8 @@ #include "WidgetUtilsGtk.h" #include "nsFilePicker.h" @@ -1240,17 +1018,7 @@ #undef LOG #ifdef MOZ_LOGGING - # 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 +@@ -242,7 +245,8 @@ NS_IMETHODIMP nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) { if (aFilter.EqualsLiteral("..apps")) { // No platform specific thing we can do here, really.... @@ -1260,17 +1028,7 @@ } nsAutoCString filter, name; - 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) { +@@ -352,6 +356,31 @@ nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) { // Can't show two dialogs concurrently with the same filepicker if (mRunning) return NS_ERROR_NOT_AVAILABLE; @@ -1302,17 +1060,7 @@ NS_ConvertUTF16toUTF8 title(mTitle); GtkWindow* parent_widget = - 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; - } +@@ -633,6 +662,205 @@ void nsFilePicker::Done(void* file_chooser, gint response) { NS_RELEASE_THIS(); } @@ -1518,20 +1266,11 @@ // All below functions available as of GTK 3.20+ void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent, GtkFileChooserAction action, - 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 +index 496df4937277d96485376176296ee836aa261ec7..a4c1862ec042f4465d53bc95f138afb87260ba07 100644 --- a/widget/gtk/nsFilePicker.h +++ b/widget/gtk/nsFilePicker.h -@@ -69,16 +69,22 @@ class nsFilePicker : public nsBaseFilePi - nsString mDefaultExtension; - - nsTArray mFilters; - nsTArray mFilterNames; - +@@ -74,6 +74,12 @@ class nsFilePicker : public nsBaseFilePicker { private: static nsIFile* mPrevDisplayDirectory; @@ -1544,20 +1283,11 @@ void* GtkFileChooserNew(const gchar* title, GtkWindow* parent, GtkFileChooserAction action, const gchar* accept_label); - 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 +index 88ee06d78db60a84343fd3d23c16e163aead37c3..834d6a2d353cc1bd11916de8a28f5d05a86d9031 100644 --- 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" +@@ -43,6 +43,7 @@ #include "nsIScriptError.h" #include "nsIXULAppInfo.h" #include "nsIXULRuntime.h" @@ -1565,17 +1295,7 @@ using namespace mozilla; - 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; +@@ -394,6 +395,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, constexpr auto kOs = u"os"_ns; constexpr auto kOsVersion = u"osversion"_ns; constexpr auto kABI = u"abi"_ns; @@ -1583,17 +1303,7 @@ constexpr auto kProcess = u"process"_ns; #if defined(MOZ_WIDGET_ANDROID) constexpr auto kTablet = u"tablet"_ns; - #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); - } - } +@@ -453,6 +455,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, } nsAutoString osVersion; @@ -1601,8 +1311,7 @@ #if defined(XP_WIN) # pragma warning(push) # pragma warning(disable : 4996) // VC12+ deprecates GetVersionEx - OSVERSIONINFO info = {sizeof(OSVERSIONINFO)}; - if (GetVersionEx(&info)) { +@@ -461,14 +464,17 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion, info.dwMinorVersion); } @@ -1620,7 +1329,7 @@ #elif defined(MOZ_WIDGET_ANDROID) bool isTablet = false; if (jni::IsAvailable()) { - jni::String::LocalRef release = java::sdk::Build::VERSION::RELEASE(); +@@ -476,6 +482,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, osVersion.Assign(release->ToString()); isTablet = java::GeckoAppShell::IsTablet(); } @@ -1628,17 +1337,7 @@ #endif if (XRE_IsContentProcess()) { - 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 +@@ -576,6 +583,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, : eUnspecified; #endif int flags = 0; @@ -1646,9 +1345,7 @@ while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) { - ToLowerCase(token); - NS_ConvertASCIItoUTF16 wtoken(token); - +@@ -585,6 +593,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, if (CheckStringFlag(kApplication, wtoken, appID, stApp) || CheckOsFlag(kOs, wtoken, osTarget, stOs) || CheckStringFlag(kABI, wtoken, abi, stABI) || @@ -1656,17 +1353,7 @@ CheckStringFlag(kProcess, wtoken, process, stProcess) || CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) || CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) || - 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; - } +@@ -644,6 +653,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, if (!ok || stApp == eBad || stAppVersion == eBad || stGeckoVersion == eBad || stOs == eBad || stOsVersion == eBad || @@ -1674,20 +1361,11 @@ #ifdef MOZ_WIDGET_ANDROID stTablet == eBad || #endif - #ifdef MOZ_BACKGROUNDTASKS - stBackgroundTask == eBad || - #endif - stABI == eBad || stProcess == eBad) { - continue; diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build +index 95ee64e985ac34dd6a3191f1948afa6d05adcb73..9af8f80497b7390b7ca434b6ee3b86b2baf47489 100644 --- a/xpcom/components/moz.build +++ b/xpcom/components/moz.build -@@ -66,16 +66,17 @@ LOCAL_INCLUDES += [ - "!..", - "../base", - "../build", - "../ds", - "/chrome", +@@ -71,6 +71,7 @@ LOCAL_INCLUDES += [ "/js/xpconnect/loader", "/layout/build", "/modules/libjar", @@ -1695,20 +1373,11 @@ ] if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - 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 +index 08c77360de6fdbf3dc579ea49243dbdc18f37ebc..eedd5bcf86bde3ecd795bbbcbf94799f19135323 100644 --- 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" +@@ -51,6 +51,7 @@ #ifdef MOZ_WIDGET_GTK # include "nsIGIOService.h" @@ -1716,17 +1385,7 @@ #endif #ifdef MOZ_WIDGET_COCOA - # include - # 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; +@@ -2172,10 +2173,18 @@ nsLocalFile::Reveal() { } #ifdef MOZ_WIDGET_GTK @@ -1747,17 +1406,7 @@ return giovfs->RevealFile(this); #elif defined(MOZ_WIDGET_COCOA) CFURLRef url; - 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; +@@ -2197,6 +2206,13 @@ nsLocalFile::Launch() { } #ifdef MOZ_WIDGET_GTK @@ -1771,8 +1420,3 @@ nsCOMPtr 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