Skip to content
Permalink
Browse files
[GTK][WPE] Check GApplication has a valid ID before trying to create …
…the flatpack info

https://bugs.webkit.org/show_bug.cgi?id=227344

Reviewed by Michael Catanzaro.

Show a warning if GApplication is used but app ID is nullptr.

* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::createFlatpakInfo):

Canonical link: https://commits.webkit.org/239235@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Jun 29, 2021
1 parent ba06b17 commit 7a8bd0f5889b9149cb6655e476cf29ff8869d4ac
Showing with 19 additions and 5 deletions.
  1. +12 −0 Source/WebKit/ChangeLog
  2. +7 −5 Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
@@ -1,3 +1,15 @@
2021-06-29 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK][WPE] Check GApplication has a valid ID before trying to create the flatpack info
https://bugs.webkit.org/show_bug.cgi?id=227344

Reviewed by Michael Catanzaro.

Show a warning if GApplication is used but app ID is nullptr.

* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::createFlatpakInfo):

2021-06-29 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK][WPE] Bubblewrap: allow to set DBus proxy logging per proxy
@@ -139,13 +139,15 @@ static int createFlatpakInfo()
// xdg-desktop-portal relates your name to certain permissions so we want
// them to be application unique which is best done via GApplication.
GApplication* app = g_application_get_default();
if (!app) {
g_warning("GApplication is required for xdg-desktop-portal access in the WebKit sandbox. Actions that require xdg-desktop-portal will be broken.");
return -1;
}
if (!app)
g_error("GApplication is required for xdg-desktop-portal access in the WebKit sandbox.");

const char* appID = g_application_get_application_id(app);
if (!appID)
g_error("GApplication must have a valid ID for xdg-desktop-portal access in the WebKit sandbox.");

GUniquePtr<GKeyFile> keyFile(g_key_file_new());
g_key_file_set_string(keyFile.get(), "Application", "name", g_application_get_application_id(app));
g_key_file_set_string(keyFile.get(), "Application", "name", appID);
data->reset(g_key_file_to_data(keyFile.get(), &size, nullptr));
}

0 comments on commit 7a8bd0f

Please sign in to comment.