summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2019-11-08 13:03:48 -0600
committerJan-Michael Brummer <jan.brummer@tabos.org>2019-11-12 16:45:45 +0000
commit0744f6362ab13c94203ba6e41c9a12a0b09dda83 (patch)
treea28e405e4907f310c4829ae11bf7bfcba506a353 /lib
parent7e367778fb5c8c90e509a612c4f226700f8772a2 (diff)
downloadepiphany-0744f6362ab13c94203ba6e41c9a12a0b09dda83.tar.gz
Ensure flatpak check is not used in web process code
This function will do the wrong thing if it is ever called in the web process!
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-flatpak-utils.c16
-rw-r--r--lib/ephy-flatpak-utils.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/ephy-flatpak-utils.c b/lib/ephy-flatpak-utils.c
index d6e401502..5407e43d9 100644
--- a/lib/ephy-flatpak-utils.c
+++ b/lib/ephy-flatpak-utils.c
@@ -34,6 +34,16 @@
#include <sys/stat.h>
#include <sys/types.h>
+static gboolean is_web_process = FALSE;
+
+void
+ephy_flatpak_utils_set_is_web_process_extension (void)
+{
+ g_assert (!is_web_process);
+
+ is_web_process = TRUE;
+}
+
gboolean
ephy_is_running_inside_flatpak (void)
{
@@ -43,6 +53,12 @@ ephy_is_running_inside_flatpak (void)
if (decided)
return under_flatpak;
+ /* This function cannot be used in the web process extension, because WebKit
+ * creates a .flatpak-info in its web process sandbox even when we are not
+ * running under flatpak. It would always return TRUE.
+ */
+ g_assert (!is_web_process);
+
under_flatpak = g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
decided = TRUE;
return under_flatpak;
diff --git a/lib/ephy-flatpak-utils.h b/lib/ephy-flatpak-utils.h
index 1af19f22b..c6c36da96 100644
--- a/lib/ephy-flatpak-utils.h
+++ b/lib/ephy-flatpak-utils.h
@@ -22,7 +22,10 @@
#include <gio/gio.h>
+void ephy_flatpak_utils_set_is_web_process_extension (void);
+
gboolean ephy_is_running_inside_flatpak (void);
+
void ephy_open_file_via_flatpak_portal (const char *path,
GCancellable *cancellable,
GAsyncReadyCallback callback,