diff options
author | stephan <stephan@noemail.net> | 2023-07-27 17:50:10 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-07-27 17:50:10 +0000 |
commit | 9fcca3d27c18693eddf65a0edc0f4e609a3a24fc (patch) | |
tree | 2bd7604ab104116aa56122a263bc33b31d40c679 /ext/wasm/api | |
parent | 4cfd54256dca63f95717428416033237e3bad607 (diff) | |
download | sqlite-9fcca3d27c18693eddf65a0edc0f4e609a3a24fc.tar.gz sqlite-9fcca3d27c18693eddf65a0edc0f4e609a3a24fc.zip |
Dynamically determine whether the wasm.xWrap() argc check can be applied, depending on how the wasm environment exposes its exports.
FossilOrigin-Name: fd59226b34fffb1479fb2d7bd7c0aff982aa4a1a73e6c0d81de6eaf9c075998c
Diffstat (limited to 'ext/wasm/api')
-rw-r--r-- | ext/wasm/api/sqlite3-api-glue.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js index f444ec975..572efeed5 100644 --- a/ext/wasm/api/sqlite3-api-glue.js +++ b/ext/wasm/api/sqlite3-api-glue.js @@ -728,6 +728,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ Populate api object with sqlite3_...() by binding the "raw" wasm exports into type-converting proxies using wasm.xWrap(). */ + if(0 === wasm.exports.sqlite3_step.length){ + /* This environment wraps exports in nullary functions, which means + we must disable the arg-count validation we otherwise perform + on the wrappers. */ + wasm.xWrap.doArgcCheck = false; + sqlite3.config.warn( + "Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks." + ); + } for(const e of wasm.bindingSignatures){ capi[e[0]] = wasm.xWrap.apply(null, e); } |