From bc340abe877199af640d16f1fbeaf4b96c36fe14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 9 Jun 2023 11:19:52 +0200 Subject: wasm: Document (and rename) config.qt.module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This property can take a either a WebAssembly.Module or a promise to a module, and we don't have to specify the exact type in the property name. Pick-to: 6.6 Change-Id: Iebaf52178253afe8c93cf78bbe0853461bf48b67 Reviewed-by: MikoĊ‚aj Boc --- .../manual/wasm/qtloader_integration/test_body.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'tests/manual/wasm') diff --git a/tests/manual/wasm/qtloader_integration/test_body.js b/tests/manual/wasm/qtloader_integration/test_body.js index f23db3a978..d68c6ba8cc 100644 --- a/tests/manual/wasm/qtloader_integration/test_body.js +++ b/tests/manual/wasm/qtloader_integration/test_body.js @@ -177,7 +177,7 @@ export class QtLoaderIntegrationTests // Fetch/Compile the module once; reuse for each instance. This is also if the page wants to // initiate the .wasm file download fetch as early as possible, before the browser has // finished fetching and parsing testapp.js and qtloader.js - const modulePromise = WebAssembly.compileStreaming(fetch('tst_qtloader_integration.wasm')); + const module = WebAssembly.compileStreaming(fetch('tst_qtloader_integration.wasm')); const instances = await Promise.all([1, 2, 3].map(i => qtLoad({ qt: { @@ -186,7 +186,7 @@ export class QtLoaderIntegrationTests width: `${i * 10}px`, height: `${i * 10}px`, })], - modulePromise, + module, } }))); // Confirm the identity of instances by querying their screen widths and heights @@ -230,14 +230,26 @@ export class QtLoaderIntegrationTests assert.equal('Sample output!', accumulatedStdout); } + async modulePromiseProvided() + { + await qtLoad({ + qt: { + entryFunction: createQtAppInstance, + containerElements: [this.#testScreenContainers[0]], + module: WebAssembly.compileStreaming( + fetch('tst_qtloader_integration.wasm')) + } + }); + } + async moduleProvided() { await qtLoad({ qt: { entryFunction: createQtAppInstance, containerElements: [this.#testScreenContainers[0]], - modulePromise: WebAssembly.compileStreaming( - await fetch('tst_qtloader_integration.wasm')) + module: await WebAssembly.compileStreaming( + fetch('tst_qtloader_integration.wasm')) } }); } @@ -265,7 +277,7 @@ export class QtLoaderIntegrationTests qt: { entryFunction: createQtAppInstance, containerElements: [this.#testScreenContainers[0]], - modulePromise: Promise.reject(new Error('Failed to load')), + module: Promise.reject(new Error('Failed to load')), } }); } catch (e) { -- cgit v1.2.3