[packages/qt6] add patch for QTBUG-113109; rel 4

atler atler at pld-linux.org
Fri Apr 28 10:05:01 CEST 2023


commit a7eecb0b15103c4e4ffc6ca9ec7a2d3fa7b9c032
Author: Jan Palus <atler at pld-linux.org>
Date:   Fri Apr 28 09:59:48 2023 +0200

    add patch for QTBUG-113109; rel 4
    
    upstream ticket: https://bugreports.qt.io/browse/QTBUG-113109
    fixes: https://github.com/qutebrowser/qutebrowser/issues/7662

 QTBUG-113109.patch | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 qt6.spec           |   6 ++-
 2 files changed, 120 insertions(+), 1 deletion(-)
---
diff --git a/qt6.spec b/qt6.spec
index 4b8af18..dde4a3a 100644
--- a/qt6.spec
+++ b/qt6.spec
@@ -107,7 +107,7 @@ Summary:	Qt6 Library
 Summary(pl.UTF-8):	Biblioteka Qt6
 Name:		qt6
 Version:	6.5.0
-Release:	3
+Release:	4
 License:	LGPL v3 or GPL v2 or GPL v3 or commercial
 Group:		X11/Libraries
 Source0:	https://download.qt.io/official_releases/qt/6.5/%{version}/single/qt-everywhere-src-%{version}.tar.xz
@@ -118,6 +118,7 @@ Patch2:		%{name}-gn.patch
 Patch3:		no-implicit-sse2.patch
 Patch4:		x32.patch
 Patch5:		qtwebengine-cmake-build-type.patch
+Patch6:		QTBUG-113109.patch
 URL:		https://www.qt.io/
 %{?with_directfb:BuildRequires:	DirectFB-devel}
 BuildRequires:	EGL-devel
@@ -3584,6 +3585,9 @@ narzędzia.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+cd qtwebengine
+%patch6 -p1
+cd ..
 
 %{__sed} -i -e 's,usr/X11R6/,usr/,g' qtbase/mkspecs/linux-g++-64/qmake.conf
 
diff --git a/QTBUG-113109.patch b/QTBUG-113109.patch
new file mode 100644
index 0000000..2f84b60
--- /dev/null
+++ b/QTBUG-113109.patch
@@ -0,0 +1,115 @@
+From 22ab520f5457a5272d904ac23cfb29ca6aca27d2 Mon Sep 17 00:00:00 2001
+From: Allan Sandfeld Jensen <allan.jensen at qt.io>
+Date: Mon, 24 Apr 2023 17:33:17 +0200
+Subject: [PATCH] Fix user script management when subframes are present
+
+Only the main frames should administer scripts associated with it.
+
+Pick-to: 6.5
+Fixes: QTBUG-113109
+Change-Id: Ibda66f55ef99da632134a9de1425797262faba9b
+---
+
+diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp
+index c49ecd3..ce942e0 100644
+--- a/src/core/renderer/user_resource_controller.cpp
++++ b/src/core/renderer/user_resource_controller.cpp
+@@ -289,10 +289,11 @@
+     FrameUserScriptMap::iterator it = m_frameUserScriptMap.find(renderFrame);
+     if (it == m_frameUserScriptMap.end()) // ASSERT maybe?
+         return;
+-    for (uint64_t id : std::as_const(it.value())) {
+-        m_scripts.remove(id);
++    if (renderFrame->IsMainFrame()) {
++        for (uint64_t id : std::as_const(it.value()))
++            m_scripts.remove(id);
+     }
+-    m_frameUserScriptMap.remove(renderFrame);
++    m_frameUserScriptMap.erase(it);
+ }
+ 
+ void UserResourceController::addScriptForFrame(const QtWebEngineCore::UserScriptData &script,
+@@ -304,7 +305,8 @@
+ 
+     if (!(*it).contains(script.scriptId))
+         (*it).append(script.scriptId);
+-    m_scripts.insert(script.scriptId, script);
++    if (!frame || frame->IsMainFrame())
++        m_scripts.insert(script.scriptId, script);
+ }
+ 
+ void UserResourceController::removeScriptForFrame(const QtWebEngineCore::UserScriptData &script,
+@@ -315,7 +317,8 @@
+         return;
+ 
+     (*it).removeOne(script.scriptId);
+-    m_scripts.remove(script.scriptId);
++    if (!frame || frame->IsMainFrame())
++        m_scripts.remove(script.scriptId);
+ }
+ 
+ void UserResourceController::clearScriptsForFrame(content::RenderFrame *frame)
+@@ -323,8 +326,10 @@
+     FrameUserScriptMap::iterator it = m_frameUserScriptMap.find(frame);
+     if (it == m_frameUserScriptMap.end())
+         return;
+-    for (uint64_t id : std::as_const(it.value()))
+-        m_scripts.remove(id);
++    if (!frame || frame->IsMainFrame()) {
++        for (uint64_t id : std::as_const(it.value()))
++            m_scripts.remove(id);
++    }
+ 
+     m_frameUserScriptMap.remove(frame);
+ }
+diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+index ed12fdb..9ba1358 100644
+--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
++++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+@@ -76,6 +76,7 @@
+     void scriptsInNestedIframes();
+     void matchQrcUrl();
+     void injectionOrder();
++    void reloadWithSubframes();
+ };
+ 
+ void tst_QWebEngineScript::domEditing()
+@@ -694,6 +695,38 @@
+     QTRY_COMPARE(page.log, expected);
+ }
+ 
++void tst_QWebEngineScript::reloadWithSubframes()
++{
++    class Page : public QWebEnginePage
++    {
++    public:
++        Page() : QWebEnginePage() {}
++        QVector<QString> log;
++
++    protected:
++        void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel, const QString &message, int,
++                                      const QString &) override
++        {
++            log.append(message);
++        }
++    } page;
++
++    QWebEngineScript s;
++    s.setInjectionPoint(QWebEngineScript::DocumentCreation);
++    s.setSourceCode(QStringLiteral("console.log('Hello');"));
++    page.scripts().insert(s);
++
++    page.setHtml(QStringLiteral("<body>"
++                                "  <h1>Test scripts working on reload </h1>"
++                                "  <iframe src='about://blank'>"
++                                "  </iframe>"
++                                "</body>"));
++    QTRY_COMPARE(page.log.size(), 1);
++
++    page.triggerAction(QWebEnginePage::Reload);
++    QTRY_COMPARE(page.log.size(), 2);
++}
++
+ QTEST_MAIN(tst_QWebEngineScript)
+ 
+ #include "tst_qwebenginescript.moc"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/qt6.git/commitdiff/a7eecb0b15103c4e4ffc6ca9ec7a2d3fa7b9c032



More information about the pld-cvs-commit mailing list