diff options
| author | Morten Sørvig <morten.sorvig@qt.io> | 2023-10-25 12:42:02 +0200 |
|---|---|---|
| committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2023-12-20 00:44:28 +0000 |
| commit | db93cd4f61ec9ad75b2389e5ac1724becfce3a1b (patch) | |
| tree | 3002bf37bea55f497664b51cc7c32d024c221c46 /tests/manual/wasm/qtloader_integration/main.cpp | |
| parent | ac4619a36a54a2168ea5d7a2c7d059781564098c (diff) | |
wasm: Don't suppress exceptions during main()
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>
Diffstat (limited to 'tests/manual/wasm/qtloader_integration/main.cpp')
| -rw-r--r-- | tests/manual/wasm/qtloader_integration/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/manual/wasm/qtloader_integration/main.cpp b/tests/manual/wasm/qtloader_integration/main.cpp index ee032e9952d..d93aef64172 100644 --- a/tests/manual/wasm/qtloader_integration/main.cpp +++ b/tests/manual/wasm/qtloader_integration/main.cpp @@ -69,6 +69,11 @@ void crash() std::abort(); } +void stackOverflow() +{ + stackOverflow(); // should eventually termniate with exception +} + void exitApp() { emscripten_force_exit(ExitValueFromExitApp); @@ -143,8 +148,15 @@ int main(int argc, char **argv) if (crashImmediately) crash(); + const bool stackOverflowImmediately = + std::find(arguments.begin(), arguments.end(), QStringLiteral("--stack-owerflow-immediately")) + != arguments.end(); + if (stackOverflowImmediately) + stackOverflow(); + const bool noGui = std::find(arguments.begin(), arguments.end(), QStringLiteral("--no-gui")) != arguments.end(); + if (!noGui) { AppWindow window; window.show(); |
