diff --git a/intl/locale/LocaleService.cpp b/intl/locale/LocaleService.cpp index 4ff18a1a90c4a..1527f2791037d 100644 --- a/intl/locale/LocaleService.cpp +++ b/intl/locale/LocaleService.cpp @@ -23,6 +23,9 @@ #ifdef XP_WIN # include "WinUtils.h" #endif +#ifdef MOZ_WIDGET_GTK +# include "mozilla/WidgetUtilsGtk.h" +#endif #define INTL_SYSTEM_LOCALES_CHANGED "intl:system-locales-changed" @@ -69,6 +72,8 @@ static void ReadRequestedLocales(nsTArray& aRetVal) { const bool isRepack = #ifdef XP_WIN !mozilla::widget::WinUtils::HasPackageIdentity(); +#elif defined(MOZ_WIDGET_GTK) + !widget::IsRunningUnderSnap(); #else true; #endif diff --git a/toolkit/profile/xpcshell/head.js b/toolkit/profile/xpcshell/head.js index 547489b5d8a22..12bcbe4a35c95 100644 --- a/toolkit/profile/xpcshell/head.js +++ b/toolkit/profile/xpcshell/head.js @@ -67,7 +67,7 @@ function simulateSnapEnvironment() { let env = Cc["@mozilla.org/process/environment;1"].getService( Ci.nsIEnvironment ); - env.set("SNAP_NAME", AppConstants.MOZ_APP_NAME); + env.set("SNAP_INSTANCE_NAME", AppConstants.MOZ_APP_NAME); gIsLegacy = true; } diff --git a/widget/gtk/WidgetUtilsGtk.cpp b/widget/gtk/WidgetUtilsGtk.cpp index 21ae3863cdfb8..3e70c42973448 100644 --- a/widget/gtk/WidgetUtilsGtk.cpp +++ b/widget/gtk/WidgetUtilsGtk.cpp @@ -105,6 +105,8 @@ void SetLastMousePressEvent(GdkEvent* aEvent) { sLastMousePressEvent = event.release(); } +bool IsRunningUnderSnap() { return g_getenv("SNAP_INSTANCE_NAME") != nullptr; } + bool IsRunningUnderFlatpak() { // https://gitlab.gnome.org/GNOME/gtk/-/blob/4300a5c609306ce77cbc8a3580c19201dccd8d13/gdk/gdk.c#L472 static bool sRunning = [] { diff --git a/widget/gtk/WidgetUtilsGtk.h b/widget/gtk/WidgetUtilsGtk.h index 9d0109bd79eb3..bf9908fafa844 100644 --- a/widget/gtk/WidgetUtilsGtk.h +++ b/widget/gtk/WidgetUtilsGtk.h @@ -39,7 +39,7 @@ GdkEvent* GetLastMousePressEvent(); // Return the snap's instance name, or null when not running as a snap. const char* GetSnapInstanceName(); -inline bool IsRunningUnderSnap() { return !!GetSnapInstanceName(); } +bool IsRunningUnderSnap(); bool IsRunningUnderFlatpak(); inline bool IsRunningUnderFlatpakOrSnap() { return IsRunningUnderFlatpak() || IsRunningUnderSnap();