From: stephan Date: Sun, 9 Oct 2022 15:12:37 +0000 (+0000) Subject: Minor cleaups in the post-init async phase of sqlite3 module initialization. X-Git-Tag: version-3.40.0~169^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff891b4e1c2a05bb2c1ac4add05b0c20a5ba86b4;p=thirdparty%2Fsqlite.git Minor cleaups in the post-init async phase of sqlite3 module initialization. FossilOrigin-Name: 2e024a6b533524b7732cea8aa27b16363e17b4c32731ddf31085e91fc728c1af --- diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js index 40e615eb86..98defe4fbc 100644 --- a/ext/wasm/api/sqlite3-api-opfs.js +++ b/ext/wasm/api/sqlite3-api-opfs.js @@ -1093,7 +1093,9 @@ installOpfsVfs.defaultProxyUri = //console.warn("sqlite3.installOpfsVfs.defaultProxyUri =",sqlite3.installOpfsVfs.defaultProxyUri); self.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{ try{ - return installOpfsVfs(); + return installOpfsVfs().catch((e)=>{ + console.warn("Ignoring inability to install OPFS sqlite3_vfs:",e); + }); }catch(e){ console.error("installOpfsVfs() exception:",e); throw e; diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js index 8e2dda1d74..61bbeabb15 100644 --- a/ext/wasm/api/sqlite3-api-prologue.js +++ b/ext/wasm/api/sqlite3-api-prologue.js @@ -1285,9 +1285,11 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( /** Performs any optional asynchronous library-level initialization which might be required. This function returns a Promise which - resolves to the sqlite3 namespace object. It _ignores any - errors_ in the asynchronous init process, as such components - are all optional. If called more than once, the second and + resolves to the sqlite3 namespace object. Any error in the + async init will be fatal to the init as a whole, but init + routines are themselves welcome to install dummy catch() + handlers which are not fatal if their failure should be + considered non-fatal. If called more than once, the second and subsequent calls are no-ops which return a pre-resolved Promise. @@ -1312,9 +1314,13 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( // Is it okay to resolve these in parallel or do we need them // to resolve in order? We currently only have 1, so it // makes no difference. - lip = lip.map((f)=>f(sqlite3).catch((e)=>{ - console.error("Ignoring error: an async sqlite3 initializer failed:",e); - })); + lip = lip.map((f)=>{ + const p = (f instanceof Promise) ? f : f(sqlite3); + return p.catch((e)=>{ + console.error("an async sqlite3 initializer failed:",e); + throw e; + }); + }); //let p = lip.shift(); //while(lip.length) p = p.then(lip.shift()); //return p.then(()=>sqlite3); @@ -1350,8 +1356,9 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( this array is deleted. Note that the order of insertion into this array is significant for - some pieces. e.g. sqlite3.capi.wasm cannot be fully utilized until - the whwasmutil.js part is plugged in via sqlite3-api-glue.js. + some pieces. e.g. sqlite3.capi and sqlite3.capi.wasm cannot be fully + utilized until the whwasmutil.js part is plugged in via + sqlite3-api-glue.js. */ self.sqlite3ApiBootstrap.initializers = []; /** @@ -1360,13 +1367,15 @@ self.sqlite3ApiBootstrap.initializers = []; modified by client code except when plugging such code into the amalgamation process. - Counterpart of self.sqlite3ApiBootstrap.initializers, specifically - for initializers which are asynchronous. All functions in this list - take the sqlite3 object as their argument and MUST return a - Promise. The resolved value and ignored and rejection will kill the - asyncPostInit() process but will be otherwise ignored because the - post-synchronous-init async initialization parts are (as of this - writing) all optional. + The counterpart of self.sqlite3ApiBootstrap.initializers, + specifically for initializers which are asynchronous. All entries in + this list must be either async functions, non-async functions which + return a Promise, or a Promise. Each function in the list is called + with the sqlite3 ojbect as its only argument. + + The resolved value of any Promise is ignored and rejection will kill + the asyncPostInit() process (at an indeterminate point because all + of them are run asynchronously in parallel). This list is not processed until the client calls sqlite3.asyncPostInit(). This means, for example, that intializers diff --git a/manifest b/manifest index e5a01e2bed..8b6b64fcdf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sext/wasm/kvvfs.make\swhich\swas\sinadvertently\sresurrected\sin\s[92b500da70a3]. -D 2022-10-09T13:35:14.995 +C Minor\scleaups\sin\sthe\spost-init\sasync\sphase\sof\ssqlite3\smodule\sinitialization. +D 2022-10-09T15:12:37.430 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -487,8 +487,8 @@ F ext/wasm/api/pre-js.js 2db711eb637991b383fc6b5c0f3df65ec48a7201e5730e304beba8d F ext/wasm/api/sqlite3-api-cleanup.js 5d22d1d3818ecacb23bfa223d5970cd0617d8cdbb48c8bc4bbd463f05b021a99 F ext/wasm/api/sqlite3-api-glue.js 4e1403add52666f4cf36fc580ddb15b65bb8f9ccb446095f953aad6c9da2f324 F ext/wasm/api/sqlite3-api-oo1.js ac1e08d36bdfb5aa0a2d75b7d4c892fd51819d34c932370c3282810672bcc086 -F ext/wasm/api/sqlite3-api-opfs.js 78fd272d6ec4fe6da93910b978f693fff63beed8e0e5e7dab42a25dbdfefca4b -F ext/wasm/api/sqlite3-api-prologue.js 2c860a257fc554bc6958c08c8e268e7f3d69813fd9e359032636a55c8e6f4405 +F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616 +F ext/wasm/api/sqlite3-api-prologue.js daf288df965cab1e8eabee4451f6ba3beb03d5a579722b0b0f90e5203962f515 F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c ea456d398bda1c5f4b2c4a54512de7b9ca4513c2b0ab326b99a46fb51cef0b42 @@ -2029,8 +2029,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a9047e020a097b2259bc9935b63ca1c538a3a7f1d050e15f0d0a08cfb84acc7c -R 883cefae3468ecd65dfcaec537518f1d +P 2e7fa085fc0b1202c6502d89e2603ae76a93451754b07b32ab4f0211f213f980 +R b8107455a191243f8c2c52386f30d345 U stephan -Z 3463e4479bd983b8852d635dda178090 +Z 2aa81e852e2755790733e84c20b847cc # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9158166ba2..78d2a21e8a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e7fa085fc0b1202c6502d89e2603ae76a93451754b07b32ab4f0211f213f980 \ No newline at end of file +2e024a6b533524b7732cea8aa27b16363e17b4c32731ddf31085e91fc728c1af \ No newline at end of file