]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
wasm: a potential workaround for cases such as [forum:1eec339854c935bd|forum post...
authorstephan <stephan@noemail.net>
Tue, 20 Jan 2026 17:10:22 +0000 (17:10 +0000)
committerstephan <stephan@noemail.net>
Tue, 20 Jan 2026 17:10:22 +0000 (17:10 +0000)
FossilOrigin-Name: c8e6be9241e3e17898c451baad109b75dc8a97a91ff1e43c67a6c962b75af8f3

ext/wasm/api/extern-post-js.c-pp.js
ext/wasm/api/pre-js.c-pp.js
manifest
manifest.uuid

index 25b3f8ea9775c7781a8ef5df4f40028d3919fedd..cac6e4ab4f8dd4eeec8f8f3196f36f179a0f6b64 100644 (file)
@@ -73,6 +73,8 @@ const toExportForESM =
 
   const sIM = globalThis.sqlite3InitModule = function ff(...args){
     //console.warn("Using replaced sqlite3InitModule()",globalThis.location);
+    sIMS.emscriptenLocateFile = args[0]?.locateFile /* see pre-js.c-pp.js [tag:locateFile] */;
+    sIMS.emscriptenInstantiateWasm = args[0]?.instantiateWasm /* see pre-js.c-pp.js [tag:locateFile] */;
     return originalInit(...args).then((EmscriptenModule)=>{
       sIMS.debugModule("sqlite3InitModule() sIMS =",sIMS);
       sIMS.debugModule("sqlite3InitModule() EmscriptenModule =",EmscriptenModule);
index 42acd7d0f36f0f04a53b7d877c50822a33e92c95..59dc907d16c718e966c43f23704ee011f7edd5df 100644 (file)
      approach.
   */
   Module['locateFile'] = function(path, prefix) {
+    if( this.emscriptenLocateFile instanceof Function ){
+      /* [tag:locateFile] Client-overridden impl. We do not support
+         this but offer it as a back-door which will go away the
+         moment either Emscripten changes that interface or we manage
+         to get non-Emscripten builds working.
+         https://sqlite.org/forum/forumpost/1eec339854c935bd */
+      return this.emscriptenLocateFile(path, prefix);
+    }
 //#if target:es6-module
     return new URL(path, import.meta.url).href;
 //#else
      node does not do fetch().
   */
   Module['instantiateWasm'] = function callee(imports,onSuccess){
+    if( this.emscriptenInstantiateWasm instanceof Function ){
+      /* See [tag:locateFile]. Same story here */
+      return this.emscriptenInstantiateWasm(imports, onSuccess);
+    }
     const sims = this;
     const uri = Module.locateFile(
       sims.wasmFilename, (
index 134f28e22e8634072c94063e49e445a7b2e0b528..a8b12dcc3e058ae5070be6b4365f949e028c46bc 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\san\sSQLITE_API_ARMOR\scheck\sto\ssqlite3_get_clientdata(),\sper\srequest\sin\s[forum:a011a001f4|forum\spost\sa011a001f4].
-D 2026-01-20T10:57:44.925
+C wasm:\sa\spotential\sworkaround\sfor\scases\ssuch\sas\s[forum:1eec339854c935bd|forum\spost\s1eec339854c935bd],\swhere\sclient-local\sneeds\srequire\soverriding\sEmscripten\sconfig\sdefaults\s(which\swe\svery\sintentionally\sdo\snot\sdocument\sor\ssupport\sfor\sreasons\sexplained\sin\sthat\sthread).\sThis\sis\suntested\sbecause\sit\srequires\sa\sspecial-needs\ssetup,\sbut\sit\sdoesn't\sbreak\sanything\sfor\srun-of-the-mill\scases.
+D 2026-01-20T17:10:22.413
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -591,11 +591,11 @@ F ext/wasm/SQLTester/index.html 64f3435084c7d6139b08d1f2a713828a73f68de2ae6a3112
 F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536
 F ext/wasm/api/EXPORTED_FUNCTIONS.c-pp 7ba933e8f1290cc65459dd371c0c9a031d96bdf14d7a2244fa761d9775117b90
 F ext/wasm/api/README.md a905d5c6bfc3e2df875bd391d6d6b7b48d41b43bdee02ad115b47244781a7e81
-F ext/wasm/api/extern-post-js.c-pp.js 4b310c9891886e7c1ea4e2419966ff45dfeda825b897fdaa4119332509f7e3d1
+F ext/wasm/api/extern-post-js.c-pp.js d9f42ecbedc784c0d086bc37800e52946a14f7a21600b291daa3f963c314f930
 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
 F ext/wasm/api/post-js-footer.js a50c1a2c4d008aede7b2aa1f18891a7ee71437c2f415b8aeb3db237ddce2935b
 F ext/wasm/api/post-js-header.js d24bd0d065f3489c8b78ddf3ead6321e5d047187a162cd503c41700e03dd1f06
-F ext/wasm/api/pre-js.c-pp.js a70c05cfc4aef68f0d264f3ae659ea367fe4367b196e54c15867a9689568a75e
+F ext/wasm/api/pre-js.c-pp.js 4452b674f1ad74c02a787edcc5449c4d60937ecf4ed31edcba3c74f0ac1253d5
 F ext/wasm/api/sqlite3-api-glue.c-pp.js 9b33e3ee467791dec4fd1b444b12a8545dfbb6c8b28ac651c7bdc7661a3b5a5c
 F ext/wasm/api/sqlite3-api-oo1.c-pp.js 45454631265d9ce82685f1a64e1650ee19c8e121c41db98a22b534c15e543cfa
 F ext/wasm/api/sqlite3-api-prologue.js 1fefd40ab21e3dbf46f43b6fafb07f13eb13cc157a884f7c1134caf631ddb3f2
@@ -2193,8 +2193,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 81840bd4b2132c1c701bb6fd5a2ac48a4ed33d2b68a3f7a826fa32dc0fc16483
-R 333f8800db383a0d77a15f9b7b37171f
+P 346ad366a8ebed1e7936c59f8a40e9c8e7e31d0153bc4f654a47b2ddc39b18ca
+R 70e9be57b67a2088ac3d3ac3838ccb2f
 U stephan
-Z 20800af8d71ad6093a502d20016c44a4
+Z 2bae166b43650196aaa0f91b2a88e5d9
 # Remove this line to create a well-formed Fossil manifest.
index de318d0d6685527b88c3ec5fe17ed33c9f87e97d..5f5826cba21774d2fd69b2748a950822062d3b9a 100644 (file)
@@ -1 +1 @@
-346ad366a8ebed1e7936c59f8a40e9c8e7e31d0153bc4f654a47b2ddc39b18ca
+c8e6be9241e3e17898c451baad109b75dc8a97a91ff1e43c67a6c962b75af8f3