unotest/source/embindtest/embindtest.js | 8 ++++++++ 1 file changed, 8 insertions(+)
New commits: commit 6b6f18ed52e25df12347057f276712bd95d20fec Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Tue May 28 13:26:37 2024 +0200 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Tue May 28 21:52:42 2024 +0200 Emscripten: Document failing getExceptionMessage (and add a console.assert(false) to verify that an exception actually gets thrown) Change-Id: I885301a5730b54c817c8a9ed97e60f49f8c8baf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168149 Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> Tested-by: Jenkins diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js index f6cc71bbc906..87d3d2fc281c 100644 --- a/unotest/source/embindtest/embindtest.js +++ b/unotest/source/embindtest/embindtest.js @@ -633,11 +633,19 @@ Module.addOnPostRun(function() { console.assert(test.isDouble(uno.org.libreoffice.embindtest.Constants.Double)); try { test.throwRuntimeException(); + console.assert(false); } catch (e) { incrementExceptionRefcount(e); //TODO, needed when building with JS-based -fexceptions, see // <https://github.com/emscripten-core/emscripten/issues/17115> "[EH] Fix inconsistency // of refcounting in Emscripten EH vs. Wasm EH" + //TODO: The recommended way to obtain the exception's type and message would reportedly + // (<https://emscripten.org/docs/porting/exceptions.html# + // handling-c-exceptions-from-javascript>) be + // const [type, message] = getExceptionMessage(e); + // but that causes a "RuntimeError: memory access out of bounds" from within + // getExceptionMessage -> getExceptionMessageCommon -> __get_exception_message at least with + // emsdk 3.1.46: console.assert(e.name === 'com::sun::star::uno::RuntimeException'); console.assert(e.message === undefined); //TODO //TODO: console.assert(e.Message.startsWith('test'));