Backed out changeset caf472555c8a (bug 1701182) for causing failure on test_snap_empty.js. CLOSED TREE

This commit is contained in:
Butkovits Atila 2021-04-08 05:26:26 +03:00
Родитель 24b6ba53d1
Коммит c6955ce4d0
6 изменённых файлов: 13 добавлений и 48 удалений

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

@ -23,7 +23,6 @@
#include "imgIRequest.h" #include "imgIRequest.h"
#include "imgIContainer.h" #include "imgIContainer.h"
#include "mozilla/Sprintf.h" #include "mozilla/Sprintf.h"
#include "mozilla/WidgetUtilsGtk.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#if defined(MOZ_WIDGET_GTK) #if defined(MOZ_WIDGET_GTK)
# include "nsIImageToPixbuf.h" # include "nsIImageToPixbuf.h"
@ -73,15 +72,17 @@ static const MimeTypeAssociation appTypes[] = {
#define kDesktopColorGSKey "primary-color" #define kDesktopColorGSKey "primary-color"
static bool IsRunningAsASnap() { static bool IsRunningAsASnap() {
const char* snapName = mozilla::widget::WidgetUtilsGTK::GetSnapInstanceName(); // SNAP holds the path to the snap, use SNAP_NAME
// which is easier to parse.
const char* snap_name = PR_GetEnv("SNAP_NAME");
// return early if not set. // return early if not set.
if (snapName == nullptr) { if (snap_name == nullptr) {
return false; return false;
} }
// snapName as defined on https://snapcraft.io/firefox // snap_name as defined on https://snapcraft.io/firefox
return (strcmp(snapName, "firefox") == 0); return (strcmp(snap_name, "firefox") == 0);
} }
nsresult nsGNOMEShellService::Init() { nsresult nsGNOMEShellService::Init() {

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

@ -30,9 +30,6 @@ if CONFIG["OS_TARGET"] == "Android":
UNIFIED_SOURCES += ["nsToolkitProfileService.cpp"] UNIFIED_SOURCES += ["nsToolkitProfileService.cpp"]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
"../xre", "../xre",
] ]

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

@ -50,10 +50,6 @@
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
#if defined(MOZ_WIDGET_GTK)
# include "mozilla/WidgetUtilsGtk.h"
#endif
using namespace mozilla; using namespace mozilla;
#define DEV_EDITION_NAME "dev-edition-default" #define DEV_EDITION_NAME "dev-edition-default"
@ -1837,19 +1833,14 @@ nsToolkitProfileService::CreateProfile(nsIFile* aRootDir,
* get essentially the same benefits as dedicated profiles provides. * get essentially the same benefits as dedicated profiles provides.
*/ */
bool nsToolkitProfileService::IsSnapEnvironment() { bool nsToolkitProfileService::IsSnapEnvironment() {
#if defined(MOZ_WIDGET_GTK) // Copied from IsRunningAsASnap() in
const char* snapName = mozilla::widget::WidgetUtilsGTK::GetSnapInstanceName(); // browser/components/shell/nsGNOMEShellService.cpp
// TODO: factor out this common code in one place.
// return early if not set. const char* snap_name = PR_GetEnv("SNAP_NAME");
if (snapName == nullptr) { if (snap_name == nullptr) {
return false; return false;
} }
return (strcmp(snap_name, "firefox") == 0);
// snapName as defined on https://snapcraft.io/firefox
return (strcmp(snapName, "firefox") == 0);
#endif
return false;
} }
/** /**

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

@ -5,7 +5,6 @@
#include "WidgetUtilsGtk.h" #include "WidgetUtilsGtk.h"
#include "nsWindow.h" #include "nsWindow.h"
#include "prenv.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -45,15 +44,6 @@ int32_t WidgetUtilsGTK::IsTouchDeviceSupportPresent() {
return result; return result;
} }
const char* WidgetUtilsGTK::GetSnapInstanceName() {
char* instanceName = PR_GetEnv("SNAP_INSTANCE_NAME");
if (instanceName != nullptr) {
return instanceName;
}
// Compatibility for snapd <= 2.35:
return PR_GetEnv("SNAP_NAME");
}
bool IsMainWindowTransparent() { bool IsMainWindowTransparent() {
return nsWindow::IsToplevelWindowTransparent(); return nsWindow::IsToplevelWindowTransparent();
} }

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

@ -16,11 +16,6 @@ class WidgetUtilsGTK {
public: public:
/* See WidgetUtils::IsTouchDeviceSupportPresent(). */ /* See WidgetUtils::IsTouchDeviceSupportPresent(). */
static int32_t IsTouchDeviceSupportPresent(); static int32_t IsTouchDeviceSupportPresent();
/* When packaged as a snap, strict confinement needs to be accounted for.
See https://snapcraft.io/docs for details.
Return the snap's instance name, or null when not running as a snap. */
static const char* GetSnapInstanceName();
}; };
bool IsMainWindowTransparent(); bool IsMainWindowTransparent();

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

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsWaylandDisplay.h" #include "nsWaylandDisplay.h"
#include "WidgetUtilsGtk.h"
#include "WindowSurfaceWayland.h" #include "WindowSurfaceWayland.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
@ -170,17 +169,9 @@ RefPtr<nsWaylandDisplay> WindowBackBuffer::GetWaylandDisplay() {
static int WaylandAllocateShmMemory(int aSize) { static int WaylandAllocateShmMemory(int aSize) {
int fd = -1; int fd = -1;
nsCString shmPrefix("/");
const char* snapName = mozilla::widget::WidgetUtilsGTK::GetSnapInstanceName();
if (snapName != nullptr) {
shmPrefix.AppendPrintf("snap.%s.", snapName);
}
shmPrefix.Append("wayland.mozilla.ipc");
do { do {
static int counter = 0; static int counter = 0;
nsPrintfCString shmName("%s.%d", shmPrefix.get(), counter++); nsPrintfCString shmName("/wayland.mozilla.ipc.%d", counter++);
fd = shm_open(shmName.get(), O_CREAT | O_RDWR | O_EXCL, 0600); fd = shm_open(shmName.get(), O_CREAT | O_RDWR | O_EXCL, 0600);
if (fd >= 0) { if (fd >= 0) {
// We don't want to use leaked file // We don't want to use leaked file