summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacho Ramos <pacho@gentoo.org>2019-04-18 23:34:56 +0200
committerPacho Ramos <pacho@gentoo.org>2019-04-18 23:35:10 +0200
commita307a6b20508519da3a6f038a301334191f62b36 (patch)
treeed98e39e44d458feef58bccec7ff0ddfaab7d0ed
parentsys-fs/zfs: add 0.8.0_rc4 for testing (diff)
downloadgentoo-a307a6b20508519da3a6f038a301334191f62b36.tar.gz
gentoo-a307a6b20508519da3a6f038a301334191f62b36.tar.bz2
gentoo-a307a6b20508519da3a6f038a301334191f62b36.zip
www-client/chromium: Backport XDG_CURRENT_DESKTOP parsing fix
Closes: https://bugs.gentoo.org/683792 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Pacho Ramos <pacho@gentoo.org>
-rw-r--r--www-client/chromium/chromium-73.0.3683.86.ebuild1
-rw-r--r--www-client/chromium/files/chromium-73-xdg-current-desktop.patch124
2 files changed, 125 insertions, 0 deletions
diff --git a/www-client/chromium/chromium-73.0.3683.86.ebuild b/www-client/chromium/chromium-73.0.3683.86.ebuild
index e02966e7154..9131002b447 100644
--- a/www-client/chromium/chromium-73.0.3683.86.ebuild
+++ b/www-client/chromium/chromium-73.0.3683.86.ebuild
@@ -149,6 +149,7 @@ PATCHES=(
"${FILESDIR}/chromium-73-gcc-4.patch"
"${FILESDIR}/chromium-73-gcc-5.patch"
"${FILESDIR}/chromium-73-gcc-6.patch"
+ "${FILESDIR}/chromium-73-xdg-current-desktop.patch"
)
pre_build_checks() {
diff --git a/www-client/chromium/files/chromium-73-xdg-current-desktop.patch b/www-client/chromium/files/chromium-73-xdg-current-desktop.patch
new file mode 100644
index 00000000000..09e3b1d2aec
--- /dev/null
+++ b/www-client/chromium/files/chromium-73-xdg-current-desktop.patch
@@ -0,0 +1,124 @@
+Correct the parsing of the XDG_CURRENT_DESKTOP
+
+The XDG_CURRENT_DESKTOP could contain multiple values in priority order
+separated by colon. Go through them in the loop and return on the first
+one that we recognize/support.
+
+The previous state was causing problems with Chrome on the GNOME Classic
+mode (used in Red Hat Enterprise Linux 7) where the users with multiple
+Google accounts set in Chrome couldn't switch between them - only one was
+shown in the account switcher in i.e. GMail. The reason for that was that
+the XDG_CURRENT_DESKTOP's value GNOME:GNOME-Classic was parsed as
+not as base::nix::DesktopEnvironment::DESKTOP_ENVIRONMENT_GNOME.
+
+base: :nix::DesktopEnvironment::DESKTOP_ENVIRONMENT_OTHER and
+Change-Id: I122f24fd1cf5a0f932c3fccd5220152a9944609d
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1541077
+Reviewed-by: Lei Zhang <thestig@chromium.org>
+Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
+Commit-Queue: Tomáš Popela <tomas.popela@gmail.com>
+Cr-Commit-Position: refs/heads/master@{#645224}
+diff --git a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc
+index 9ff4d88..f051080 100644
+--- a/base/nix/xdg_util.cc
++++ b/base/nix/xdg_util.cc
+@@ -11,6 +11,7 @@
+ #include "base/files/file_path.h"
+ #include "base/files/file_util.h"
+ #include "base/path_service.h"
++#include "base/strings/string_split.h"
+ #include "base/strings/string_util.h"
+ #include "base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h"
+
+@@ -57,35 +58,37 @@
+ // XDG_CURRENT_DESKTOP is the newest standard circa 2012.
+ std::string xdg_current_desktop;
+ if (env->GetVar("XDG_CURRENT_DESKTOP", &xdg_current_desktop)) {
+- // Not all desktop environments set this env var as of this writing.
+- if (base::StartsWith(xdg_current_desktop, "Unity",
+- base::CompareCase::SENSITIVE)) {
+- // gnome-fallback sessions set XDG_CURRENT_DESKTOP to Unity
+- // DESKTOP_SESSION can be gnome-fallback or gnome-fallback-compiz
+- std::string desktop_session;
+- if (env->GetVar("DESKTOP_SESSION", &desktop_session) &&
+- desktop_session.find("gnome-fallback") != std::string::npos) {
+- return DESKTOP_ENVIRONMENT_GNOME;
+- }
+- return DESKTOP_ENVIRONMENT_UNITY;
+- }
+- if (xdg_current_desktop == "GNOME")
+- return DESKTOP_ENVIRONMENT_GNOME;
+- if (xdg_current_desktop == "X-Cinnamon")
+- return DESKTOP_ENVIRONMENT_CINNAMON;
+- if (xdg_current_desktop == "KDE") {
+- std::string kde_session;
+- if (env->GetVar(kKDESessionEnvVar, &kde_session)) {
+- if (kde_session == "5") {
+- return DESKTOP_ENVIRONMENT_KDE5;
++ // It could have multiple values separated by colon in priority order.
++ for (const auto& value : SplitStringPiece(
++ xdg_current_desktop, ":", TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY)) {
++ if (value == "Unity") {
++ // gnome-fallback sessions set XDG_CURRENT_DESKTOP to Unity
++ // DESKTOP_SESSION can be gnome-fallback or gnome-fallback-compiz
++ std::string desktop_session;
++ if (env->GetVar("DESKTOP_SESSION", &desktop_session) &&
++ desktop_session.find("gnome-fallback") != std::string::npos) {
++ return DESKTOP_ENVIRONMENT_GNOME;
+ }
++ return DESKTOP_ENVIRONMENT_UNITY;
+ }
+- return DESKTOP_ENVIRONMENT_KDE4;
++ if (value == "GNOME")
++ return DESKTOP_ENVIRONMENT_GNOME;
++ if (value == "X-Cinnamon")
++ return DESKTOP_ENVIRONMENT_CINNAMON;
++ if (value == "KDE") {
++ std::string kde_session;
++ if (env->GetVar(kKDESessionEnvVar, &kde_session)) {
++ if (kde_session == "5") {
++ return DESKTOP_ENVIRONMENT_KDE5;
++ }
++ }
++ return DESKTOP_ENVIRONMENT_KDE4;
++ }
++ if (value == "Pantheon")
++ return DESKTOP_ENVIRONMENT_PANTHEON;
++ if (value == "XFCE")
++ return DESKTOP_ENVIRONMENT_XFCE;
+ }
+- if (xdg_current_desktop == "Pantheon")
+- return DESKTOP_ENVIRONMENT_PANTHEON;
+- if (xdg_current_desktop == "XFCE")
+- return DESKTOP_ENVIRONMENT_XFCE;
+ }
+
+ // DESKTOP_SESSION was what everyone used in 2010.
+diff --git a/base/nix/xdg_util_unittest.cc b/base/nix/xdg_util_unittest.cc
+index e195303..ad81836 100644
+--- a/base/nix/xdg_util_unittest.cc
++++ b/base/nix/xdg_util_unittest.cc
+@@ -34,6 +34,7 @@
+ const char* const kDesktopXFCE = "xfce";
+ const char* const kXdgDesktopCinnamon = "X-Cinnamon";
+ const char* const kXdgDesktopGNOME = "GNOME";
++const char* const kXdgDesktopGNOMEClassic = "GNOME:GNOME-Classic";
+ const char* const kXdgDesktopKDE = "KDE";
+ const char* const kXdgDesktopPantheon = "Pantheon";
+ const char* const kXdgDesktopUnity = "Unity";
+@@ -110,6 +111,15 @@
+ EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter));
+ }
+
++TEST(XDGUtilTest, GetXdgDesktopGnomeClassic) {
++ MockEnvironment getter;
++ EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false));
++ EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _))
++ .WillOnce(DoAll(SetArgPointee<1>(kXdgDesktopGNOMEClassic), Return(true)));
++
++ EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter));
++}
++
+ TEST(XDGUtilTest, GetXdgDesktopGnomeFallback) {
+ MockEnvironment getter;
+ EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false));