summaryrefslogtreecommitdiffstats
path: root/tests/manual/wasm/qstdweb/promise_main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* wasm: Remove promise manual testEven Oscar Andersen2025-11-281-488/+0
| | | | | | | It will be replaced by an auto test Change-Id: Ie7bc9acba6080fd191e31e61ce378023003b599c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: Handle exceptions in promiseEven Oscar Andersen2025-05-191-0/+23
| | | | | | Fixes: QTBUG-136962 Change-Id: I2d33b0132a83945b476f0f47fa4697ddaa2374b3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: implement promise handler using suspendresumecontrolMorten Sørvig2025-04-151-24/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required to make sure we resume the wasm instance when a promise resolves. As a bonus QWasmSuspendResumeControl already implements the JS -> C++ callback mapping, and we can removed the fixed-4 ThunkPool which the current implementation is using. The implementation is straightforward, where the only snag is that cleanup must be done in the finally callback. Implement Promise::all by calling JS Promise.all(). This function returns a new Promise, which we can adopt. Make two changes to the test: - remove throwInThen(): We no longer support propagating JS exceptions from the then() handler to the catch function. (catching a rejected promise still works). As far as I can see this functionality is not used in qtbase. - In finallyWithThen(), change shared_ptr<bool> to plain pointer. This works around a (mysterious) issue where we were not getting the correct value when reading from the shared_ptr. Change-Id: I8fb11b66ecba74f80708bd39eeeac59bb62f3786 Reviewed-by: Lorn Potter <lorn.potter@qt.io>
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Make the promises js-less using a newly introduced thunk poolMikolaj Boc2022-07-071-110/+71
| | | | | | | | | | | | | | | | | Since we cannot rely on the clients specifying a suitable CSP that will not forbid execution of js injections, we have to refrain from using any explicit <script> elements. To keep the promise system working, a thunk pool was introduced which keeps track of a limited pool of promise callback exports. In case the resources are busy, pending calls are enqueued. This works since the JS Promise.then/catch/finally always fire, even on ready/failed promises. As the situation of full thunk pool allocation is unlikely to happen en masse IRL, the solution should not adversely affect the performance. Heavy unit tests were created to confirm the solution works as expected. Task-number: QTBUG-99611 Change-Id: I0e6982d4ee76a4263b59e72b004b3ff2f167e4df Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Port promise tests to qtwasmtestlibMikolaj Boc2022-07-061-0/+525
The promise tests have been ported to qtwasmtestlib so that they do not have to use asyncify anymore. Task-number: QTBUG-99611 Change-Id: Id1b5742c90e36a89540e7a2387cb4110c21ace9b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>