]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Work around [https://github.com/emscripten-core/emscripten/issues/23420|a behavior...
authorstephan <stephan@noemail.net>
Wed, 15 Jan 2025 21:00:08 +0000 (21:00 +0000)
committerstephan <stephan@noemail.net>
Wed, 15 Jan 2025 21:00:08 +0000 (21:00 +0000)
FossilOrigin-Name: c0f0d263315da45f7615ae61de413f9ae5833f73fe22918323899211ceaddb31

ext/wasm/api/extern-post-js.c-pp.js
ext/wasm/api/post-js-footer.js
ext/wasm/api/post-js-header.js
ext/wasm/api/sqlite3-api-cleanup.js
manifest
manifest.uuid

index 63e55051c6f4abee3e756b944613dfce69c90bc7..c54e1f082584d6333605ba39ba9d4c89e9457019 100644 (file)
@@ -12,6 +12,7 @@
 const toExportForESM =
 //#endif
 (function(){
+  //console.warn("this is extern-post-js");
   /**
      In order to hide the sqlite3InitModule()'s resulting
      Emscripten module from downstream clients (and simplify our
@@ -62,6 +63,17 @@ const toExportForESM =
   globalThis.sqlite3InitModule = function ff(...args){
     //console.warn("Using replaced sqlite3InitModule()",globalThis.location);
     return originalInit(...args).then((EmscriptenModule)=>{
+      //console.warn("originalInit() then() arg =",EmscriptenModule);
+      //console.warn("initModuleState =",initModuleState);
+      if( EmscriptenModule.postRun && EmscriptenModule.postRun.length ){
+        /* Emscripten 4.0.0 changes the order in which our Module.postRun handler
+           runs. In 3.x postRun would have run by now, and our code relies
+           heavily on that order, so we'll work around that difference here.
+
+           https://github.com/emscripten-core/emscripten/issues/23420 */
+        //console.warn("Emscripten did not run postRun: running them now!");
+        EmscriptenModule.postRun.shift()(EmscriptenModule);
+      }
 //#if wasmfs
       if('undefined'!==typeof WorkerGlobalScope &&
          EmscriptenModule['ENVIRONMENT_IS_PTHREAD']){
@@ -74,7 +86,6 @@ const toExportForESM =
         return EmscriptenModule;
       }
 //#endif
-      //console.warn("sqlite3InitModule() returning sqlite3 object.");
       const s = EmscriptenModule.sqlite3;
       s.scriptInfo = initModuleState;
       //console.warn("sqlite3.scriptInfo =",s.scriptInfo);
index 58882cbd9c0ebfb7b2c811a08de180bd190a236f..d9bb1eab0bd9c03324db2153ce587bbb4b80f2b6 100644 (file)
@@ -1,4 +1,6 @@
 /* The current function scope was opened via post-js-header.js, which
    gets prepended to this at build-time. This file closes that
    scope. */
+//console.warn("This is the end of the Module.postRun handler.");
 })/*postRun.push(...)*/;
+//console.warn("This is the end of the setup of the (pending) Module.postRun");
index 7fd82a7d6c5b65bf025581fb2de89f4a0bf3f2c4..d0778b9807becdbfb4f9aeee022753d7b5db96bb 100644 (file)
@@ -10,6 +10,7 @@
 if(!Module.postRun) Module.postRun = [];
 Module.postRun.push(function(Module/*the Emscripten-style module object*/){
   'use strict';
+  //console.warn("This is the start of the Module.postRun handler.");
   /* This function will contain at least the following:
 
      - post-js-header.js (this file)
index 65dbb4eb64c98ccc4478e95368afdcd4fd323300..7fb29e6487e43f6f729bfb4c7d40b07ff463bf42 100644 (file)
@@ -14,6 +14,9 @@
   intended to be appended after all other sqlite3-api-*.js files so
   that it can finalize any setup and clean up any global symbols
   temporarily used for setting up the API's various subsystems.
+
+  In Emscripten builds it's run in the context of a Module.postRun
+  handler.
 */
 'use strict';
 if('undefined' !== typeof Module){ // presumably an Emscripten build
index fa7a914da102ad047c39e299bbe054b6a9d67559..a2a542bdf239567e7afd0c021af225da16c4d708 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Disable\sthe\sC-style\scomment\sstripper\sin\sthe\sJS\sdist\sbuild,\sas\sexplained\sin\s[forum:529c20d344|forum\spost\s529c20d344].
-D 2025-01-15T14:31:19.260
+C Work\saround\s[https://github.com/emscripten-core/emscripten/issues/23420|a\sbehavior\schange\sin\semsdk\s4.0.0]\swhich\sbreaks\sthe\sload/init\stiming\sof\sthe\swasm\smodule.
+D 2025-01-15T21:00:08.385
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -631,12 +631,12 @@ F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-extras fe40d6d758646e38f8b15f709044951
 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
 F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
 F ext/wasm/api/README.md 34fe11466f9c1d81b10a0469e1114e5f1c5a6365c73d80a1a6ca639a1a358b73
-F ext/wasm/api/extern-post-js.c-pp.js c4154a7f90c2d7e51fd6738273908152036c3457fdc0b6523f1be3ef51105aac
+F ext/wasm/api/extern-post-js.c-pp.js 13b1202f2815165a063ea41cc8450e0dc1505bbbe0be2fdac439b30b8cbdaacd
 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
-F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
-F ext/wasm/api/post-js-header.js 04dc12c3edd666b64a1b4ef3b6690c88dcc653f26451fd4734472d8e29c1c122
+F ext/wasm/api/post-js-footer.js 6137d9d3dea0f3868d03bca058dc662f01848f81ab6bf940ffaa10a75069d709
+F ext/wasm/api/post-js-header.js bd91458bd0763c1bdb382dc4e8ac7b52e2d7337adc3a2f07f454631b64f12e82
 F ext/wasm/api/pre-js.c-pp.js a614a2c82b12c4d96d8e3ba77330329efc53c4d56a8a7e60ade900f341866cfb
-F ext/wasm/api/sqlite3-api-cleanup.js d235ad237df6954145404305040991c72ef8b1881715d2a650dda7b3c2576d0e
+F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b939540661f3e839515bb92f2e35359
 F ext/wasm/api/sqlite3-api-glue.c-pp.js fb6dbfe692cc23000a65a4cd95a1a47ed5eb592dc9d8b55363b3c2952a787244
 F ext/wasm/api/sqlite3-api-oo1.c-pp.js f3a8e2004c6625d17946c11f2fb32008be78bc5207bf746fc77d59848813225f
 F ext/wasm/api/sqlite3-api-prologue.js 6f1257e04885632ed9f44d43aba200b86e0bc16709ffdba29abbbeb1bc8e8b76
@@ -2205,15 +2205,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010
-Q +a9475e7614f8e44252abf273d0e0522c247df12624e40108ce98ad4aaf320f2d
-R 9ee6b001d36128af324c049ee8c06d1f
-T *branch * branch-3.48
-T *sym-branch-3.48 *
-T -sym-major-release * Cancelled\sby\sbranch.
-T -sym-release * Cancelled\sby\sbranch.
-T -sym-trunk * Cancelled\sby\sbranch.
-T -sym-version-3.48.0 * Cancelled\sby\sbranch.
+P 76ffc70f1308c4d925d6f507de843302c69186bb6f45e237afa72072fc12e8c3
+Q +00a750184bcf1a94bf4e7f1d5029a42671e87e2997ae97be07bd900d3702883d
+R 3ab510858598ef27f7349c064a192e53
 U stephan
-Z e8c6d4540445110c093081eaced36ed2
+Z 6dfaba70e73e5ffb9a72360623c3e958
 # Remove this line to create a well-formed Fossil manifest.
index 55277100403c34b19dfddf8e791a200e825cae75..2c5cc5a6471d338a5c21284133659d21509fb6d1 100644 (file)
@@ -1 +1 @@
-76ffc70f1308c4d925d6f507de843302c69186bb6f45e237afa72072fc12e8c3
+c0f0d263315da45f7615ae61de413f9ae5833f73fe22918323899211ceaddb31