Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qt6-webchannel for openSUSE:Factory checked in at 2023-04-05 21:32:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qt6-webchannel (Old) and /work/SRC/openSUSE:Factory/.qt6-webchannel.new.19717 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qt6-webchannel" Wed Apr 5 21:32:16 2023 rev:13 rq:1077351 version:6.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/qt6-webchannel/qt6-webchannel.changes 2023-03-17 17:04:17.669690480 +0100 +++ /work/SRC/openSUSE:Factory/.qt6-webchannel.new.19717/qt6-webchannel.changes 2023-04-05 21:37:17.931131385 +0200 @@ -1,0 +2,6 @@ +Mon Apr 3 10:02:57 UTC 2023 - Christophe Marin <christo...@krop.fr> + +- Update to 6.5.0 + * https://www.qt.io/blog/qt-6.5-lts-released + +------------------------------------------------------------------- Old: ---- qtwebchannel-everywhere-src-6.4.3.tar.xz New: ---- qtwebchannel-everywhere-src-6.5.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qt6-webchannel.spec ++++++ --- /var/tmp/diff_new_pack.8XiFH6/_old 2023-04-05 21:37:18.411134124 +0200 +++ /var/tmp/diff_new_pack.8XiFH6/_new 2023-04-05 21:37:18.419134170 +0200 @@ -1,7 +1,7 @@ # # spec file for package qt6-webchannel # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,8 +16,8 @@ # -%define real_version 6.4.3 -%define short_version 6.4 +%define real_version 6.5.0 +%define short_version 6.5 %define tar_name qtwebchannel-everywhere-src %define tar_suffix %{nil} # @@ -27,7 +27,7 @@ %endif # Name: qt6-webchannel%{?pkg_suffix} -Version: 6.4.3 +Version: 6.5.0 Release: 0 Summary: Qt 6 WebChannel library License: LGPL-3.0-only OR (GPL-2.0-only OR GPL-3.0-or-later) @@ -37,15 +37,15 @@ BuildRequires: fdupes BuildRequires: pkgconfig BuildRequires: qt6-core-private-devel -BuildRequires: cmake(Qt6Concurrent) -BuildRequires: cmake(Qt6Core) -BuildRequires: cmake(Qt6Gui) -BuildRequires: cmake(Qt6Qml) -BuildRequires: cmake(Qt6Quick) -BuildRequires: cmake(Qt6QuickTest) -BuildRequires: cmake(Qt6Test) -BuildRequires: cmake(Qt6WebSockets) -BuildRequires: cmake(Qt6Widgets) +BuildRequires: cmake(Qt6Concurrent) = %{real_version} +BuildRequires: cmake(Qt6Core) = %{real_version} +BuildRequires: cmake(Qt6Gui) = %{real_version} +BuildRequires: cmake(Qt6Qml) = %{real_version} +BuildRequires: cmake(Qt6Quick) = %{real_version} +BuildRequires: cmake(Qt6QuickTest) = %{real_version} +BuildRequires: cmake(Qt6Test) = %{real_version} +BuildRequires: cmake(Qt6WebSockets) = %{real_version} +BuildRequires: cmake(Qt6Widgets) = %{real_version} %if "%{qt6_flavor}" == "docs" BuildRequires: qt6-tools %{qt6_doc_packages} @@ -73,14 +73,13 @@ %package devel Summary: Qt 6 WebChannel library - Development files Requires: libQt6WebChannel6 = %{version} -Requires: cmake(Qt6Qml) +Requires: cmake(Qt6Qml) = %{real_version} %description devel Development files for the Qt 6 WebChannel library %package private-devel Summary: Non-ABI stable API for the Qt 6 WebChannel library -Requires: qt6-core-private-devel Requires: cmake(Qt6WebChannel) = %{real_version} %requires_eq qt6-core-private-devel ++++++ qtwebchannel-everywhere-src-6.4.3.tar.xz -> qtwebchannel-everywhere-src-6.5.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/.cmake.conf new/qtwebchannel-everywhere-src-6.5.0/.cmake.conf --- old/qtwebchannel-everywhere-src-6.4.3/.cmake.conf 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/.cmake.conf 2023-03-28 21:20:08.000000000 +0200 @@ -1,2 +1,3 @@ -set(QT_REPO_MODULE_VERSION "6.4.3") +set(QT_REPO_MODULE_VERSION "6.5.0") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") +set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/.tag new/qtwebchannel-everywhere-src-6.5.0/.tag --- old/qtwebchannel-everywhere-src-6.4.3/.tag 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/.tag 2023-03-28 21:20:08.000000000 +0200 @@ -1 +1 @@ -676cf861f18699da28218a5d46563c15e800d688 +0fbbb1a2df14f41ff80d06bb23ceeb0b67baf852 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qtwebchannel.pro. cmake_minimum_required(VERSION 3.16) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/dependencies.yaml new/qtwebchannel-everywhere-src-6.5.0/dependencies.yaml --- old/qtwebchannel-everywhere-src-6.4.3/dependencies.yaml 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/dependencies.yaml 2023-03-28 21:20:08.000000000 +0200 @@ -1,10 +1,10 @@ dependencies: ../qtbase: - ref: 519d2d8f442409e86a0ee2fa16bd543342180861 + ref: aea92807be2567c4212b96ae67de7137075ba4ee required: true ../qtdeclarative: - ref: 7161b3a04d08aea891bd7c7e459437260d29c3f3 + ref: 3238e18d6b0dc45d2e765fb0b93da5cbf3f396ec required: false ../qtwebsockets: - ref: 5c50ad5eef1fc179d846e175b0612a76b2a63d09 + ref: 5c92cce2f79edcd26d05608d86351b82d1c00373 required: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/examples/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/examples/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/examples/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/examples/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + qt_examples_build_begin(EXTERNAL_BUILD) add_subdirectory(webchannel) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # These are all TEMPLATE = aux #qt_internal_add_example(nodejs) #qt_internal_add_example(qwclient) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/chatserver-cpp/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/chatserver-cpp/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/chatserver-cpp/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/chatserver-cpp/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + cmake_minimum_required(VERSION 3.16) project(chatserver LANGUAGES CXX) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/shared/qwebchannel.js new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/shared/qwebchannel.js --- old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/shared/qwebchannel.js 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/shared/qwebchannel.js 2023-03-28 21:20:08.000000000 +0200 @@ -17,7 +17,7 @@ response: 10, }; -var QWebChannel = function(transport, initCallback) +var QWebChannel = function(transport, initCallback, converters) { if (typeof transport !== "object" || typeof transport.send !== "function") { console.error("The QWebChannel expects a transport object with a send function and onmessage callback property." + @@ -28,6 +28,43 @@ var channel = this; this.transport = transport; + var converterRegistry = + { + Date : function(response) { + if (typeof response === "string" + && response.match( + /^-?\d+-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d*)?([-+\u2212](\d{2}):(\d{2})|Z)?$/)) { + var date = new Date(response); + if (!isNaN(date)) + return date; + } + return undefined; // Return undefined if current converter is not applicable + } + }; + + this.usedConverters = []; + + this.addConverter = function(converter) + { + if (typeof converter === "string") { + if (converterRegistry.hasOwnProperty(converter)) + this.usedConverters.push(converterRegistry[converter]); + else + console.error("Converter '" + converter + "' not found"); + } else if (typeof converter === "function") { + this.usedConverters.push(converter); + } else { + console.error("Invalid converter object type " + typeof converter); + } + } + + if (Array.isArray(converters)) { + for (const converter of converters) + this.addConverter(converter); + } else if (converters !== undefined) { + this.addConverter(converters); + } + this.send = function(data) { if (typeof(data) !== "string") { @@ -154,6 +191,12 @@ this.unwrapQObject = function(response) { + for (const converter of webChannel.usedConverters) { + var result = converter(response); + if (result !== undefined) + return result; + } + if (response instanceof Array) { // support list of objects return response.map(qobj => object.unwrapQObject(qobj)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/standalone/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/standalone/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/examples/webchannel/standalone/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/examples/webchannel/standalone/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + cmake_minimum_required(VERSION 3.16) project(standalone LANGUAGES CXX) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/qmetaobjectpublisher_p.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/qmetaobjectpublisher_p.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/qmetaobjectpublisher_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/qmetaobjectpublisher_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../../../../src/webchannel/qmetaobjectpublisher_p.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/qqmlwebchannelattached_p.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/qqmlwebchannelattached_p.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/qqmlwebchannelattached_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/qqmlwebchannelattached_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../../../../src/webchannel/qqmlwebchannelattached_p.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/qwebchannel_p.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/qwebchannel_p.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/qwebchannel_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/qwebchannel_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../../../../src/webchannel/qwebchannel_p.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/signalhandler_p.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/signalhandler_p.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/signalhandler_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/signalhandler_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../../../../src/webchannel/signalhandler_p.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/variantargument_p.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/variantargument_p.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/6.4.3/QtWebChannel/private/variantargument_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/6.4.3/QtWebChannel/private/variantargument_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../../../../src/webchannel/variantargument_p.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QQmlWebChannel new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QQmlWebChannel --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QQmlWebChannel 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QQmlWebChannel 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "qqmlwebchannel.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QWebChannel new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QWebChannel --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QWebChannel 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QWebChannel 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "qwebchannel.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QWebChannelAbstractTransport new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QWebChannelAbstractTransport --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QWebChannelAbstractTransport 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QWebChannelAbstractTransport 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "qwebchannelabstracttransport.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QtWebChannel new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QtWebChannel --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QtWebChannel 2023-03-12 11:00:39.170240400 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QtWebChannel 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -#ifndef QT_QTWEBCHANNEL_MODULE_H -#define QT_QTWEBCHANNEL_MODULE_H -#include <QtWebChannel/QtWebChannelDepends> -#include "qwebchannelglobal.h" -#include "qqmlwebchannel.h" -#include "qwebchannel.h" -#include "qwebchannelabstracttransport.h" -#include "qtwebchannelversion.h" -#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QtWebChannelVersion new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QtWebChannelVersion --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/QtWebChannelVersion 2023-03-12 11:00:39.170240400 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/QtWebChannelVersion 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "qtwebchannelversion.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/headers.pri new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/headers.pri --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/headers.pri 2023-03-12 11:00:39.170240400 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/headers.pri 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -SYNCQT.HEADER_FILES = qqmlwebchannel.h qwebchannel.h qwebchannelabstracttransport.h qwebchannelglobal.h -SYNCQT.GENERATED_HEADER_FILES = QQmlWebChannel QWebChannel QWebChannelAbstractTransport qtwebchannelversion.h QtWebChannelVersion QtWebChannel -SYNCQT.PRIVATE_HEADER_FILES = qmetaobjectpublisher_p.h qqmlwebchannelattached_p.h qwebchannel_p.h signalhandler_p.h variantargument_p.h -SYNCQT.QPA_HEADER_FILES = -SYNCQT.CLEAN_HEADER_FILES = qqmlwebchannel.h qwebchannel.h qwebchannelabstracttransport.h qwebchannelglobal.h -SYNCQT.INJECTIONS = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qqmlwebchannel.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qqmlwebchannel.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qqmlwebchannel.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qqmlwebchannel.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../src/webchannel/qqmlwebchannel.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qtwebchannelversion.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qtwebchannelversion.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qtwebchannelversion.h 2023-03-12 11:00:39.170240400 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qtwebchannelversion.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -/* This file was generated by syncqt. */ -#ifndef QT_QTWEBCHANNEL_VERSION_H -#define QT_QTWEBCHANNEL_VERSION_H - -#define QTWEBCHANNEL_VERSION_STR "6.4.3" - -#define QTWEBCHANNEL_VERSION 0x060403 - -#endif // QT_QTWEBCHANNEL_VERSION_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qwebchannel.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qwebchannel.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qwebchannel.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qwebchannel.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../src/webchannel/qwebchannel.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qwebchannelabstracttransport.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qwebchannelabstracttransport.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qwebchannelabstracttransport.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qwebchannelabstracttransport.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../src/webchannel/qwebchannelabstracttransport.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qwebchannelglobal.h new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qwebchannelglobal.h --- old/qtwebchannel-everywhere-src-6.4.3/include/QtWebChannel/qwebchannelglobal.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/include/QtWebChannel/qwebchannelglobal.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include "../../src/webchannel/qwebchannelglobal.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/src/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/src/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from src.pro. add_subdirectory(webchannel) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/imports/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/src/imports/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/src/imports/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/imports/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from imports.pro. add_subdirectory(webchannel) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/imports/webchannel/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/src/imports/webchannel/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/src/imports/webchannel/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/imports/webchannel/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from webchannel.pro. ##################################################################### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from webchannel.pro. ##################################################################### @@ -10,7 +13,7 @@ qwebchannel.cpp qwebchannel.h qwebchannel_p.h qwebchannelabstracttransport.cpp qwebchannelabstracttransport.h signalhandler_p.h - variantargument_p.h + qwebchannelglobal.h LIBRARIES Qt::CorePrivate PUBLIC_LIBRARIES @@ -46,16 +49,12 @@ qt_internal_extend_target(WebChannel CONDITION TARGET Qt::Qml SOURCES - qqmlwebchannel.cpp - qqmlwebchannelattached.cpp + qqmlwebchannel.cpp qqmlwebchannel.h + qqmlwebchannelattached.cpp qqmlwebchannelattached_p.h PUBLIC_LIBRARIES Qt::Qml ) -#### Keys ignored in scope 2:.:.:webchannel.pro:TARGET Qt::Qml: -# PRIVATE_HEADERS = "qqmlwebchannelattached_p.h" -# PUBLIC_HEADERS = "qqmlwebchannel.h" - qt_internal_extend_target(WebChannel CONDITION NOT TARGET Qt::Qml DEFINES QT_NO_JSVALUE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/doc/src/javascript.qdoc new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/doc/src/javascript.qdoc --- old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/doc/src/javascript.qdoc 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/doc/src/javascript.qdoc 2023-03-28 21:20:08.000000000 +0200 @@ -14,7 +14,8 @@ can load the file via \c qrc:///qtwebchannel/qwebchannel.js. For external clients, you need to copy the file to your web server. Then instantiate a QWebChannel object and pass it a transport object and a callback function, which will be invoked once the - initialization of the channel finishes and the published objects become available. + initialization of the channel finishes and the published objects become available. An optional + third argument contains an array of converter wrapper functions or a single one. The transport object implements a minimal message passing interface. It should be an object with a \c send() function, which takes a stringified JSON message and transmits it to the @@ -27,6 +28,14 @@ socket's \c onopen handler. Take a look at the \l{Qt WebChannel Standalone Example} to see how this is done. + A converter wrapper function is either a string with the name of a built-in converter or a + user supplied function that takes the object to process as an argument and returns the + resultant type or undefined if the function does not apply. If undefined is returned the next + converter is processed. If there are no converters that returns a value other than undefined, + processing proceeds as normal. "Date" is the only currently built-in converter function. It + takes a string with an ISO 8601 date and returns a new Date object if the syntax is right and + the date is valid. + \section1 Interacting with QObjects Once the callback passed to the QWebChannel object is invoked, the channel has finished diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/qmetaobjectpublisher.cpp new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/qmetaobjectpublisher.cpp --- old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/qmetaobjectpublisher.cpp 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/qmetaobjectpublisher.cpp 2023-03-28 21:20:08.000000000 +0200 @@ -20,6 +20,8 @@ #endif #include <QUuid> +#include <QtCore/private/qmetaobject_p.h> + QT_BEGIN_NAMESPACE namespace { @@ -507,6 +509,66 @@ sendEnqueuedPropertyUpdates(state.key()); } +QVariant QMetaObjectPublisher::invokeMethod_helper(QObject *const object, const QMetaMethod &method, + const QJsonArray &args) +{ + // a good value for the number of arguments we'll preallocate in QVLA + constexpr qsizetype ArgumentCount = 16; + + QVarLengthArray<QVariant, ArgumentCount> variants; + QVarLengthArray<const char *, ArgumentCount> names(method.parameterCount() + 1); + QVarLengthArray<void *, ArgumentCount> parameters(names.size()); + QVarLengthArray<const QtPrivate::QMetaTypeInterface *, ArgumentCount> metaTypes(names.size()); + variants.reserve(names.size()); + variants << QVariant(); + + // start with the formal parameters + for (qsizetype i = 0; i < names.size() - 1; ++i) { + QMetaType mt = method.parameterMetaType(i); + QVariant &v = variants.emplace_back(toVariant(args.at(i), mt.id())); + parameters[i + 1] = v.data(); + names[i + 1] = mt.name(); + metaTypes[i + 1] = mt.iface(); + } + + // now, the return type + QMetaType mt = method.returnMetaType(); + names[0] = mt.name(); + metaTypes[0] = mt.iface(); + if (int id = mt.id(); id != QMetaType::Void) { + // Only init variant with return type if its not a variant itself, + // which would lead to nested variants which is not what we want. + if (id == QMetaType::QVariant) { + parameters[0] = &variants[0]; + } else { + variants[0] = QVariant(mt); + parameters[0] = variants[0].data(); + } + } else { + parameters[0] = nullptr; + } + + // step 3: make the call + QMetaMethodInvoker::InvokeFailReason r = + QMetaMethodInvoker::invokeImpl(method, object, Qt::AutoConnection, + parameters.size(), parameters.constData(), + names.constData(), metaTypes.constData()); + + if (r == QMetaMethodInvoker::InvokeFailReason::None) + return variants.first(); + + // print warnings for failures to match + if (int(r) >= int(QMetaMethodInvoker::InvokeFailReason::FormalParameterMismatch)) { + int n = int(r) - int(QMetaMethodInvoker::InvokeFailReason::FormalParameterMismatch); + QByteArray callee = object->metaObject()->className() + QByteArrayView("::") + + method.methodSignature(); + qWarning() << "Cannot convert formal parameter" << n << "from" << names[n + 1] + << "in call to" << callee.constData(); + } + + return QJsonValue(); +} + QVariant QMetaObjectPublisher::invokeMethod(QObject *const object, const QMetaMethod &method, const QJsonArray &args) { @@ -523,41 +585,12 @@ } else if (method.methodType() != QMetaMethod::Method && method.methodType() != QMetaMethod::Slot) { qWarning() << "Cannot invoke non-public method" << method.name() << "on object" << object << '.'; return QJsonValue(); - } else if (args.size() > 10) { - qWarning() << "Cannot invoke method" << method.name() << "on object" << object << "with more than 10 arguments, as that is not supported by QMetaMethod::invoke."; - return QJsonValue(); } else if (args.size() > method.parameterCount()) { qWarning() << "Ignoring additional arguments while invoking method" << method.name() << "on object" << object << ':' << args.size() << "arguments given, but method only takes" << method.parameterCount() << '.'; } - // construct converter objects of QVariant to QGenericArgument - VariantArgument arguments[10]; - for (int i = 0; i < qMin(args.size(), method.parameterCount()); ++i) { - arguments[i].value = toVariant(args.at(i), method.parameterType(i)); - arguments[i].type = method.parameterType(i); - } - // construct QGenericReturnArgument - QVariant returnValue; - if (method.returnType() == QMetaType::Void) { - // Skip return for void methods (prevents runtime warnings inside Qt), and allows - // QMetaMethod to invoke void-returning methods on QObjects in a different thread. - method.invoke(object, - arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], - arguments[5], arguments[6], arguments[7], arguments[8], arguments[9]); - } else { - // Only init variant with return type if its not a variant itself, which would - // lead to nested variants which is not what we want. - if (method.returnType() != QMetaType::QVariant) - returnValue = QVariant(QMetaType(method.returnType()), nullptr); - - QGenericReturnArgument returnArgument(method.typeName(), returnValue.data()); - method.invoke(object, returnArgument, - arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], - arguments[5], arguments[6], arguments[7], arguments[8], arguments[9]); - } - // now we can call the method - return returnValue; + return invokeMethod_helper(object, method, args); } QVariant QMetaObjectPublisher::invokeMethod(QObject *const object, const int methodIndex, @@ -583,8 +616,7 @@ if (method.name() != methodName || method.parameterCount() != args.count() || method.access() != QMetaMethod::Public || (method.methodType() != QMetaMethod::Method - && method.methodType() != QMetaMethod::Slot) - || method.parameterCount() > 10) + && method.methodType() != QMetaMethod::Slot)) { // Not a candidate continue; @@ -600,13 +632,13 @@ } std::sort(candidates.begin(), candidates.end()); - if (candidates.size() > 1 && candidates[0].badness == candidates[1].badness) { qWarning().nospace() << "Ambiguous overloads for method " << methodName << ". Choosing " << candidates.first().method.methodSignature(); + } - return invokeMethod(object, candidates.first().method, args); + return invokeMethod_helper(object, candidates.first().method, args); } void QMetaObjectPublisher::setProperty(QObject *object, const int propertyIndex, const QJsonValue &value) @@ -984,7 +1016,6 @@ void QMetaObjectPublisher::broadcastMessage(const QJsonObject &message) const { if (webChannel->d_func()->transports.isEmpty()) { - qWarning("QWebChannel is not connected to any transports, cannot send message: %s", QJsonDocument(message).toJson().constData()); return; } @@ -996,8 +1027,6 @@ void QMetaObjectPublisher::enqueueBroadcastMessage(const QJsonObject &message) { if (webChannel->d_func()->transports.isEmpty()) { - qWarning("QWebChannel is not connected to any transports, cannot send message: %s", - QJsonDocument(message).toJson().constData()); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/qmetaobjectpublisher_p.h new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/qmetaobjectpublisher_p.h --- old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/qmetaobjectpublisher_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/qmetaobjectpublisher_p.h 2023-03-28 21:20:08.000000000 +0200 @@ -15,7 +15,7 @@ // We mean it. // -#include "variantargument_p.h" +#include "qwebchannelglobal.h" #include "signalhandler_p.h" #include <QStringList> @@ -29,8 +29,6 @@ #include <unordered_map> -#include "qwebchannelglobal.h" - QT_BEGIN_NAMESPACE // NOTE: keep in sync with corresponding maps in qwebchannel.js and WebChannelTest.qml @@ -154,6 +152,12 @@ void sendPendingPropertyUpdates(); /** + * Helper function for the invokeMehtods below + */ + QVariant invokeMethod_helper(QObject *const object, const QMetaMethod &method, + const QJsonArray &args); + + /** * Invoke the @p method on @p object with the arguments @p args. * * The return value of the method invocation is then serialized and a response message diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/variantargument_p.h new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/variantargument_p.h --- old/qtwebchannel-everywhere-src-6.4.3/src/webchannel/variantargument_p.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/src/webchannel/variantargument_p.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,45 +0,0 @@ -// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, i...@kdab.com, author Milian Wolff <milian.wo...@kdab.com> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - -#ifndef VARIANTARGUMENT_H -#define VARIANTARGUMENT_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QVariant> -#include <private/qglobal_p.h> - -QT_BEGIN_NAMESPACE - -/** - * RAII QVariant to Q[Generic]Argument conversion - */ -struct VariantArgument -{ - operator QGenericArgument() const - { - if (type == QMetaType::QVariant) { - return Q_ARG(QVariant, value); - } - if (!value.isValid()) { - return QGenericArgument(); - } - return QGenericArgument(value.typeName(), value.constData()); - } - - QVariant value; - int type; -}; - -QT_END_NAMESPACE - -#endif // VARIANTARGUMENT_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/tests/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/tests/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from tests.pro. if(QT_BUILD_STANDALONE_TESTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/tests/auto/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + add_subdirectory(cmake) add_subdirectory(webchannel) if(TARGET Qt::Quick) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/cmake/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/tests/auto/cmake/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/cmake/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/cmake/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # This is an automatic test for the CMake configuration files. # To run it manually, # 1) mkdir build # Create a build directory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qml.pro. ##################################################################### @@ -20,7 +23,7 @@ testobject.cpp testobject.h testtransport.cpp testtransport.h testwebchannel.cpp testwebchannel.h - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Gui Qt::WebChannelPrivate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/data/tst_webchannel.qml new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/data/tst_webchannel.qml --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/data/tst_webchannel.qml 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/data/tst_webchannel.qml 2023-03-28 21:20:08.000000000 +0200 @@ -36,6 +36,11 @@ property var bar: 1 WebChannel.id: "myOtherObj" } + QtObject { + id: myValueObj + property var value: undefined + WebChannel.id: "myValueObj" + } property var lastFactoryObj QtObject{ id: bar; objectName: "bar" } QtObject{ id: baz; objectName: "baz" } @@ -76,7 +81,7 @@ TestWebChannel { id: webChannel transports: [client.serverTransport] - registeredObjects: [myObj, myOtherObj, myFactory, testObject] + registeredObjects: [myObj, myOtherObj, myValueObj, myFactory, testObject] } function initChannel() { @@ -686,4 +691,56 @@ compare(success, true); } + + function test_customUpcaseWrapper() + { + var channel = client.createChannel(function(channel) { + channel.objects.testObject.stringProperty = "foo"; + }, function(arg) { return (typeof arg === "string") ? arg.toUpperCase() : undefined }); + + client.awaitInit(); + function awaitMessage(type) + { + var msg = client.awaitMessage(); + compare(msg.type, type); + compare(msg.object, "testObject"); + } + awaitMessage(JSClient.QWebChannelMessageTypes.setProperty); + compare(testObject.stringProperty, "foo"); // Don't convert in this direction + client.awaitIdle(); // init + + testObject.stringProperty = "bar"; + compare(testObject.stringProperty, "bar"); + client.awaitIdle(); // property update + compare(channel.objects.testObject.stringProperty, "BAR"); // Case converted + } + + function test_dateWrapper() + { + var channel = client.createChannel(undefined, "Date"); + client.awaitInit(); + client.awaitIdle(); + + var dateString = "2022-01-01T10:00:00Z"; + myValueObj.value = dateString; + compare(myValueObj.value, dateString); + client.awaitIdle(); // property update + var value = channel.objects.myValueObj.value; + verify(value instanceof Date); + verify(!isNaN(value)); + compare(value.getUTCFullYear(), 2022); + compare(value.getUTCMonth(), 0); // 0 = January + compare(value.getUTCDate(), 1); + compare(value.getUTCHours(), 10); + compare(value.getUTCMinutes(), 0); + compare(value.getUTCSeconds(), 0); + + var invalidDate = "2022-13-31T10:00:00Z"; // Month after december + myValueObj.value = invalidDate; + compare(myValueObj.value, invalidDate); + client.awaitIdle(); // property update + value = channel.objects.myValueObj.value; + verify(typeof value === "string"); // Not converted to Date + compare(value, invalidDate); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/qml.cpp new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/qml.cpp --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/qml.cpp 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/qml.cpp 2023-03-28 21:20:08.000000000 +0200 @@ -5,7 +5,7 @@ #include <QtQml/qqml.h> #ifndef QUICK_TEST_SOURCE_DIR -#define QUICK_TEST_SOURCE_DIR Q_NULLPTR +#define QUICK_TEST_SOURCE_DIR nullptr #endif #include "testtransport.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/testobject.h new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/testobject.h --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/qml/testobject.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/qml/testobject.h 2023-03-28 21:20:08.000000000 +0200 @@ -17,7 +17,7 @@ Q_PROPERTY(QVariantMap objectMap READ objectMap CONSTANT) Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty BINDABLE bindableStringProperty) public: - explicit TestObject(QObject *parent = Q_NULLPTR); + explicit TestObject(QObject *parent = nullptr); ~TestObject(); QVariantMap objectMap() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/webchannel/CMakeLists.txt new/qtwebchannel-everywhere-src-6.5.0/tests/auto/webchannel/CMakeLists.txt --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/webchannel/CMakeLists.txt 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/webchannel/CMakeLists.txt 2023-03-28 21:20:08.000000000 +0200 @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from webchannel.pro. ##################################################################### @@ -9,7 +12,7 @@ tst_webchannel.cpp tst_webchannel.h INCLUDE_DIRECTORIES ../../../src/webchannel - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::WebChannelPrivate ) @@ -20,13 +23,13 @@ qt_internal_extend_target(tst_webchannel CONDITION TARGET Qt::Qml DEFINES WEBCHANNEL_TESTS_CAN_USE_JS_ENGINE - PUBLIC_LIBRARIES + LIBRARIES Qt::Qml ) qt_internal_extend_target(tst_webchannel CONDITION TARGET Qt::Concurrent DEFINES WEBCHANNEL_TESTS_CAN_USE_CONCURRENT - PUBLIC_LIBRARIES + LIBRARIES Qt::Concurrent ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/webchannel/tst_webchannel.cpp new/qtwebchannel-everywhere-src-6.5.0/tests/auto/webchannel/tst_webchannel.cpp --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/webchannel/tst_webchannel.cpp 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/webchannel/tst_webchannel.cpp 2023-03-28 21:20:08.000000000 +0200 @@ -918,70 +918,49 @@ QCOMPARE(registeredObj.mReturnedObject, &returnedObjProperty); } +void TestWebChannel::testWrapValues_data() +{ + QTest::addColumn<QVariant>("variant"); + QTest::addColumn<QJsonValue>("json"); + + QTest::addRow("enum") << QVariant::fromValue(TestObject::Asdf) + << QJsonValue(static_cast<int>(TestObject::Asdf)); + + const TestObject::TestFlags flags = TestObject::FirstFlag | TestObject::SecondFlag; + QTest::addRow("flags") << QVariant::fromValue(flags) + << QJsonValue(static_cast<int>(flags)); + + QTest::addRow("list") << QVariant::fromValue(QList<int>{1, 2, 3}) + << QJsonValue(QJsonArray{1, 2, 3}); + + QTest::addRow("customVector") << QVariant::fromValue(TestStructVector{{1, 2}, {3, 4}}) + << QJsonValue(QJsonArray({QJsonObject{{"foo", 1}, {"bar", 2}}, + QJsonObject{{"foo", 3}, {"bar", 4}}})); + + QTest::addRow("nullptr") << QVariant::fromValue(nullptr) + << QJsonValue(); + + QTest::addRow("hash") << QVariant::fromValue(QVariantHash{{"One", 1}, + {"Two", 2}}) + << QJsonValue(QJsonObject{{"One", 1}, + {"Two", 2}}); + + QTest::addRow("map") << QVariant::fromValue(QVariantMap{{"One", 1}, + {"Two", 2}}) + << QJsonValue(QJsonObject{{"One", 1}, + {"Two", 2}}); +} + void TestWebChannel::testWrapValues() { QWebChannel channel; channel.connectTo(m_dummyTransport); - { - QVariant variant = QVariant::fromValue(TestObject::Asdf); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isDouble()); - QCOMPARE(value.toInt(), (int) TestObject::Asdf); - } - { - TestObject::TestFlags flags = TestObject::FirstFlag | TestObject::SecondFlag; - QVariant variant = QVariant::fromValue(flags); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isDouble()); - QCOMPARE(value.toInt(), (int) flags); - } - { - QList<int> list { 1, 2, 3 }; - QVariant variant = QVariant::fromValue(list); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isArray()); - QCOMPARE(value.toArray(), QJsonArray({1, 2, 3})); - } - { - TestStructVector vec{{1, 2}, {3, 4}}; - QVariant variant = QVariant::fromValue(vec); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isArray()); - QCOMPARE(value.toArray(), QJsonArray({QJsonObject{{"foo", 1}, {"bar", 2}}, - QJsonObject{{"foo", 3}, {"bar", 4}}})); - } - { - QVariant variant = QVariant::fromValue(nullptr); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isNull()); - } - { - QVariantHash hash; - hash["One"] = 1; - hash["Two"] = 2; - QVariant variant = QVariant::fromValue(hash); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isObject()); - QVERIFY(value["One"].isDouble()); - QCOMPARE(value["One"].toInt(), 1); - QVERIFY(value["Two"].isDouble()); - QCOMPARE(value["Two"].toInt(), 2); - QVERIFY(value["Three"].isUndefined()); - } - { - QVariantMap map; - map["One"] = 1; - map["Two"] = 2; - QVariant variant = QVariant::fromValue(map); - QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); - QVERIFY(value.isObject()); - QVERIFY(value["One"].isDouble()); - QCOMPARE(value["One"].toInt(), 1); - QVERIFY(value["Two"].isDouble()); - QCOMPARE(value["Two"].toInt(), 2); - QVERIFY(value["Three"].isUndefined()); - } + QFETCH(QVariant, variant); + QFETCH(QJsonValue, json); + + QJsonValue value = channel.d_func()->publisher->wrapResult(variant, m_dummyTransport); + QCOMPARE(value, json); } void TestWebChannel::testWrapObjectWithMultipleTransports() @@ -1000,22 +979,29 @@ QCOMPARE(pub->transportedWrappedObjects.size(), 2); } +void TestWebChannel::testJsonToVariant_data() +{ + QTest::addColumn<QJsonValue>("json"); + QTest::addColumn<QVariant>("targetVariant"); + + QTest::addRow("enum") << QJsonValue(static_cast<int>(TestObject::Asdf)) + << QVariant::fromValue(TestObject::Asdf); + + const TestObject::TestFlags flags = TestObject::FirstFlag | TestObject::SecondFlag; + QTest::addRow("flags") << QJsonValue(static_cast<int>(flags)) + << QVariant::fromValue(flags); +} + void TestWebChannel::testJsonToVariant() { QWebChannel channel; channel.connectTo(m_dummyTransport); - { - QVariant variant = QVariant::fromValue(TestObject::Asdf); - QVariant convertedValue = channel.d_func()->publisher->toVariant(static_cast<int>(TestObject::Asdf), variant.userType()); - QCOMPARE(convertedValue, variant); - } - { - TestObject::TestFlags flags = TestObject::FirstFlag | TestObject::SecondFlag; - QVariant variant = QVariant::fromValue(flags); - QVariant convertedValue = channel.d_func()->publisher->toVariant(static_cast<int>(flags), variant.userType()); - QCOMPARE(convertedValue, variant); - } + QFETCH(QJsonValue, json); + QFETCH(QVariant, targetVariant); + + QVariant convertedValue = channel.d_func()->publisher->toVariant(json, targetVariant.userType()); + QCOMPARE(convertedValue, targetVariant); } void TestWebChannel::testInfiniteRecursion() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtwebchannel-everywhere-src-6.4.3/tests/auto/webchannel/tst_webchannel.h new/qtwebchannel-everywhere-src-6.5.0/tests/auto/webchannel/tst_webchannel.h --- old/qtwebchannel-everywhere-src-6.4.3/tests/auto/webchannel/tst_webchannel.h 2023-03-12 03:59:12.000000000 +0100 +++ new/qtwebchannel-everywhere-src-6.5.0/tests/auto/webchannel/tst_webchannel.h 2023-03-28 21:20:08.000000000 +0200 @@ -72,10 +72,10 @@ Q_PROPERTY(QString stringProperty READ readStringProperty WRITE setStringProperty BINDABLE bindableStringProperty) public: - explicit TestObject(QObject *parent = 0) + explicit TestObject(QObject *parent = nullptr) : QObject(parent) - , mObjectProperty(0) - , mReturnedObject(Q_NULLPTR) + , mObjectProperty(nullptr) + , mReturnedObject(nullptr) { } enum Foo { @@ -342,8 +342,10 @@ void testTransportWrapObjectProperties(); void testRemoveUnusedTransports(); void testPassWrappedObjectBack(); + void testWrapValues_data(); void testWrapValues(); void testWrapObjectWithMultipleTransports(); + void testJsonToVariant_data(); void testJsonToVariant(); void testInfiniteRecursion(); void testAsyncObject();