Bug 1799503 - Update Firefox via APT (not balrog) in our .deb packages r=bytesized

Differential Revision: https://phabricator.services.mozilla.com/D168324
This commit is contained in:
Gabriel Bustamante 2023-02-15 16:40:29 +00:00
parent 57b15fbd3a
commit add0179a08
3 changed files with 35 additions and 1 deletions

View File

@ -14,6 +14,13 @@
#include "nsWindow.h"
#include "nsIGfxInfo.h"
#include "mozilla/Components.h"
#include "nsCOMPtr.h"
#include "nsIProperties.h"
#include "nsIFile.h"
#include "nsXULAppAPI.h"
#include "nsXPCOMCID.h"
#include "nsDirectoryServiceDefs.h"
#include "nsString.h"
#include "nsGtkKeyUtils.h"
#include "nsGtkUtils.h"
@ -137,6 +144,31 @@ bool IsRunningUnderFlatpak() {
return sRunning;
}
bool IsPackagedAppFileExists() {
static bool sRunning = [] {
nsresult rv;
nsCString path;
nsCOMPtr<nsIFile> file;
nsCOMPtr<nsIProperties> directoryService;
directoryService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(directoryService, FALSE);
rv = directoryService->Get(NS_GRE_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, FALSE);
rv = file->AppendNative("is-packaged-app"_ns);
NS_ENSURE_SUCCESS(rv, FALSE);
rv = file->GetNativePath(path);
NS_ENSURE_SUCCESS(rv, FALSE);
return g_file_test(path.get(), G_FILE_TEST_EXISTS);
}();
return sRunning;
}
const char* GetSnapInstanceName() {
static const char* sInstanceName = []() -> const char* {
const char* snapName = g_getenv("SNAP_NAME");

View File

@ -45,6 +45,7 @@ GdkEvent* GetLastMousePressEvent();
const char* GetSnapInstanceName();
bool IsRunningUnderSnap();
bool IsRunningUnderFlatpak();
bool IsPackagedAppFileExists();
inline bool IsRunningUnderFlatpakOrSnap() {
return IsRunningUnderFlatpak() || IsRunningUnderSnap();
}

View File

@ -1126,7 +1126,8 @@ nsresult nsSystemInfo::Init() {
return rv;
}
rv = SetPropertyAsBool(u"isPackagedApp"_ns,
widget::IsRunningUnderFlatpakOrSnap());
widget::IsRunningUnderFlatpakOrSnap() ||
widget::IsPackagedAppFileExists());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}