From 592494e2e59a16e6d9ecf9f6f865e2df3de99a18 Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Mon, 31 Jul 2023 14:56:52 +0200 Subject: [PATCH] Use module.exports to get the entry function name in WASM test lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Obtaining entry function name with exports = {} is about to get removed (in emscripten 3.1.44). Use the only alternative, which is to specify the module = {} object that gets the 'exports' variable. Oddly enough, it gets assigned the only export name, even though the name is plural. Change-Id: Idcda29bfcaed2d0a923a8d39af078359abc73f7d Reviewed-by: Morten Johan Sørvig --- util/wasm/batchedtestrunner/qwasmjsruntime.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/util/wasm/batchedtestrunner/qwasmjsruntime.js b/util/wasm/batchedtestrunner/qwasmjsruntime.js index d973914cd35..716a461576f 100644 --- a/util/wasm/batchedtestrunner/qwasmjsruntime.js +++ b/util/wasm/batchedtestrunner/qwasmjsruntime.js @@ -109,18 +109,19 @@ export class CompiledModule { this.#resourceLocator = resourceLocator; } - static make(js, wasm, entryFunctionName, resourceLocator - ) { + static make(js, wasm, entryFunctionName, resourceLocator) + { const exports = {}; + const module = {}; eval(js); - if (!exports[entryFunctionName]) { + if (!module.exports) { throw new Error( '${entryFunctionName} has not been exported by the main script' ); } return new CompiledModule( - exports[entryFunctionName], js, wasm, resourceLocator + module.exports, js, wasm, resourceLocator ); }