diff options
author | stephan <stephan@noemail.net> | 2022-12-23 14:11:54 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-12-23 14:11:54 +0000 |
commit | 0f29f17bf6ea1044d4daa7bbc00283a026a1c514 (patch) | |
tree | 698e4c4a0d8abc280084b5c5bc3aa350512a8a8b /ext/wasm/common/whwasmutil.js | |
parent | cc1cc9d7b78a6c932d7f6201106c7b4ef094ea30 (diff) | |
download | sqlite-0f29f17bf6ea1044d4daa7bbc00283a026a1c514.tar.gz sqlite-0f29f17bf6ea1044d4daa7bbc00283a026a1c514.zip |
Add sqlite3.capi JS bindings for the sqlite3session_...(), sqlite3changeset_...() and sqlite3changegroup_...() APIs, noting that they are completely untested. Aside from missing tests, these bindings reveal a slight string-argument-type shortcoming in the callback function pointer "reverse binding" which should ideally be resolved before publishing them.
FossilOrigin-Name: 0a39172ee134816f5ce17a403b960e9c22bb56efd5bcf77ecde465efe0d88b1d
Diffstat (limited to 'ext/wasm/common/whwasmutil.js')
-rw-r--r-- | ext/wasm/common/whwasmutil.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/wasm/common/whwasmutil.js b/ext/wasm/common/whwasmutil.js index 87cc100f3..c99e36041 100644 --- a/ext/wasm/common/whwasmutil.js +++ b/ext/wasm/common/whwasmutil.js @@ -446,7 +446,7 @@ self.WhWasmUtilInstaller = function(target){ type(s) of the given function signature, or throws if the signature is invalid. */ /******** // only valid for use with the WebAssembly.Function ctor, which - // is not yet documented on MDN. + // is not yet documented on MDN. sigToWasm: function(sig){ const rc = {parameters:[], results: []}; if('v'!==sig[0]) rc.results.push(f.sigTypes(sig[0])); @@ -1581,10 +1581,20 @@ self.WhWasmUtilInstaller = function(target){ not actually bind any functions. Its convertArg() method is called via xWrap() to perform any bindings. - Shortcomings: function pointers which include C-string arguments - may still need a level of hand-written wrappers around them, - depending on how they're used, in order to provide the client - with JS strings. + Shortcomings: + + - These "reverse" bindings, i.e. calling into a JS-defined + function from a WASM-defined function (the generated proxy + wrapper), lack all type conversion support. That means, for + example, that... + + - Function pointers which include C-string arguments may still + need a level of hand-written wrappers around them, depending on + how they're used, in order to provide the client with JS + strings. Alternately, clients will need to perform such conversions + on their own, e.g. using cstrtojs(). Or maybe we can find a way + to perform such conversions here, via addition of an xWrap()-style + function signature to the options argument. */ xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter { constructor(opt) { |