Backed out changeset 959bcc2a6588 (bug 1791442) for causing xpcshell tests failures in test_snap_empty.js. CLOSED TREE

This commit is contained in:
Stanca Serban 2023-01-04 19:32:20 +02:00
Родитель 86a24c4c53
Коммит 94299b86af
2 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -64,7 +64,7 @@ ShellService.register();
let gIsLegacy = false;
function simulateSnapEnvironment() {
Services.env.set("SNAP_NAME", AppConstants.MOZ_APP_NAME);
Services.env.set("SNAP_INSTANCE_NAME", AppConstants.MOZ_APP_NAME);
gIsLegacy = true;
}

Просмотреть файл

@ -124,7 +124,7 @@ void SetLastMousePressEvent(GdkEvent* aEvent) {
sLastMousePressEvent = event.release();
}
bool IsRunningUnderSnap() { return !!GetSnapInstanceName(); }
bool IsRunningUnderSnap() { return g_getenv("SNAP_INSTANCE_NAME") != nullptr; }
bool IsRunningUnderFlatpak() {
// https://gitlab.gnome.org/GNOME/gtk/-/blob/4300a5c609306ce77cbc8a3580c19201dccd8d13/gdk/gdk.c#L472
@ -136,19 +136,12 @@ bool IsRunningUnderFlatpak() {
const char* GetSnapInstanceName() {
static const char* sInstanceName = []() -> const char* {
const char* snapName = g_getenv("SNAP_NAME");
if (!snapName) {
return nullptr;
}
if (g_strcmp0(snapName, MOZ_APP_NAME)) {
return nullptr;
}
// Intentionally leaked, as keeping a pointer to the environment forever is
// a bit suspicious.
if (const char* instanceName = g_getenv("SNAP_INSTANCE_NAME")) {
return g_strdup(instanceName);
}
// Instance name didn't exist for snapd <= 2.35:
// Compatibility for snapd <= 2.35:
if (const char* instanceName = g_getenv("SNAP_NAME")) {
return g_strdup(instanceName);
}