Skip to content
Permalink
Browse files
[GLIB] Change MPRIS bus name to be sandbox friendly
https://bugs.webkit.org/show_bug.cgi?id=241807

Reviewed by Philippe Normand.

When an application has an ID this changes the name to be
org.mpris.MediaPlayer2.$APP_ID.$INSTANCE_ID which is permitted
by default with flatpak and now with our bubblewrap sandbox.

Instead of the previous org.mpris.MediaPlayer2.$APP_ID-$INSTANCE_ID
which would be blocked by sandboxes unless they allowed an
overly broad org.mpris.MediaPlayer2.* permission.

* Source/WebCore/platform/audio/glib/MediaSessionGLib.cpp:
(WebCore::MediaSessionGLib::MediaSessionGLib):

Canonical link: https://commits.webkit.org/251730@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
TingPing committed Jun 22, 2022
1 parent fd64a56 commit d305d6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
@@ -222,7 +222,7 @@ MediaSessionGLib::MediaSessionGLib(MediaSessionManagerGLib& manager, GRefPtr<GDB
}

const auto& applicationID = getApplicationID();
m_instanceId = applicationID.isEmpty() ? makeString("org.mpris.MediaPlayer2.webkit.instance", getpid(), "-", identifier.toUInt64()) : makeString("org.mpris.MediaPlayer2.", applicationID.ascii().data(), "-", identifier.toUInt64());
m_instanceId = applicationID.isEmpty() ? makeString("org.mpris.MediaPlayer2.webkit.instance", getpid(), "-", identifier.toUInt64()) : makeString("org.mpris.MediaPlayer2.", applicationID.ascii().data(), ".", identifier.toUInt64());

m_ownerId = g_bus_own_name_on_connection(m_connection.get(), m_instanceId.ascii().data(), G_BUS_NAME_OWNER_FLAGS_NONE, nullptr, nullptr, this, nullptr);
}
@@ -145,7 +145,7 @@ int XDGDBusProxy::launch(bool allowPortals) const
#if ENABLE(MEDIA_SESSION)
if (auto* app = g_application_get_default()) {
if (const char* appID = g_application_get_application_id(app)) {
auto mprisSessionID = makeString("--own=org.mpris.MediaPlayer2.", appID);
auto mprisSessionID = makeString("--own=org.mpris.MediaPlayer2.", appID, ".*");
proxyArgs.append(mprisSessionID.ascii().data());
}
}

0 comments on commit d305d6f

Please sign in to comment.