aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/testing1.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-09-29 13:17:50 +0000
committerstephan <stephan@noemail.net>2022-09-29 13:17:50 +0000
commitb94a98607a3bd4dd55f4d5ce16f171ba066bafb2 (patch)
tree097b3fae84f287075120e7685458c4d1bb98af60 /ext/wasm/testing1.js
parent4b884bb4c77cb4b1e5059395212160f4ee48cc53 (diff)
downloadsqlite-b94a98607a3bd4dd55f4d5ce16f171ba066bafb2.tar.gz
sqlite-b94a98607a3bd4dd55f4d5ce16f171ba066bafb2.zip
Rework the Emscripten-emitted module loader/init function such that it passes on the sqlite3 module, instead of the Emscripten module, to the first then() of sqlite3InitModule()'s returned Promise. This eliminates any need to mention the Emscripten module object in client-side code unless they want to configure it in advance for loading-status reports.
FossilOrigin-Name: 0dbaa0e2b5abf5c23e2039ec90a3055ebb3c063aaf4e556c42546defe6fbb86d
Diffstat (limited to 'ext/wasm/testing1.js')
-rw-r--r--ext/wasm/testing1.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/ext/wasm/testing1.js b/ext/wasm/testing1.js
index 9607e3f37..5b3d6189d 100644
--- a/ext/wasm/testing1.js
+++ b/ext/wasm/testing1.js
@@ -33,7 +33,7 @@
return v1>=(v2-factor) && v1<=(v2+factor);
};
- let sqlite3;
+ let sqlite3 /* loaded later */;
const testBasicSanity = function(db,sqlite3){
const capi = sqlite3.capi;
@@ -270,7 +270,7 @@
T.mustThrow(()=>db.exec("select * from foo.bar"));
};
- const testIntPtr = function(db,S,Module){
+ const testIntPtr = function(db,S){
const w = S.capi.wasm;
const stack = w.scopedAllocPush();
let ptrInt;
@@ -1011,9 +1011,8 @@
n,"entries totaling approximately",sz,"bytes.");
};
- const runTests = function(Module){
- //log("Module",Module);
- sqlite3 = Module.sqlite3;
+ const runTests = function(_sqlite3){
+ sqlite3 = _sqlite3;
const capi = sqlite3.capi,
oo = sqlite3.oo1,
wasm = capi.wasm;
@@ -1074,7 +1073,7 @@
].forEach((f)=>{
const t = T.counter, n = performance.now();
logHtml(banner1,"Running",f.name+"()...");
- f(db, sqlite3, Module);
+ f(db, sqlite3);
logHtml(banner2,f.name+"():",T.counter - t,'tests in',(performance.now() - n),"ms");
});
}finally{
@@ -1085,8 +1084,7 @@
log('capi.wasm.exports',capi.wasm.exports);
};
- self.sqlite3TestModule.initSqlite3().then(function(theModule){
- self._MODULE = theModule /* this is only to facilitate testing from the console */
- runTests(theModule);
+ self.sqlite3TestModule.initSqlite3().then((S)=>{
+ runTests(S);
});
})();