aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-vfs-opfs.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-11-30 07:48:35 +0000
committerstephan <stephan@noemail.net>2022-11-30 07:48:35 +0000
commite7f5118bd347e83348417c91eda187d865938e4e (patch)
treec5cd7dd1ac629d08a7761fe1f2fcd89297c565c2 /ext/wasm/api/sqlite3-vfs-opfs.js
parent36a0163e40eb7097e562dfc6d12af516847de2f3 (diff)
downloadsqlite-e7f5118bd347e83348417c91eda187d865938e4e.tar.gz
sqlite-e7f5118bd347e83348417c91eda187d865938e4e.zip
OPFS VFS: remove an invalid TODO and fix a property name typo which caused xCheckReservedLock() to always report false.
FossilOrigin-Name: 3b037caa2fa07b6c44c485574e9e5dc71f4a8e82bc902c1321bb0b918b139c74
Diffstat (limited to 'ext/wasm/api/sqlite3-vfs-opfs.js')
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.js b/ext/wasm/api/sqlite3-vfs-opfs.js
index 7c7eed7ef..bd258759c 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.js
@@ -659,13 +659,9 @@ const installOpfsVfs = function callee(options){
involve an inherent race condition. For the time being,
pending a better solution, we simply report whether the
given pFile is open.
-
- FIXME: we need to ask the async half whether a lock is
- held, as it's possible (since long after this method was
- implemented) that we do not hold a lock on an OPFS file.
*/
const f = __openFiles[pFile];
- wasm.setMemValue(pOut, f.lockMode ? 1 : 0, 'i32');
+ wasm.setMemValue(pOut, f.lockType ? 1 : 0, 'i32');
return 0;
},
xClose: function(pFile){
@@ -706,7 +702,11 @@ const installOpfsVfs = function callee(options){
mTimeStart('xLock');
const f = __openFiles[pFile];
let rc = 0;
- if( capi.SQLITE_LOCK_NONE === f.lockType ) {
+ /* All OPFS locks are exclusive locks. If xLock() has
+ previously succeeded, do nothing except record the lock
+ type. If no lock is active, have the async counterpart
+ lock the file. */
+ if( !f.lockType ) {
rc = opRun('xLock', pFile, lockType);
if( 0===rc ) f.lockType = lockType;
}else{