Package: release.debian.org
Severity: normal
X-Debbugs-Cc: plasma-browser-integrat...@packages.debian.org, Qt/KDE 
Maintainers <debian-qt-kde@lists.debian.org>
Control: affects -1 + src:plasma-browser-integration
User: release.debian....@packages.debian.org
Usertags: unblock

Dear Release Team,

please unblock package plasma-browser-integration.

[ Reason ]
It contains the following changes:
* Backport upstream commits:
  - Support for flatpak variants of Firefox and Chromium.
  - Add support for librewolf. (kde#476967)

[ Tests ]
- Tested that the integration still works on standard firefox (download
  progress, media controls).

[ Risks ]
Only backport of upstream commits that apply cleanly. Further fixes can
easily be backported or the changes reverted.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing


Thanks!


unblock plasma-browser-integration/6.3.4-2
diff -Nru plasma-browser-integration-6.3.4/debian/changelog 
plasma-browser-integration-6.3.4/debian/changelog
--- plasma-browser-integration-6.3.4/debian/changelog   2025-04-03 
01:03:11.000000000 +0200
+++ plasma-browser-integration-6.3.4/debian/changelog   2025-05-19 
00:58:43.000000000 +0200
@@ -1,3 +1,12 @@
+plasma-browser-integration (6.3.4-2) unstable; urgency=medium
+
+  [ Aurélien COUDERC ]
+  * Backport upstream commits:
+    - Support for flatpak variants of Firefox and Chromium.
+    - Add support for librewolf. (kde#476967)
+
+ -- Aurélien COUDERC <couc...@debian.org>  Mon, 19 May 2025 00:58:43 +0200
+
 plasma-browser-integration (6.3.4-1) unstable; urgency=medium
 
   [ Patrick Franz ]
diff -Nru plasma-browser-integration-6.3.4/debian/patches/series 
plasma-browser-integration-6.3.4/debian/patches/series
--- plasma-browser-integration-6.3.4/debian/patches/series      1970-01-01 
01:00:00.000000000 +0100
+++ plasma-browser-integration-6.3.4/debian/patches/series      2025-05-19 
00:58:43.000000000 +0200
@@ -0,0 +1,3 @@
+upstream_5723f037_feat-flatpak-integrator-add-support-for-variants.patch
+upstream_6089b6c1_feat-flatpak-integrator-add-support-for-flatpak-chromium-variants.patch
+upstream_80ff7196_feat-add-librewolf-support.patch
diff -Nru 
plasma-browser-integration-6.3.4/debian/patches/upstream_5723f037_feat-flatpak-integrator-add-support-for-variants.patch
 
plasma-browser-integration-6.3.4/debian/patches/upstream_5723f037_feat-flatpak-integrator-add-support-for-variants.patch
--- 
plasma-browser-integration-6.3.4/debian/patches/upstream_5723f037_feat-flatpak-integrator-add-support-for-variants.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
plasma-browser-integration-6.3.4/debian/patches/upstream_5723f037_feat-flatpak-integrator-add-support-for-variants.patch
    2025-05-13 00:46:51.000000000 +0200
@@ -0,0 +1,133 @@
+From 5723f037b7761ff66f662098cdced6dbf4124704 Mon Sep 17 00:00:00 2001
+From: Kristen McWilliam <kmcwilliampub...@gmail.com>
+Date: Mon, 24 Mar 2025 19:34:34 -0400
+Subject: [PATCH] feat[flatpak-integrator]: add support for variants
+
+Added structure to support Firefox variants, and
+specifically right now support for LibreWolf.
+---
+ flatpak-integrator/plugin.cpp | 56 ++++++++++++++++++++++++-----------
+ 1 file changed, 38 insertions(+), 18 deletions(-)
+
+diff --git a/flatpak-integrator/plugin.cpp b/flatpak-integrator/plugin.cpp
+index e6d59033..13c3d00e 100644
+--- a/flatpak-integrator/plugin.cpp
++++ b/flatpak-integrator/plugin.cpp
+@@ -115,21 +115,41 @@ class BrowserIntegrationFlatpakIntegrator : public 
KDEDModule
+     Q_CLASSINFO("D-Bus Interface", 
"org.kde.plasma.browser.integration.FlatpakIntegrator")
+ 
+ public:
++    /** Browser information structure to hold browser-specific configuration 
*/
++    struct BrowserInfo {
++        /** The browser's Flatpak id, e.g. "org.mozilla.firefox" */
++        QString id;
++
++        /** The directory the browser expects its native messaging hosts to 
be in */
++        QString nativeMessagingHostsDir;
++    };
++
+     BrowserIntegrationFlatpakIntegrator(QObject *parent, const 
QList<QVariant> &)
+         : KDEDModule(parent)
+     {
+-        auto flatpak = new QProcess(this);
+-        connect(flatpak, qOverload<int, 
QProcess::ExitStatus>(&QProcess::finished), this, [flatpak](int, 
QProcess::ExitStatus) {
+-            flatpak->deleteLater();
+-        });
+-        flatpak->start(u"flatpak"_s, {u"override"_s, u"--user"_s, 
u"--talk-name=org.kde.plasma.browser.integration"_s, u"org.mozilla.firefox"_s});
++        const QList<BrowserInfo> supportedBrowsers = {
++            {u"org.mozilla.firefox"_s, u"/.mozilla/native-messaging-hosts"_s},
++            {u"io.gitlab.librewolf-community"_s, 
u"/.librewolf/native-messaging-hosts"_s},
++        };
++
++        // Set up Flatpak permissions for each browser
++        for (const auto &browser : supportedBrowsers) {
++            auto flatpak = new QProcess(this);
++            connect(flatpak, qOverload<int, 
QProcess::ExitStatus>(&QProcess::finished), this, [flatpak](int, 
QProcess::ExitStatus) {
++                flatpak->deleteLater();
++            });
++            flatpak->start(u"flatpak"_s, {u"override"_s, u"--user"_s, 
u"--talk-name=org.kde.plasma.browser.integration"_s, browser.id});
++        }
+ 
+         // Register on separate bus connection to avoid exposing other 
services to the sandbox
+         auto connection = 
QDBusConnection::connectToBus(QDBusConnection::SessionBus, 
"org.kde.plasma.browser.integration"_L1);
+         connection.registerService("org.kde.plasma.browser.integration"_L1);
+         connection.registerObject("/org/kde/plasma/browser/integration"_L1, 
this, QDBusConnection::ExportAllSlots);
+ 
+-        createMessagingHost(); // always create integration regardless of 
firefox being installed so we can be ready for the browser
++        // Create messaging hosts for each supported browser
++        for (const auto &browser : supportedBrowsers) {
++            createMessagingHost(browser); // always create integration 
regardless of the browser being installed so we can be ready for if it is 
installed
++        }
+     }
+ 
+ public Q_SLOTS:
+@@ -173,28 +193,32 @@ private:
+         return openat(dirfd, ".", flags | O_NOFOLLOW | O_CLOEXEC, mode);
+     }
+ 
+-    void createMessagingHost()
++    void createMessagingHost(const BrowserInfo &browser)
+     {
+-        QDir().mkpath(m_hostWrapperDir);
++        const QString hostWrapperDir = QDir::homePath() + 
QStringLiteral("/.var/app/") + browser.id;
++        const QString hostWrapperName = "plasma-browser-integration-host"_L1;
++        const QString hostWrapperPath = hostWrapperDir + "/"_L1 + 
hostWrapperName;
+ 
+-        auto hostWrapperDirFd = 
openNoSymlinks(qUtf8Printable(m_hostWrapperDir), O_PATH);
++        QDir().mkpath(hostWrapperDir);
++
++        auto hostWrapperDirFd = 
openNoSymlinks(qUtf8Printable(hostWrapperDir), O_PATH);
+         const auto closeHostWrapperDirFd = qScopeGuard([hostWrapperDirFd]() {
+             close(hostWrapperDirFd);
+         });
+         if (hostWrapperDirFd == -1) {
+             auto err = errno;
+-            qCWarning(INTEGRATOR) << "Failed to open hostWrapper directory." 
<< m_hostWrapperDir << ":" << safe_strerror(err);
++            qCWarning(INTEGRATOR) << "Failed to open hostWrapper directory." 
<< hostWrapperDir << ":" << safe_strerror(err);
+             return;
+         }
+ 
+         { // host wrapper
+-            auto hostWrapperFd = openat(hostWrapperDirFd, 
qUtf8Printable(m_hostWrapperName), O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC | 
O_NOFOLLOW, S_IRWXU);
++            auto hostWrapperFd = openat(hostWrapperDirFd, 
qUtf8Printable(hostWrapperName), O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC | 
O_NOFOLLOW, S_IRWXU);
+             auto closeHostWrapperFd = qScopeGuard([hostWrapperFd]() {
+                 close(hostWrapperFd);
+             });
+             if (hostWrapperFd == -1) {
+                 auto err = errno;
+-                qCWarning(INTEGRATOR) << "Failed to open host wrapper file" 
<< m_hostWrapperName << ":" << safe_strerror(err);
++                qCWarning(INTEGRATOR) << "Failed to open host wrapper file" 
<< hostWrapperName << ":" << safe_strerror(err);
+                 return;
+             }
+ 
+@@ -222,7 +246,7 @@ private:
+         }
+ 
+         { // hosts definition
+-            const QString extensionDefinitionDir = m_hostWrapperDir + 
"/.mozilla/native-messaging-hosts"_L1;
++            const QString extensionDefinitionDir = hostWrapperDir + 
browser.nativeMessagingHostsDir;
+             QDir().mkpath(extensionDefinitionDir);
+ 
+             auto defintionsDirFd = 
openNoSymlinks(qUtf8Printable(extensionDefinitionDir), O_PATH);
+@@ -254,17 +278,13 @@ private:
+             QJsonObject extensionDefinitionObject({
+                 {u"name"_s, u"org.kde.plasma.browser_integration"_s},
+                 {u"description"_s, u"Native connector for KDE Plasma"_s},
+-                {u"path"_s, m_hostWrapperPath},
++                {u"path"_s, hostWrapperPath},
+                 {u"type"_s, u"stdio"_s},
+                 {u"allowed_extensions"_s, 
QJsonArray({u"plasma-browser-integrat...@kde.org"_s})},
+             });
+             
extensionDefinition.write(QJsonDocument(extensionDefinitionObject).toJson());
+         }
+     }
+-
+-    const QString m_hostWrapperDir = QDir::homePath() + 
"/.var/app/org.mozilla.firefox"_L1;
+-    const QString m_hostWrapperName = "plasma-browser-integration-host"_L1;
+-    const QString m_hostWrapperPath = m_hostWrapperDir + "/"_L1 + 
m_hostWrapperName;
+ };
+ 
+ K_PLUGIN_FACTORY_WITH_JSON(BrowserIntegrationFlatpakIntegratorFactory,
+-- 
+GitLab
+
diff -Nru 
plasma-browser-integration-6.3.4/debian/patches/upstream_6089b6c1_feat-flatpak-integrator-add-support-for-flatpak-chromium-variants.patch
 
plasma-browser-integration-6.3.4/debian/patches/upstream_6089b6c1_feat-flatpak-integrator-add-support-for-flatpak-chromium-variants.patch
--- 
plasma-browser-integration-6.3.4/debian/patches/upstream_6089b6c1_feat-flatpak-integrator-add-support-for-flatpak-chromium-variants.patch
   1970-01-01 01:00:00.000000000 +0100
+++ 
plasma-browser-integration-6.3.4/debian/patches/upstream_6089b6c1_feat-flatpak-integrator-add-support-for-flatpak-chromium-variants.patch
   2025-05-19 00:58:43.000000000 +0200
@@ -0,0 +1,114 @@
+From 6089b6c1b341f0b2dc0803c027bff416fb4f2202 Mon Sep 17 00:00:00 2001
+From: Kristen McWilliam <kmcwilliampub...@gmail.com>
+Date: Fri, 11 Apr 2025 21:38:38 -0400
+Subject: [PATCH] feat[flatpak-integrator]: add support for flatpak chromium
+ variants
+
+Adds support for Chrome & Chromium based flatpak
+browsers.
+---
+ flatpak-integrator/flatpak-host-wrapper | 14 +++++++--
+ flatpak-integrator/plugin.cpp           | 39 +++++++++++++++++++++----
+ 2 files changed, 45 insertions(+), 8 deletions(-)
+
+diff --git a/flatpak-integrator/flatpak-host-wrapper 
b/flatpak-integrator/flatpak-host-wrapper
+index 8aa71cff..d840b4e6 100644
+--- a/flatpak-integrator/flatpak-host-wrapper
++++ b/flatpak-integrator/flatpak-host-wrapper
+@@ -7,8 +7,18 @@
+ 
+ set -eu
+ 
+-# This packs $1 and $2 into a single string for gdbus of the form "'$1', 
'$2'\n"
+-args=$(printf "'%s', '%s'\n" "$1" "$2")
++# Format arguments for gdbus based on whether it's Firefox (2 args) or Chrome 
(1 arg)
++# See: 
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging#exchanging_messages
++if [ $# -eq 2 ]; then
++    # Firefox case - pack $1 and $2 into a single string
++    args=$(printf "'%s', '%s'\n" "$1" "$2")
++elif [ $# -eq 1 ]; then
++    # Chrome case - format single argument
++    args=$(printf "'%s'\n" "$1")
++else
++    echo "Error: Expected 1 (Chrome) or 2 (Firefox) arguments but got $#" >&2
++    exit 1
++fi
+ 
+ # The descriptor madness needs some explaining:
+ # We expect the forked gdbus to pick up three descriptors from us: 3, 4, and 
5, respectively presenting our
+diff --git a/flatpak-integrator/plugin.cpp b/flatpak-integrator/plugin.cpp
+index 13c3d00e..7824be66 100644
+--- a/flatpak-integrator/plugin.cpp
++++ b/flatpak-integrator/plugin.cpp
+@@ -115,21 +115,36 @@ class BrowserIntegrationFlatpakIntegrator : public 
KDEDModule
+     Q_CLASSINFO("D-Bus Interface", 
"org.kde.plasma.browser.integration.FlatpakIntegrator")
+ 
+ public:
+-    /** Browser information structure to hold browser-specific configuration 
*/
++    /** Enum for different browser types, i.e. which browser they are based 
on. */
++    enum BrowserBase {
++        Firefox,
++        Chrome,
++        Chromium,
++    };
++    Q_ENUM(BrowserBase)
++
++    /** Browser information structure to hold browser-specific configuration. 
*/
+     struct BrowserInfo {
+-        /** The browser's Flatpak id, e.g. "org.mozilla.firefox" */
++        BrowserBase base;
++
++        /** The browser's Flatpak id, e.g. "org.mozilla.firefox". */
+         QString id;
+ 
+-        /** The directory the browser expects its native messaging hosts to 
be in */
++        /** The directory the browser expects its native messaging hosts to 
be in. */
+         QString nativeMessagingHostsDir;
+     };
+ 
+     BrowserIntegrationFlatpakIntegrator(QObject *parent, const 
QList<QVariant> &)
+         : KDEDModule(parent)
+     {
++        // List of Flatpak browsers we support.
+         const QList<BrowserInfo> supportedBrowsers = {
+-            {u"org.mozilla.firefox"_s, u"/.mozilla/native-messaging-hosts"_s},
+-            {u"io.gitlab.librewolf-community"_s, 
u"/.librewolf/native-messaging-hosts"_s},
++            {BrowserBase::Firefox, u"org.mozilla.firefox"_s, 
u"/.mozilla/native-messaging-hosts"_s},
++            {BrowserBase::Firefox, u"io.gitlab.librewolf-community"_s, 
u"/.librewolf/native-messaging-hosts"_s},
++            {BrowserBase::Chrome, u"com.google.Chrome"_s, 
u"/config/google-chrome/NativeMessagingHosts"_s},
++            {BrowserBase::Chrome, u"com.google.ChromeDev"_s, 
u"/config/google-chrome-unstable/NativeMessagingHosts"_s},
++            {BrowserBase::Chromium, u"org.chromium.Chromium"_s, 
u"/config/chromium/NativeMessagingHosts"_s},
++            {BrowserBase::Chromium, 
u"io.github.ungoogled_software.ungoogled_chromium"_s, 
u"/config/chromium/NativeMessagingHosts"_s},
+         };
+ 
+         // Set up Flatpak permissions for each browser
+@@ -275,13 +290,25 @@ private:
+                 qCWarning(INTEGRATOR) << "Failed to open extension definition 
file";
+                 return;
+             }
++
+             QJsonObject extensionDefinitionObject({
+                 {u"name"_s, u"org.kde.plasma.browser_integration"_s},
+                 {u"description"_s, u"Native connector for KDE Plasma"_s},
+                 {u"path"_s, hostWrapperPath},
+                 {u"type"_s, u"stdio"_s},
+-                {u"allowed_extensions"_s, 
QJsonArray({u"plasma-browser-integrat...@kde.org"_s})},
+             });
++
++            // Add browser-specific fields
++            if (browser.base == BrowserBase::Firefox) {
++                extensionDefinitionObject.insert(u"allowed_extensions"_s, 
QJsonArray({u"plasma-browser-integrat...@kde.org"_s}));
++            } else if (browser.base == BrowserBase::Chrome || browser.base == 
BrowserBase::Chromium) {
++                extensionDefinitionObject.insert(u"allowed_origins"_s,
++                                                 QJsonArray({
++                                                     
u"chrome-extension://cimiefiiaegbelhefglklhhakcgmhkai/"_s,
++                                                     
u"chrome-extension://dnnckbejblnejeabhcmhklcaljjpdjeh/"_s,
++                                                 }));
++            }
++
+             
extensionDefinition.write(QJsonDocument(extensionDefinitionObject).toJson());
+         }
+     }
+-- 
+GitLab
+
diff -Nru 
plasma-browser-integration-6.3.4/debian/patches/upstream_80ff7196_feat-add-librewolf-support.patch
 
plasma-browser-integration-6.3.4/debian/patches/upstream_80ff7196_feat-add-librewolf-support.patch
--- 
plasma-browser-integration-6.3.4/debian/patches/upstream_80ff7196_feat-add-librewolf-support.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
plasma-browser-integration-6.3.4/debian/patches/upstream_80ff7196_feat-add-librewolf-support.patch
  2025-05-19 00:58:43.000000000 +0200
@@ -0,0 +1,40 @@
+From 80ff71965fec75c51773b20f7c724976ccb728a3 Mon Sep 17 00:00:00 2001
+From: Kristen McWilliam <kris...@kde.org>
+Date: Sat, 12 Apr 2025 10:19:33 -0400
+Subject: [PATCH] feat: add librewolf support
+
+BUG: 476967
+---
+ CMakeLists.txt | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 48960184..5a3d330e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -74,6 +74,9 @@ add_feature_info(COPY_MESSAGING_HOST_FILE_HOME 
${COPY_MESSAGING_HOST_FILE_HOME}
+ set(MOZILLA_DIR "${CMAKE_INSTALL_PREFIX}/lib/mozilla" CACHE STRING "Mozilla 
directory")
+ add_feature_info(MOZILLA_DIR On "Mozilla directory is '${MOZILLA_DIR}'")
+ 
++set(LIBREWOLF_DIR "${CMAKE_INSTALL_PREFIX}/lib/librewolf" CACHE STRING 
"LibreWolf directory")
++add_feature_info(LIBREWOLF_DIR On "LibreWolf directory is '${LIBREWOLF_DIR}'")
++
+ add_subdirectory(host)
+ add_subdirectory(reminder)
+ add_subdirectory(flatpak-integrator)
+@@ -101,9 +104,12 @@ install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json
+ install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION 
${KDE_INSTALL_FULL_SYSCONFDIR}/opt/edge/native-messaging-hosts/ RENAME 
org.kde.plasma.browser_integration.json)
+ # firefox
+ install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.firefox_integration.json DESTINATION 
${MOZILLA_DIR}/native-messaging-hosts/ RENAME 
org.kde.plasma.browser_integration.json)
++# LibreWolf
++install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.firefox_integration.json DESTINATION 
${LIBREWOLF_DIR}/native-messaging-hosts/ RENAME 
org.kde.plasma.browser_integration.json)
+ 
+ if (COPY_MESSAGING_HOST_FILE_HOME)
+     install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.firefox_integration.json DESTINATION 
$ENV{HOME}/.mozilla/native-messaging-hosts/ RENAME 
org.kde.plasma.browser_integration.json)
++    install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.firefox_integration.json DESTINATION 
$ENV{HOME}/.librewolf/native-messaging-hosts/ RENAME 
org.kde.plasma.browser_integration.json)
+     install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION 
$ENV{HOME}/.config/chromium/NativeMessagingHosts/ RENAME 
org.kde.plasma.browser_integration.json)
+     install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION 
$ENV{HOME}/.config/google-chrome/NativeMessagingHosts/ RENAME 
org.kde.plasma.browser_integration.json)
+     install(FILES 
${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION 
$ENV{HOME}/.config/microsoft-edge/NativeMessagingHosts/ RENAME 
org.kde.plasma.browser_integration.json)
+-- 
+GitLab
+
diff -Nru 
plasma-browser-integration-6.3.4/debian/plasma-browser-integration.install 
plasma-browser-integration-6.3.4/debian/plasma-browser-integration.install
--- plasma-browser-integration-6.3.4/debian/plasma-browser-integration.install  
2025-03-31 21:13:14.000000000 +0200
+++ plasma-browser-integration-6.3.4/debian/plasma-browser-integration.install  
2025-05-19 00:58:43.000000000 +0200
@@ -5,6 +5,7 @@
 usr/bin/plasma-browser-integration-host
 usr/lib/*/qt6/plugins/kf6/kded/browserintegrationflatpakintegrator.so
 usr/lib/*/qt6/plugins/kf6/kded/browserintegrationreminder.so
+usr/lib/librewolf/native-messaging-hosts/org.kde.plasma.browser_integration.json
 usr/lib/mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json
 usr/share/applications/org.kde.plasma.browser_integration.host.desktop
 usr/share/krunner/dbusplugins/plasma-runner-browserhistory.desktop

Reply via email to