diff options
author | stephan <stephan@noemail.net> | 2023-01-04 03:14:06 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-01-04 03:14:06 +0000 |
commit | 5d2a25b25471428f21846ad84c1bdff479705d04 (patch) | |
tree | 2358b3ae91d9684575e5799042618a7d00d9b3a7 /ext/wasm/api/sqlite3-api-glue.js | |
parent | a9e1e4edafc2d29116d2e1c7cfc6b0c1c992b9f2 (diff) | |
download | sqlite-5d2a25b25471428f21846ad84c1bdff479705d04.tar.gz sqlite-5d2a25b25471428f21846ad84c1bdff479705d04.zip |
Remove the JS-side SQLITE_WASM_DEALLOC sanity check which triggers the problem mentioned in [688c5c13d156] and [ae0196d86ee8], for reasons covered in the code comments, per discussion in [forum:e5b20e1feb|forum post e5b20e1feb].
FossilOrigin-Name: 65ff3200c6009a1649fc108d7ce36f5c014185ba46bbf98471ec86eaeb572656
Diffstat (limited to 'ext/wasm/api/sqlite3-api-glue.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-glue.js | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js index 239af7c9a..7db23bacc 100644 --- a/ext/wasm/api/sqlite3-api-glue.js +++ b/ext/wasm/api/sqlite3-api-glue.js @@ -26,17 +26,21 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ if(0){ /** - This block inexplicably fails on Safari, per report at - https://sqlite.org/forum/forumpost/e5b20e1feb. In its place, - we instead add an unsightly snippet to - sqlite3_wasm_enum_json() which emits the SQLITE_WASM_DEALLOC - pointer as an integer. - - "The problem" with that approach is that in order to honor - sqlite3.config.deallocExportName, we have to have the - following loop (or something equivalent). Because we cannot - (for Safari) do so, we are currently implicitly hard-coded to - using sqlite3.config.deallocExportName==='sqlite3_free'. + Please keep this block around as a maintenance reminder + that we cannot rely on this type of check. + + This block fails on Safari, per a report at + https://sqlite.org/forum/forumpost/e5b20e1feb. + + It turns out that what Safari serves from the indirect function + table (e.g. wasm.functionEntry(X)) is anonymous functions which + wrap the WASM functions, rather than returning the WASM + functions themselves. That means comparison of such functions + is useless for determining whether or not we have a specific + function from wasm.exports. i.e. if function X is indirection + function table entry N then wasm.exports.X is not equal to + wasm.functionEntry(N) in Safari, despite being so in the other + browsers. */ /** Find a mapping for SQLITE_WASM_DEALLOC, which the API @@ -809,16 +813,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ capi[e[0]] = e[1]; } } - /* Exporting SQLITE_WASM_DEALLOC via the wasm.ctype entries fails - in Safari. One final thing to try: */ - capi.SQLITE_WASM_DEALLOC = wasm.exports.sqlite3_wasm_ptr_to_sqlite3_free(); - if(wasm.exports[sqlite3.config.deallocExportName] - !== wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)){ - toss("Internal error: sqlite3.wasm.exports["+ - sqlite3.config.deallocExportName+"]", - "is not the same pointer as SQLITE_WASM_DEALLOC.", - "These must match in order to accommodate allocator-related", - "API guarantees."); + if(!wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)){ + toss("Internal error: cannot resolve exported function", + "entry SQLITE_WASM_DEALLOC (=="+capi.SQLITE_WASM_DEALLOC+")."); } const __rcMap = Object.create(null); for(const t of ['resultCodes']){ |