]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove some dead JS code. Improve the exception-to-C-result-code conversion to accoun...
authorstephan <stephan@noemail.net>
Wed, 12 Jun 2024 22:15:25 +0000 (22:15 +0000)
committerstephan <stephan@noemail.net>
Wed, 12 Jun 2024 22:15:25 +0000 (22:15 +0000)
FossilOrigin-Name: 5bd9fd5f61e7cd1ed3b44c5cabc759c154c98eb40ad10d29e61f142aaa062ddf

ext/wasm/api/sqlite3-opfs-async-proxy.js
ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
manifest
manifest.uuid

index 48cddd7ef32d087d3a0b65766f8fc24caa701069..a2c052d32a52c2156a371aacae5d2a7a392b190b 100644 (file)
@@ -265,23 +265,34 @@ const installAsyncProxy = function(){
       this.name = 'GetSyncHandleError';
     }
   };
+
+  /**
+     Attempts to find a suitable SQLITE_xyz result code for Error
+     object e. Returns either such a translation or rc if if it does
+     not know how to translate the exception.
+  */
   GetSyncHandleError.convertRc = (e,rc)=>{
-    if(1){
-      return (
-        e instanceof GetSyncHandleError
-          && ((e.cause.name==='NoModificationAllowedError')
-              /* Inconsistent exception.name from Chrome/ium with the
-                 same exception.message text: */
-              || (e.cause.name==='DOMException'
-                  && 0===e.cause.message.indexOf('Access Handles cannot')))
-      ) ? (
-        /*console.warn("SQLITE_BUSY",e),*/
-        state.sq3Codes.SQLITE_BUSY
-      ) : rc;
-    }else{
-      return rc;
+    if( e instanceof GetSyncHandleError ){
+      if( e.cause.name==='NoModificationAllowedError'
+        /* Inconsistent exception.name from Chrome/ium with the
+           same exception.message text: */
+          || (e.cause.name==='DOMException'
+              && 0===e.cause.message.indexOf('Access Handles cannot')) ){
+        return state.sq3Codes.SQLITE_BUSY;
+      }else if( 'NotFoundError'===e.cause.name ){
+        /**
+           Maintenance reminder: SQLITE_NOTFOUND, though it looks like
+           a good match, has different semantics than NotFoundError
+           and is not suitable here.
+        */
+        return state.sq3Codes.SQLITE_CANTOPEN;
+      }
+    }else if( 'NotFoundError'===e?.name ){
+      return state.sq3Codes.SQLITE_CANTOPEN;
     }
-  }
+    return rc;
+  };
+
   /**
      Returns the sync access handle associated with the given file
      handle object (which must be a valid handle object, as created by
@@ -600,19 +611,6 @@ const installAsyncProxy = function(){
         fh.releaseImplicitLocks =
           (opfsFlags & state.opfsFlags.OPFS_UNLOCK_ASAP)
           || state.opfsFlags.defaultUnlockAsap;
-        if(0 /* this block is modelled after something wa-sqlite
-                does but it leads to immediate contention on journal files.
-                Update: this approach reportedly only works for DELETE journal
-                mode. */
-           && (0===(flags & state.sq3Codes.SQLITE_OPEN_MAIN_DB))){
-          /* sqlite does not lock these files, so go ahead and grab an OPFS
-             lock. */
-          fh.xLock = "xOpen"/* Truthy value to keep entry from getting
-                               flagged as auto-locked. String value so
-                               that we can easily distinguish is later
-                               if needed. */;
-          await getSyncHandle(fh,'xOpen');
-        }
         __openFiles[fid] = fh;
         storeAndNotify(opName, 0);
       }catch(e){
index 603a3e4747e0d5fa931932b3dc8bd179c511571f..ee6937c69defcb63b52a816a70eb8704d1b08017 100644 (file)
@@ -390,6 +390,7 @@ const installOpfsVfs = function callee(options){
       'SQLITE_ACCESS_EXISTS',
       'SQLITE_ACCESS_READWRITE',
       'SQLITE_BUSY',
+      'SQLITE_CANTOPEN',
       'SQLITE_ERROR',
       'SQLITE_IOERR',
       'SQLITE_IOERR_ACCESS',
index 6dd91dca87da3eb2be83f77dd4d3ebb48b8cedb9..55eed392acafb928b33285677d79321e47711ac9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\ssome\sJS\sdocs\swhich\sno\slonger\sapply.\sNo\scode\schanges.
-D 2024-06-12T21:01:44.271
+C Remove\ssome\sdead\sJS\scode.\sImprove\sthe\sexception-to-C-result-code\sconversion\sto\saccount\sfor\sthe\scase\sof\sa\sfile\sdisappearing\swhile\sthe\sOPFS\sVFS\sis\swaiting\sto\sacquire\sa\slock\son\sit.
+D 2024-06-12T22:15:25.519
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -615,10 +615,10 @@ F ext/wasm/api/sqlite3-api-oo1.js c373cc04625a96bd3f01ce8ebeac93a5d38dbda6215818
 F ext/wasm/api/sqlite3-api-prologue.js b347a0c5350247f90174a0ad9b9e72a99a5f837f31f78f60fcdb829b2ca30b63
 F ext/wasm/api/sqlite3-api-worker1.js 5cc22a3c0d52828cb32aad8691488719f47d27567e63e8bc8b832d74371c352d
 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
-F ext/wasm/api/sqlite3-opfs-async-proxy.js a77fe462e87bb18dcf51574750db89bbec9b95b390dfd01e3b055e7a7813c93d
+F ext/wasm/api/sqlite3-opfs-async-proxy.js 881af4643f037b6590c491cef5fac8bcdd4118993197a1fa222ccb8b01e3504a
 F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
 F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 8433ee332d5f5e39fb19427fccb7bad7f44aa99b5504daad3343fc128c311e78
-F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 4672142c5ebde2f36cfb54ade66beff393c8ceba819fbe3e6d4d16ed28454314
+F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9e7600f0e97dc4f5ec33089b60c6b931df73e347653bf273cf6864f9f9501d7d
 F ext/wasm/api/sqlite3-vtab-helper.c-pp.js a2fcbc3fecdd0eea229283584ebc122f29d98194083675dbe5cb2cf3a17fe309
 F ext/wasm/api/sqlite3-wasm.c 9267174b9b0591b4f71193542ab57adf95bb9415f7d3453acf4a8ca8052f5e6c
 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46f303ba8ddd1b2f0a391798837beddfa72e8c897038c8047eda49ce7d5ed46b
@@ -2195,8 +2195,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 a44703135e8dd3cc67e548e1aa3c42e71df127fb7b593ccfc06025ec42a501fd
-R f8258a841d7785f7bd34691642a97b21
+P f253cab3359270045a3ae9f5e9eadc1cfc8844181db127165bfdf49d5f99efb1
+R 63f255ea2e5c09516862fb8ffb235ee5
 U stephan
-Z 80db9b86bc6469d927101c39e3244f61
+Z 1022f5b3521399d57e698263f497769f
 # Remove this line to create a well-formed Fossil manifest.
index 8db54be45f124a975152c6dc359a6707cb8a9f1e..f49af7d0df94e8cc6e6ba7dfbc06e0d043752000 100644 (file)
@@ -1 +1 @@
-f253cab3359270045a3ae9f5e9eadc1cfc8844181db127165bfdf49d5f99efb1
\ No newline at end of file
+5bd9fd5f61e7cd1ed3b44c5cabc759c154c98eb40ad10d29e61f142aaa062ddf
\ No newline at end of file