summaryrefslogtreecommitdiffstats
path: root/tests/manual/wasm/qtloader_integration/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* wasm: Don't suppress exceptions during main()Morten Sørvig2023-12-201-0/+12
| | | | | | | | | | | | | | | | | If there's e.g. an infinite loop during main() that would previously result in a blank page, but not error message. The expected case is that we would get a RangeError exception, but that exception never reaches the catch handlers in qtloader.js. Work around this by setting noInitialRun, followed by calling main manually. We then need to handle the case where the app.exec() workaround throws, which should not trigger an error. Pick-to: 6.7 Change-Id: Ia8431279308770981316cd168e4316341bfb2531 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: clarify qtloader onExit behaviorMorten Sørvig2023-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | onExit is called whenever the application exits, i.e. when the app canvas should no longer be displayed and the loader/embedder code should take some action. Emscripten provides two callbacks which can be used here: - onExit, called when the app exits (but see EXIT_RUNTIME) - onAbort, called on abort errors. These map to the two cases Qt's onExit supports. onExit is not called when EXIT_RUNTIME is disabled, which means we don't need the special case for exit code 0. In addition call onExit on any exception. The second call to showUi() in html_shell.html is then not needed any more and we avoid duplicating the UI state handling in user code. Update the qtloader_integration test to handle changes in behavior (we no longer set the error text on exit). Use emscripten_force_exit() to simulate application exit - using this function makes Emscripten call onExit even when EXIT_RUNTIME is disabled. Pick-to: 6.6 Change-Id: I72b5463c1836e8d5054e594abbd304fbc67032b7 Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* wasm: add "preload" qtloader config propertyMorten Sørvig2023-07-041-0/+16
| | | | | | | | | | | | | | | | | | | | | | | Add support for downloading files from the web server to the in-memory file system at application load time. See included documentation for usage. This preload functionality is different from Emscripten's --preload-file and --embed-file in that the files are not packed to a single data file or embedded in the JavaScript runtime. Instead, the files are downloaded individually from the web server, which means that they can be cached individually, and also updated individually without rebuilding the application. Any file type can be preloaded. The primary use case (at the moment) is preloading Qt plugins and QML imports. Pick-to: 6.6 Task-number: QTBUG-63925 Change-Id: I2b71b0d6a2c12ecd3ec58e319c679cd3f6b16631 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Modernize the qtloaderMikolaj Boc2023-06-051-0/+155
This is a minimal version of qtloader. The load function accepts the same arguments as emscripten runtime with a few additions: - qt.environment - qt.onExit - qt.containerElements - qt.fontDpi - qt.onLoaded - qt.entryFunction State handling has been removed in favor of making the load async (assume loading when the promise is live). Public APIs getting crashed status, exit text and code have been refactored into the new qt.onExit event fed to load. No need for keeping the state in the loader. The loader is integration-tested. A test module with test APIs has been created as a test harness. The runtime APIs exposed by Qt (font dpi and screen API) are handled by the qtloader seamlessly. Change-Id: Iaee65702667da0349a475feae6b83244d966d98d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>