aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/wasm/api/extern-post-js.c-pp.js25
-rw-r--r--ext/wasm/api/post-js-footer.js6
-rw-r--r--ext/wasm/api/post-js-header.js12
-rw-r--r--ext/wasm/api/sqlite3-api-prologue.js12
4 files changed, 26 insertions, 29 deletions
diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js
index c54e1f082..3598c0d6f 100644
--- a/ext/wasm/api/extern-post-js.c-pp.js
+++ b/ext/wasm/api/extern-post-js.c-pp.js
@@ -65,15 +65,14 @@ const toExportForESM =
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);
- }
+ EmscriptenModule.runSQLite3PostLoadInit(EmscriptenModule);
+ const s = EmscriptenModule.sqlite3;
+ s.scriptInfo = initModuleState;
+ //console.warn("sqlite3.scriptInfo =",s.scriptInfo);
+ if(ff.__isUnderTest) s.__isUnderTest = true;
+ const f = s.asyncPostInit;
+ delete s.asyncPostInit;
+ const rv = f();
//#if wasmfs
if('undefined'!==typeof WorkerGlobalScope &&
EmscriptenModule['ENVIRONMENT_IS_PTHREAD']){
@@ -86,13 +85,7 @@ const toExportForESM =
return EmscriptenModule;
}
//#endif
- const s = EmscriptenModule.sqlite3;
- s.scriptInfo = initModuleState;
- //console.warn("sqlite3.scriptInfo =",s.scriptInfo);
- if(ff.__isUnderTest) s.__isUnderTest = true;
- const f = s.asyncPostInit;
- delete s.asyncPostInit;
- return f();
+ return rv;
}).catch((e)=>{
console.error("Exception loading sqlite3 module:",e);
throw e;
diff --git a/ext/wasm/api/post-js-footer.js b/ext/wasm/api/post-js-footer.js
index d9bb1eab0..7af12cbe3 100644
--- a/ext/wasm/api/post-js-footer.js
+++ b/ext/wasm/api/post-js-footer.js
@@ -1,6 +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");
+//console.warn("This is the end of the Module.runSQLite3PostLoadInit handler.");
+}/*Module.runSQLite3PostLoadInit()*/;
+//console.warn("This is the end of the setup of the (pending) Module.runSQLite3PostLoadInit");
diff --git a/ext/wasm/api/post-js-header.js b/ext/wasm/api/post-js-header.js
index d0778b980..a543c14f3 100644
--- a/ext/wasm/api/post-js-header.js
+++ b/ext/wasm/api/post-js-header.js
@@ -7,8 +7,12 @@
installs will be run after the WASM module is loaded, at which
point the sqlite3 JS API bits will get set up.
*/
-if(!Module.postRun) Module.postRun = [];
-Module.postRun.push(function(Module/*the Emscripten-style module object*/){
+Module.runSQLite3PostLoadInit = function(EmscriptenModule/*the Emscripten-style module object*/){
+ /** ^^^ As don't use Module.postRun, as that runs a different time
+ depending on whether this file is built with emcc 3.1.x or
+ 4.0.x. This function name is intentionally obnoxiously verbose to
+ ensure that we don't collide with current and future Emscripten
+ symbol names. */
'use strict';
//console.warn("This is the start of the Module.postRun handler.");
/* This function will contain at least the following:
@@ -16,9 +20,9 @@ Module.postRun.push(function(Module/*the Emscripten-style module object*/){
- post-js-header.js (this file)
- sqlite3-api-prologue.js => Bootstrapping bits to attach the rest to
- common/whwasmutil.js => Replacements for much of Emscripten's glue
- - jaccwaby/jaccwabyt.js => Jaccwabyt (C/JS struct binding)
+ - jaccwabyt/jaccwabyt.js => Jaccwabyt (C/JS struct binding)
- sqlite3-api-glue.js => glues previous parts together
- - sqlite3-api-oo.js => SQLite3 OO API #1
+ - sqlite3-api-oo1.js => SQLite3 OO API #1
- sqlite3-api-worker1.js => Worker-based API
- sqlite3-vfs-helper.c-pp.js => Utilities for VFS impls
- sqlite3-vtab-helper.c-pp.js => Utilities for virtual table impls
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js
index c8db3698c..ee973990a 100644
--- a/ext/wasm/api/sqlite3-api-prologue.js
+++ b/ext/wasm/api/sqlite3-api-prologue.js
@@ -12,12 +12,12 @@
This file is intended to be combined at build-time with other
related code, most notably a header and footer which wraps this
- whole file into an Emscripten Module.postRun() handler. The sqlite3
- JS API has no hard requirements on Emscripten and does not expose
- any Emscripten APIs to clients. It is structured such that its build
- can be tweaked to include it in arbitrary WASM environments which
- can supply the necessary underlying features (e.g. a POSIX file I/O
- layer).
+ whole file into an Emscripten Module.postRun()-style handler. The
+ sqlite3 JS API has no hard requirements on Emscripten and does not
+ expose any Emscripten APIs to clients. It is structured such that
+ its build can be tweaked to include it in arbitrary WASM
+ environments which can supply the necessary underlying features
+ (e.g. a POSIX file I/O layer).
Main project home page: https://sqlite.org