From 522108f71582df25af909b356e444fb7fffeee77 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Wed, 14 Jan 2026 07:35:45 +0800 Subject: [PATCH] ported from UXP: Issue #1636 - Part 1 - Decouple Gio from GConf and always build it with GTK (fc78eec9) --- build/moz.configure/old.configure | 2 - config/system-headers | 2 - image/decoders/icon/gtk/moz.build | 5 +- image/decoders/icon/gtk/nsIconChannel.cpp | 8 -- netwerk/base/nsIOService.cpp | 2 +- .../protocol}/gio/moz.build | 2 +- .../protocol}/gio/nsGIOProtocolHandler.cpp | 0 old-configure.in | 81 ------------------- .../downloads/nsDownloadManager.cpp | 4 +- .../jsdownloads/src/DownloadPlatform.cpp | 4 +- toolkit/moz.configure | 11 +-- toolkit/system/gnome/moz.build | 16 ++-- toolkit/system/gnome/nsGnomeModule.cpp | 8 -- toolkit/toolkit.mozbuild | 3 - 14 files changed, 19 insertions(+), 129 deletions(-) rename {extensions => netwerk/protocol}/gio/moz.build (90%) rename {extensions => netwerk/protocol}/gio/nsGIOProtocolHandler.cpp (100%) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index da09add83..ac1ee2500 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -188,8 +188,6 @@ def old_configure_options(*options): '--enable-gamepad', '--enable-gconf', '--enable-gczeal', - '--enable-gio', - '--enable-gnomeui', '--enable-gold', '--enable-hardware-aec-ns', '--enable-icf', diff --git a/config/system-headers b/config/system-headers index 13a1c3e95..a0a65db81 100644 --- a/config/system-headers +++ b/config/system-headers @@ -1274,9 +1274,7 @@ hunspell.hxx #if MOZ_SYSTEM_BZ2==1 bzlib.h #endif -#ifdef MOZ_ENABLE_GIO gio/gio.h -#endif #if MOZ_SYSTEM_LIBEVENT==1 event.h #else diff --git a/image/decoders/icon/gtk/moz.build b/image/decoders/icon/gtk/moz.build index a8116ca87..2992bb904 100644 --- a/image/decoders/icon/gtk/moz.build +++ b/image/decoders/icon/gtk/moz.build @@ -10,7 +10,4 @@ SOURCES += [ FINAL_LIBRARY = 'xul' -if CONFIG['MOZ_ENABLE_GNOMEUI']: - CXXFLAGS += CONFIG['MOZ_GNOMEUI_CFLAGS'] -else: - CXXFLAGS += CONFIG['TK_CFLAGS'] +CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/image/decoders/icon/gtk/nsIconChannel.cpp b/image/decoders/icon/gtk/nsIconChannel.cpp index 020f19c99..42c50795f 100644 --- a/image/decoders/icon/gtk/nsIconChannel.cpp +++ b/image/decoders/icon/gtk/nsIconChannel.cpp @@ -11,9 +11,7 @@ #include "mozilla/EndianUtils.h" #include -#ifdef MOZ_ENABLE_GIO #include -#endif #include @@ -166,7 +164,6 @@ moz_gtk_icon_size(const char* name) return GTK_ICON_SIZE_MENU; } -#ifdef MOZ_ENABLE_GIO static int32_t GetIconSize(nsIMozIconURI* aIconURI) { @@ -300,7 +297,6 @@ nsIconChannel::InitWithGIO(nsIMozIconURI* aIconURI) g_object_unref(buf); return rv; } -#endif // MOZ_ENABLE_GIO nsresult nsIconChannel::Init(nsIURI* aURI) @@ -311,11 +307,7 @@ nsIconChannel::Init(nsIURI* aURI) nsAutoCString stockIcon; iconURI->GetStockIcon(stockIcon); if (stockIcon.IsEmpty()) { -#ifdef MOZ_ENABLE_GIO return InitWithGIO(iconURI); -#else - return NS_ERROR_NOT_AVAILABLE; -#endif } // Search for stockIcon diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 4207ec5a5..0792d9b97 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -562,7 +562,7 @@ nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result) return rv; } -#ifdef MOZ_ENABLE_GIO +#ifdef MOZ_WIDGET_GTK // check to see whether GVFS can handle this URI scheme. if it can // create a nsIURI for the "scheme:", then we assume it has support for // the requested protocol. otherwise, we failover to using the default diff --git a/extensions/gio/moz.build b/netwerk/protocol/gio/moz.build similarity index 90% rename from extensions/gio/moz.build rename to netwerk/protocol/gio/moz.build index 94828f809..a2d0c548a 100644 --- a/extensions/gio/moz.build +++ b/netwerk/protocol/gio/moz.build @@ -10,4 +10,4 @@ SOURCES += [ FINAL_LIBRARY = 'xul' -CXXFLAGS += CONFIG['MOZ_GIO_CFLAGS'] +CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp similarity index 100% rename from extensions/gio/nsGIOProtocolHandler.cpp rename to netwerk/protocol/gio/nsGIOProtocolHandler.cpp diff --git a/old-configure.in b/old-configure.in index 205d9c7e3..1c7e49892 100644 --- a/old-configure.in +++ b/old-configure.in @@ -57,14 +57,12 @@ GLIB_VERSION=2.22 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED. # The macro won't be used when compiling with earlier versions anyway. GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -GIO_VERSION=2.22 CAIRO_VERSION=1.10 GTK2_VERSION=2.18.0 GTK3_VERSION=3.4.0 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4 WINDRES_VERSION=2.14.90 W32API_VERSION=3.14 -GNOMEUI_VERSION=2.2.0 GCONF_VERSION=1.2.1 STARTUP_NOTIFICATION_VERSION=0.8 DBUS_VERSION=0.60 @@ -2592,44 +2590,11 @@ dnl ======================================================== if test "$MOZ_X11" then - dnl build the GIO extension by default only when the - dnl GTK2 toolkit is in use. if test "$MOZ_ENABLE_GTK" then - MOZ_ENABLE_GIO=1 MOZ_ENABLE_GCONF=1 fi - dnl ======================================================== - dnl = GIO support module - dnl ======================================================== - MOZ_ARG_DISABLE_BOOL(gio, - [ --disable-gio Disable GIO support], - MOZ_ENABLE_GIO=, - MOZ_ENABLE_GIO=force) - - if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK" - then - if test "$MOZ_WIDGET_TOOLKIT" = gtk2 - then - PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, , - [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])]) - fi - PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[ - MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'` - MOZ_ENABLE_GIO=1 - AC_DEFINE(MOZ_ENABLE_GIO) - ],[ - if test "$MOZ_ENABLE_GIO" = "force" - then - AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION]) - fi - MOZ_ENABLE_GIO= - ]) - fi - - AC_SUBST(MOZ_ENABLE_GIO) - dnl ======================================================== dnl = GConf support module dnl ======================================================== @@ -2681,38 +2646,6 @@ then fi AC_SUBST(MOZ_ENABLE_LIBPROXY) -dnl ======================================================== -dnl = libgnomeui support module -dnl ======================================================== - -if test "$MOZ_ENABLE_GTK" -then - MOZ_ARG_ENABLE_BOOL(gnomeui, - [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ], - MOZ_ENABLE_GNOMEUI=force, - MOZ_ENABLE_GNOMEUI=) - - if test "$MOZ_ENABLE_GNOMEUI" - then - PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION, - [ - MOZ_ENABLE_GNOMEUI=1 - ],[ - if test "$MOZ_ENABLE_GNOMEUI" = "force" - then - AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION]) - fi - MOZ_ENABLE_GNOMEUI= - ]) - fi - - if test "$MOZ_ENABLE_GNOMEUI"; then - AC_DEFINE(MOZ_ENABLE_GNOMEUI) - fi -fi - -AC_SUBST(MOZ_ENABLE_GNOMEUI) - dnl ======================================================== dnl = dbus support dnl ======================================================== @@ -3793,20 +3726,6 @@ MOZ_ARG_ENABLE_STRING(extensions, done], MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT") -if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then - # Suppress warning on non-X11 platforms - if test -n "$MOZ_X11"; then - AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.]) - fi - MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'` -fi - -if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then - MOZ_GIO_COMPONENT=1 - MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'` -fi -AC_SUBST(MOZ_GIO_COMPONENT) - dnl Ensure every extension exists, to avoid mostly-inscrutable error messages dnl when trying to build a nonexistent extension. for extension in $MOZ_EXTENSIONS; do diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index 196366d04..4be873683 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -2651,7 +2651,7 @@ NS_IMETHODIMP nsDownload::SetRedirects(nsIArray* aRedirects) { return NS_OK; } -#ifdef MOZ_ENABLE_GIO +#ifdef MOZ_WIDGET_GTK static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data) { GError *err = nullptr; @@ -2820,7 +2820,7 @@ nsDownload::SetState(DownloadState aState) #endif } #endif -#ifdef MOZ_ENABLE_GIO +#ifdef MOZ_WIDGET_GTK // Use GIO to store the source URI for later display in the file manager. GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get()); nsCString source_uri; diff --git a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp index 1506b7c30..66601c5cb 100644 --- a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp +++ b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp @@ -59,7 +59,7 @@ DownloadPlatform* DownloadPlatform::GetDownloadPlatform() return gDownloadPlatformService; } -#ifdef MOZ_ENABLE_GIO +#ifdef MOZ_WIDGET_GTK static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data) { GError *err = nullptr; @@ -131,7 +131,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIF #endif } #endif -#ifdef MOZ_ENABLE_GIO +#ifdef MOZ_WIDGET_GTK // Use GIO to store the source URI for later display in the file manager. GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get()); nsCString source_uri; diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 64229829f..36703c896 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -113,8 +113,8 @@ option('--enable-default-toolkit', nargs=1, 'cairo-cocoa', 'cairo-uikit', 'cairo-android', 'cairo-gonk'), help='Select default toolkit') -@depends('--enable-default-toolkit', target) -def toolkit(value, target): +@depends('--enable-default-toolkit', target, '--help') +def toolkit(value, target, _): # Define possible choices for each platform. The default is the first one # listed when there are several. os = target.os @@ -514,13 +514,14 @@ include('nss.configure') # Network protocol support # ============================================================== -@depends(check_build_environment, '--help') +@depends(check_build_environment, toolkit_gtk, '--help') @imports('os') @imports(_from='__builtin__', _import='sorted') -def all_necko_protocols(build_env, _): +def all_necko_protocols(build_env, toolkit_gtk, _): basedir = os.path.join(build_env.topsrcdir, 'netwerk', 'protocol') return tuple(sorted(p for p in os.listdir(basedir) - if os.path.isdir(os.path.join(basedir, p)))) + if (os.path.isdir(os.path.join(basedir, p)) and + (p != 'gio' or toolkit_gtk)))) default_necko_protocols = all_necko_protocols diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build index 14b472be3..68214338f 100644 --- a/toolkit/system/gnome/moz.build +++ b/toolkit/system/gnome/moz.build @@ -15,12 +15,11 @@ if CONFIG['MOZ_ENABLE_GCONF']: 'nsGConfService.cpp', ] -if CONFIG['MOZ_ENABLE_GIO']: - SOURCES += [ - 'nsGIOService.cpp', - 'nsGSettingsService.cpp', - 'nsPackageKitService.cpp' - ] +SOURCES += [ + 'nsGIOService.cpp', + 'nsGSettingsService.cpp', + 'nsPackageKitService.cpp' +] FINAL_LIBRARY = 'xul' @@ -29,9 +28,6 @@ LOCAL_INCLUDES += [ ] CXXFLAGS += CONFIG['MOZ_GCONF_CFLAGS'] -CXXFLAGS += CONFIG['MOZ_GIO_CFLAGS'] CXXFLAGS += CONFIG['GLIB_CFLAGS'] CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS'] - -if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: - CXXFLAGS += CONFIG['TK_CFLAGS'] +CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/toolkit/system/gnome/nsGnomeModule.cpp b/toolkit/system/gnome/nsGnomeModule.cpp index 6ecebcc1f..12af5bd70 100644 --- a/toolkit/system/gnome/nsGnomeModule.cpp +++ b/toolkit/system/gnome/nsGnomeModule.cpp @@ -12,36 +12,30 @@ #include "nsGConfService.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init) #endif -#ifdef MOZ_ENABLE_GIO #include "nsGIOService.h" #include "nsGSettingsService.h" #include "nsPackageKitService.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPackageKitService, Init) -#endif #include "nsSystemAlertsService.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init) #ifdef MOZ_ENABLE_GCONF NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID); #endif -#ifdef MOZ_ENABLE_GIO NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID); NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID); NS_DEFINE_NAMED_CID(NS_PACKAGEKITSERVICE_CID); -#endif NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID); static const mozilla::Module::CIDEntry kGnomeCIDs[] = { #ifdef MOZ_ENABLE_GCONF { &kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor }, #endif -#ifdef MOZ_ENABLE_GIO { &kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor }, { &kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor }, { &kNS_PACKAGEKITSERVICE_CID, false, nullptr, nsPackageKitServiceConstructor }, -#endif { &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, nsSystemAlertsServiceConstructor }, { nullptr } }; @@ -50,11 +44,9 @@ static const mozilla::Module::ContractIDEntry kGnomeContracts[] = { #ifdef MOZ_ENABLE_GCONF { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID }, #endif -#ifdef MOZ_ENABLE_GIO { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID }, { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID }, { NS_PACKAGEKITSERVICE_CONTRACTID, &kNS_PACKAGEKITSERVICE_CID }, -#endif { NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID }, { nullptr } }; diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild index bbd7ee2ef..5ad252f8b 100644 --- a/toolkit/toolkit.mozbuild +++ b/toolkit/toolkit.mozbuild @@ -141,9 +141,6 @@ DIRS += [ '/other-licenses/snappy', ] -if CONFIG['MOZ_GIO_COMPONENT']: - DIRS += ['/extensions/gio'] - DIRS += [ '/toolkit/library/StaticXULComponentsEnd', '/toolkit/library',