| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
The JS lib will miss to add QObjects to the local
object descriptions when receiving a new description
and the user has not registered a callback function.
This patch makes the lib execute unwrapQObject for
all responses received from a function call.
Change-Id: I72d872d65a7e7bec1d7e6ffb1eea674d0f6e50d7
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
| |
Change-Id: I66b102f0076d8ab39f871ce2be300a1e33228eac
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
| |
The tests don't depend on QtWebKit anymore, so they should be run even
without QtWebKit installed.
Change-Id: Id60ebec861b29b73522fba670b1a0c19375cb826
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a bug, where messages from the transport would still be
send to the QtMetaObjectPublisher even though it was previously
disconnected.
I'll refactor this code eventually to get rid of QtMetaObjectPublisher
alltogether and merge its code into QWebChannelPrivate where
appropriate.
Change-Id: Ie0c35bd81a5e633bdcb6be55b64f947d4a545a59
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Lutz Schönemann <lutz.schoenemann@basyskom.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This assimilates the JavaScript side to the QML/C++ side. We get rid
of the automagic WebSocket code. Instead, users pass in the WebSocket
from the outside, if they want to use that for communication. In the
QtWebKit/QtWebEngine cases, we will pass in our custom IPC objects.
Change-Id: I15e15b5130f99dc8b39dfbfa8cd3d8b2d34dbbc0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Lutz Schönemann <lutz.schoenemann@basyskom.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes the obsolete API support to send raw messages using
a QWebChannel. Instead, it is encouraged to directly use WebSockets or
navigator.qt.
By doing so, we can cleanup the code considerably. While at it, the
transport API is adapted to work on QJsonObject messages, instead of
QStrings. This will allow us to use more efficient formats in e.g.
QtWebKit or QtWebEngine. One could also implement a JSONRPC interface
using a custom transport then.
Change-Id: Ia8c125a5558507b3cbecf128a46b19fdb013f47b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
|
|
|
|
|
|
|
| |
It worked before, but this patch makes the code more explicit.
Change-Id: Id7cf90cb3e2488106e08077e9a8165112734dd88
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
This is a minor cleanup commit. Renaming the .pro file is required
for qt.pro to find it. The rename of the resource path makes it more
explicit by using the module name.
Change-Id: Ib724882d02d2a8aea7468ef984ed573dca1d3e7b
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
This is required for proper QtWebKit/QtWebEngine integration, as
otherwise these modules would have to redo a lot of the QtWebChannel
QML API. Furthermore, without this, we could not use the WebChannel.id
attached property everywhere, independent of the web browser technology.
Change-Id: I032a9326841d505c2f77959a240bbfc71e94b6e8
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a quite big changeset, but necessary to get the roadmap
implemented that was discussed at QtCS.
With this patchset landed, the QWebChannel does not depend on
QtWebKit anymore, not even for the tests. Rather, we will introduce
the dependency in the other way (i.e. QtWebKit will optionally use
QtWebChannel if available).
For the pure Qt/C++ use-case, we ship a utility implementation of
a QWebChannelAbstractTransport that uses a QWebSocket for the
server-client communication. This way, we can get rid of the custom
WebSocket implementation.
The tests are refactored to run the qwebchannel.js code directly
inside QML. Integration tests for QtWebKit/QtWebEngine as well
as examples will be added to these repositories.
Change-Id: Icc1c1c5918ec46e31d5070937c14c4ca25a3e2d6
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This simplifies the usage and lets properties be used just like normal
JavaScript properties. This is possible since the properties are cached
on the HTML side.
Change-Id: Ic60076f4596cd8df063567dfbd630e5bd6403119
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The auto tests are now located in tests/auto instead of directly in
tests/. This is required to ensure the cmake test is found.
Furthermore, the sync.profile is updated to point to refs/heads/dev,
as we target Qt 5.4 with this new module.
Change-Id: I1e6e99968b7081b5774eaf30319cac1fbaed35c2
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, the response was sent to all clients in a broad-cast and had
to be filtered on the client-side. This required additional client
identification data to be added to all requests and responses.
Now, we keep track of the transport and transport-internal client and
only send the response to that client. This is very benefitial for
multi-client setups but also reduces traffic for single-client setups
and thus their performance.
Change-Id: Ia1ef5e031b0058222083d352a8aa28a7d566a6ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This further reduces the network traffic and thus leads to a small
performance boost.
Personally, I also think this code is a bit nicer to read and grasp.
Change-Id: I943c621142e9982f0e52d24e3a0976428856541b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
|
|
|
|
|
|
|
|
|
| |
This will allow us to refactor the handling of multiple clients without
breaking the functionality.
Change-Id: I277eb5d7337d398fdf0694ef539d3b6ab7e5d332
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This enables us to optionally use navigator.qt instead of a WebSocket,
which is nicer setup-wise and is also slightly faster:
navigator.qt:
284.0 msecs per iteration (total: 2,840, iterations: 10)
WebSocket:
295.8 msecs per iteration (total: 2,959, iterations: 10)
The baseline is ca. 203 msecs, which would mean a performance boost
of ca. 12.7%.
Furthermore, this sets the fundation to eventually add a WebEngine
transport mechanism. The WebViewTransport should also be removed and
instead the WebView itself should directly implement the
WebChannelTransportInterface.
Change-Id: I368bb27e38ffa2f17ffeb7f5ae695690f6f5ad21
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current CI system fails to build the webchannel when
QtWebKit is included in sync.profile, so we ignore it for now
and adapt the QMake build system to only include the declarative
tests when webkit is found.
As discussed with tronical, sifalt and sahumada, the qtqa scripts
will need to be adapted to cope with optional dependencies of non-qt5
modules.
Change-Id: Id89b763ef2697e9e72eb4064c150971b13ebccc3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some tests referenced Nokia in their license even though that was never
the case. The tests where written completely by me after Qt Nokia times.
What is missing are the examples which are still mostly original work
by Noam back then in Nokia times. The rest was (re-)written by me
completely since then anyways.
Change-Id: Ib423fb3459bcc1f7464a02de4fd82ddfd614d282
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This used to work but broke in one of the last few commits apparently.
Now we add a proper unit test to ensure it stays working.
The issue was that JSON only knows e.g. numeric types stored as double.
When we then try to call a method taking an int with the VariantArgument
that tries to convert the double to int, we failed and produced an
invalid QVariant which then converts to 0.
Now we use the appropriate API to convert the JSON data to the correct
target type before calling the method. Furthermore, it became clear
that we can greatly cleanup the VariantArgument thanks to that. It now
is reduced to just a QVariant wrapper class with an implicit cast
operator to QGenericArgument.
Change-Id: Ieaf60f548ea9584e7d760f9cd935da455787f376
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new registeredObjects list property is now preferred over the old
imparative registerObject/registerObjects API.
Items that are added to the list need an attached WebChannel.id property
which holds the identifier under which the object is published to remote
clients.
Change-Id: I96a8047b9a85e27f3fd48c900180c22ebd20eb35
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This is achieved by hiding the MetaObjectPublisher completely as
private API. The QWebChannel is the only publisher API and now handles
both the socket as well as the publisher internally.
This now allows us to create a proper QML api in the new QmlWebChannel.
Change-Id: I3096364af8485353ca9bc19df4a81a8e4552c3d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
These messages are somewhat unpredictable in order and as such we skip
them instead of relying on their order.
Change-Id: I24c082ea1afe6ede1a8058195f01ffba1e6ca8e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The code now resides in a single qwebchannel.js file and there is only
a single callback-nesting required to setup a MetaObjectPublisher
connection.
The server-side will be simplified in the next step.
Change-Id: Ib5fc77a03c2b281c61af91713411eed571ec6108
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
In addition to these steps, the developer must symlink the qmldir from
the source directory to <his build-folder>/qml/QtWebChannel.
Change-Id: Ieb1131edc907c98d9ce9134760f14633b07eb080
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reduces the traffic as the indices are usually much smaller than
the property names.
As such, the benchPropertyUpdates gets a speed boost of about 9% (or
10ms vs. 11ms). As we need to transmit the index during initialization
that degrades its performance slightly by ca. 4% (13ms vs. 12.5ms).
Considering that the initialization only takes place once whereas
the property updates potentially often, this is a good tradeoff.
Change-Id: If7df3e360f1528b7d7aa26c63ce851363ae9fd6a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: Ibd9a696a86939530cd08d57a9ef9cbeb3125bbd8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Before, we constructed QVariant maps and lists and then converted them
to JSON to send the data to the webchannel.
By obsoleting the conversion step, benchInitializeClients shows a good
performance boost of ca. 19% (11.81ms vs 14.58ms).
Change-Id: Ief8e8127207a046f481488a478cd6a18fa0ebffe
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to remove the public API for the tests and allows for
more tests and benchmarks in the future.
To achieve this, we re-use the new qmetaobjectpublisher_p.h, which then
also must be exported.
Change-Id: I3c33b2f5be6cc674cd3092667151dd8da2263cf5
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
|
|
|
|
|
| |
Change-Id: I6a852e1545e7aac0f9f8d83010a3e905524a8069
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This module can hopefully be done in time for 5.3. This commit changes
the source structure and QMake files to adapt to typical Qt modules.
With this in place, we can now use QT += webchannel in qmake files to
link against the pure Qt/C++ QtWebChannel library.
The QML plugin is separated from it and can be loaded optionally, if
the quick module could be found. Also added is now a qmlplugindump
for tooling integration. Note that the Qt.labs namespace is removed.
The test file structure is also adapted to how its done in the
QtDeclarative module.
Note that this setup apparently does not support to run tests without
running make install first.
Change-Id: I1c15d72e7ab5f525d5a6f651f4e965ef86bc17bd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will allow us to create a stand-alone WebChannel C++ library,
without any QML dependencies, that can be used to publisher QObjects
to remote clients running in any browser engine supporting WebSockets.
The patch is large, as working with introspection through the
QMetaObject from C++ is more complicated compared to QML.
On the other hand, the move to C++ allows a much more performant
implementation of quite some parts of the publisher. One thing is
that signal and method invocations can be handled via numeric indices,
where before we needed to transmit the string identifier of the
signal or method.
Eventually this can now also be applied to properties, further
decreasing the size of messages between server and clients.
Note that this patch contains quite some TODOs and rough edges,
such as the invokable bench_* helper functions in the public API
of the MetaObjectPublisher. These are to be seen as temporary, and
will be cleaned up in followup commits later. This is done to prevent
a further blow-up of this already big patch.
Change-Id: I57e788d8a19edd410651611382d912f9ad6660c9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
To do so, we need to remember the connected functor and pass that to
disconnect, in both the client side as well as the QML server side.
Change-Id: Ic61fc5d2a203212278c23471c216683e309e2c9f
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An HTML client can trigger the creation of new objects, or a published
object on the server side might return other objects.
These are then wrapped on the fly and can be used like the other
objects. Note though that the HTML client can call deleteLater on
these objects. Also, it does not yet work to wrap objects on the fly
in signal arguments or property values.
Change-Id: I92aa8a3e52f42d5325dd0771bbf9e2ae213e88f9
Reviewed-by: Arvid Nilsson <anilsson@blackberry.com>
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This runs benchmarks on various functions of the MOP with hundred
objects each containing ten properties, signals and methods.
Furthermore a function is included which benchmarks the whole roundtrip
of loading a simple client and waiting for it to be initialized.
Change-Id: If51c5b5f606151885611cabc0e1330bd2643ad67
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
For performance reasons, we group property updates and send a single
batch update notification. This is now tested to work as intended.
This also uncovered a bug in webchannel.js when multiple functions
subscribe to the same id.
Change-Id: Ic8648d664dd1fe54df7e25fade6a6088386af992
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tests the functionality of publishing a plain QtObject from
QML to the HTML client.
It tests property binding, i.e. reading and writing of an objects
property on the client side, as well as change notification tracking.
Furthermore a server-side method is invoked from the client and
signal submission from the server to the client is tested.
Change-Id: I62e544cddf4483b57535a9bc1e05a36105ec6622
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
|
|
|
|
| |
Change-Id: Ia449851bd0312435882c0238ab46f8316e38b72f
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: I5eec7bc87bc56de6dd918d90f2fe9ee86d72b434
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
This uncovered a bug in webchannel.js, which stringified strings leading
to duplicated quoting. This is also fixed now.
Furthermore, some QMake changes are required to make it possible to run
the tests without first installing QWebChannel.
Change-Id: If7e8f73a748f86f2d5c7d39000e90612367038af
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|