From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 032341382C5 for ; Fri, 12 Mar 2021 20:09:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E44AE0A95; Fri, 12 Mar 2021 20:09:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9D29FE0A95 for ; Fri, 12 Mar 2021 20:08:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A766F3408CF for ; Fri, 12 Mar 2021 20:08:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D59A746C for ; Fri, 12 Mar 2021 20:08:55 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1615579599.286732e1677d672669f19607f1db62780c62d746.asturm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtwebengine/files/, dev-qt/qtwebengine/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-fix-crash-w-app-locales.patch dev-qt/qtwebengine/qtwebengine-5.15.2_p20210224.ebuild X-VCS-Directories: dev-qt/qtwebengine/ dev-qt/qtwebengine/files/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: 286732e1677d672669f19607f1db62780c62d746 X-VCS-Branch: master Date: Fri, 12 Mar 2021 20:08:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9b957da4-0c40-40ef-9c41-bb262c676036 X-Archives-Hash: b264c1890fe7a32e64259fd8092ad01d commit: 286732e1677d672669f19607f1db62780c62d746 Author: Andreas Sturmlechner gentoo org> AuthorDate: Fri Mar 12 17:08:45 2021 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Fri Mar 12 20:06:39 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=286732e1 dev-qt/qtwebengine: Fix runtime crash with certain locales Due to the pain a revbump will cause and only a minority of users affected, the patch is applied in place and we will ask affected users to rebuild. Reported-by: 12101111 outlook.com> Thanks-to: Florian Bruhin the-compiler.org> Bug: https://bugs.gentoo.org/757606 Package-Manager: Portage-3.0.17, Repoman-3.0.2 Signed-off-by: Andreas Sturmlechner gentoo.org> ...-5.15.2_p20210224-fix-crash-w-app-locales.patch | 135 +++++++++++++++++++++ .../qtwebengine-5.15.2_p20210224.ebuild | 3 +- 2 files changed, 137 insertions(+), 1 deletion(-) diff --git a/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-fix-crash-w-app-locales.patch b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-fix-crash-w-app-locales.patch new file mode 100644 index 00000000000..3a372381ebd --- /dev/null +++ b/dev-qt/qtwebengine/files/qtwebengine-5.15.2_p20210224-fix-crash-w-app-locales.patch @@ -0,0 +1,135 @@ +From 199ea00a9eea13315a652c62778738629185b059 Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen +Date: Wed, 10 Mar 2021 17:14:27 +0100 +Subject: Fix normalization of app locales +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the internal Chromium routine to get the app locale Chromium +expects. + +Fixes: QTBUG-91715 +Change-Id: I5042eb066cb6879ad69628959912f2841867b4e8 +Reviewed-by: Michael BrĂ¼ning +--- + src/core/content_browser_client_qt.cpp | 7 ++++++- + src/core/content_browser_client_qt.h | 2 ++ + src/core/web_engine_library_info.cpp | 18 ++++++++-------- + .../widgets/qwebengineview/tst_qwebengineview.cpp | 24 ++++++++++++++++++++++ + 4 files changed, 40 insertions(+), 11 deletions(-) + +diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp +index e13ecd8d1..c2c78ff8b 100644 +--- a/src/core/content_browser_client_qt.cpp ++++ b/src/core/content_browser_client_qt.cpp +@@ -471,7 +471,12 @@ std::unique_ptr ContentBrowserClientQt::CreateClientCertSt + + std::string ContentBrowserClientQt::GetApplicationLocale() + { +- return WebEngineLibraryInfo::getApplicationLocale(); ++ std::string bcp47Name = QLocale().bcp47Name().toStdString(); ++ if (m_cachedQtLocale != bcp47Name) { ++ m_cachedQtLocale = bcp47Name; ++ m_appLocale = WebEngineLibraryInfo::getApplicationLocale(); ++ } ++ return m_appLocale; + } + + std::string ContentBrowserClientQt::GetAcceptLangs(content::BrowserContext *context) +diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h +index 7c8aa3ac9..1ccd2926d 100644 +--- a/src/core/content_browser_client_qt.h ++++ b/src/core/content_browser_client_qt.h +@@ -269,6 +269,8 @@ public: + + private: + scoped_refptr m_shareGroupQtQuick; ++ std::string m_appLocale; ++ std::string m_cachedQtLocale; + }; + + } // namespace QtWebEngineCore +diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp +index 2ad5b7565..09a4141b0 100644 +--- a/src/core/web_engine_library_info.cpp ++++ b/src/core/web_engine_library_info.cpp +@@ -46,6 +46,7 @@ + #include "components/spellcheck/spellcheck_buildflags.h" + #include "content/public/common/content_paths.h" + #include "sandbox/policy/switches.h" ++#include "ui/base/l10n/l10n_util.h" + #include "ui/base/ui_base_paths.h" + #include "ui/base/ui_base_switches.h" + +@@ -353,18 +354,15 @@ base::string16 WebEngineLibraryInfo::getApplicationName() + std::string WebEngineLibraryInfo::getApplicationLocale() + { + base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); +- if (!parsedCommandLine->HasSwitch(switches::kLang)) { ++ if (parsedCommandLine->HasSwitch(switches::kLang)) { ++ return parsedCommandLine->GetSwitchValueASCII(switches::kLang); ++ } else { + const QString &locale = QLocale().bcp47Name(); +- +- // QLocale::bcp47Name returns "en" for American English locale. Chromium requires the "US" suffix +- // to clarify the dialect and ignores the shorter version. +- if (locale == "en") +- return "en-US"; +- +- return locale.toStdString(); ++ std::string resolvedLocale; ++ if (l10n_util::CheckAndResolveLocale(locale.toStdString(), &resolvedLocale)) ++ return resolvedLocale; + } +- +- return parsedCommandLine->GetSwitchValueASCII(switches::kLang); ++ return "en-US"; + } + + #if defined(OS_WIN) +diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +index 021986381..bf2c28ae6 100644 +--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp ++++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +@@ -123,6 +123,7 @@ private Q_SLOTS: + void doNotBreakLayout(); + + void changeLocale(); ++ void mixLangLocale(); + void inputMethodsTextFormat_data(); + void inputMethodsTextFormat(); + void keyboardEvents(); +@@ -1210,6 +1211,29 @@ void tst_QWebEngineView::changeLocale() + QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar")); + } + ++void tst_QWebEngineView::mixLangLocale() ++{ ++ for (QString locale : { "en_DK", "de_CH", "eu_ES" }) { ++ QLocale::setDefault(locale); ++ QWebEngineView view; ++ QSignalSpy loadSpy(&view, &QWebEngineView::loadFinished); ++ ++ bool terminated = false; ++ auto sc = connect(view.page(), &QWebEnginePage::renderProcessTerminated, [&] () { terminated = true; }); ++ ++ view.load(QUrl("qrc:///resources/dummy.html")); ++ QTRY_VERIFY(terminated || loadSpy.count() == 1); ++ ++ QVERIFY2(!terminated, ++ qPrintable(QString("Locale [%1] terminated: %2, loaded: %3").arg(locale).arg(terminated).arg(loadSpy.count()))); ++ QVERIFY(loadSpy.first().first().toBool()); ++ ++ QString content = toPlainTextSync(view.page()); ++ QVERIFY2(!content.isEmpty() && content.contains("test content"), qPrintable(content)); ++ } ++ QLocale::setDefault(QLocale("en")); ++} ++ + void tst_QWebEngineView::inputMethodsTextFormat_data() + { + QTest::addColumn("string"); +-- +cgit v1.2.1 + diff --git a/dev-qt/qtwebengine/qtwebengine-5.15.2_p20210224.ebuild b/dev-qt/qtwebengine/qtwebengine-5.15.2_p20210224.ebuild index 2c33bc250e6..bd9662af876 100644 --- a/dev-qt/qtwebengine/qtwebengine-5.15.2_p20210224.ebuild +++ b/dev-qt/qtwebengine/qtwebengine-5.15.2_p20210224.ebuild @@ -89,7 +89,8 @@ DEPEND="${RDEPEND} PATCHES=( "${FILESDIR}/${PN}-5.15.0-disable-fatal-warnings.patch" # bug 695446 - "${FILESDIR}/${P}-chromium-87-v8-icu68.patch" # bug 757606 + "${FILESDIR}/${P}-fix-crash-w-app-locales.patch" # bug 773919, QTBUG-91715 + "${FILESDIR}/${P}-chromium-87-v8-icu68.patch" # downstream, bug 757606 "${FILESDIR}/${P}-disable-git.patch" # downstream snapshot fix )