mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
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:
parent
57b15fbd3a
commit
add0179a08
@ -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");
|
||||
|
@ -45,6 +45,7 @@ GdkEvent* GetLastMousePressEvent();
|
||||
const char* GetSnapInstanceName();
|
||||
bool IsRunningUnderSnap();
|
||||
bool IsRunningUnderFlatpak();
|
||||
bool IsPackagedAppFileExists();
|
||||
inline bool IsRunningUnderFlatpakOrSnap() {
|
||||
return IsRunningUnderFlatpak() || IsRunningUnderSnap();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user