]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor internal cleanups and docs in the OPFS sqlite3_vfs.
authorstephan <stephan@noemail.net>
Tue, 29 Nov 2022 06:09:32 +0000 (06:09 +0000)
committerstephan <stephan@noemail.net>
Tue, 29 Nov 2022 06:09:32 +0000 (06:09 +0000)
FossilOrigin-Name: 61799b05ff232c2ac349169c27bfe7f8d9277366093b0c9dd2739828993b3066

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

index cef15305d445be8c0e410e55af690c76958ac8c6..de7500afa387618cbc1828c404a7da6404832ebe 100644 (file)
@@ -290,7 +290,9 @@ const installOpfsVfs = function callee(options){
        The size of the block in our SAB for serializing arguments and
        result values. Needs to be large enough to hold serialized
        values of any of the proxied APIs. Filenames are the largest
-       part but are limited to opfsVfs.$mxPathname bytes.
+       part but are limited to opfsVfs.$mxPathname bytes. We also
+       store exceptions there, so it needs to be long enough to hold
+       a reasonably long exception string.
     */
     state.sabS11nSize = opfsVfs.$mxPathname * 2;
     /**
index 1ba6e9bdbb7005d76153130f304070f0e28eeb1b..a80eeb290325124968296d4242170618a46e2c5f 100644 (file)
@@ -239,15 +239,26 @@ const installAsyncProxy = function(self){
      between locking-related failures and other types, noting that we
      cannot currently do so because createSyncAccessHandle() does not
      define its exceptions in the required level of detail.
+
+     2022-11-29: according to:
+
+     https://github.com/whatwg/fs/pull/21
+
+     NoModificationAllowedError will be the standard exception thrown
+     when acquisition of a sync access handle fails due to a locking
+     error. As of this writing, that error type is not visible in the
+     dev console in Chrome v109, nor is it documented in MDN, but an
+     error with that "name" property is being thrown from the OPFS
+     layer.
   */
   class GetSyncHandleError extends Error {
     constructor(errorObject, ...msg){
-      super();
-      this.error = errorObject;
-      this.message = [
-        ...msg, ': Original exception ['+errorObject.name+']:',
+      super([
+        ...msg, ': '+errorObject.name+':',
         errorObject.message
-      ].join(' ');
+      ].join(' '), {
+        cause: errorObject
+      });
       this.name = 'GetSyncHandleError';
     }
   };
@@ -259,8 +270,12 @@ const installAsyncProxy = function(self){
          distinguish that from other errors.
 
          This approach is highly questionable.
+
+         Note that even if we return SQLITE_IOERR_LOCK from here,
+         it bubbles up to the client as a plain I/O error.
       */
-      return (e instanceof GetSyncHandleError)
+      return (e instanceof GetSyncHandleError
+              && e.cause.name==='NoModificationAllowedError')
         ? state.sq3Codes.SQLITE_IOERR_LOCK
         : rc;
     }else{
index 4dc42b8b8c5068d5c55488bcd8b10aca0ad79806..51b58eba3a6786b7edec9076ff81335b7635bb74 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Internal\srestructuring\sof\sthe\sOPFS\ssqlite3_vfs\sin\sorder\sto\sfacilitate\scertain\sexperimentation\sand\simprove\serror\sreporting/hints\sif\sit\scannot\sbe\sactivated.\sDeprecate\sthe\sname\ssqlite3.opfs.OpfsDb,\spreferring\ssqlite3.oo1.OpfsDb\sfor\sconsistency\swith\sJsStorageDb\sand\sany\sfuture\sDB\ssubclasses.
-D 2022-11-29T05:25:08.036
+C Minor\sinternal\scleanups\sand\sdocs\sin\sthe\sOPFS\ssqlite3_vfs.
+D 2022-11-29T06:09:32.898
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -505,11 +505,11 @@ F ext/wasm/api/pre-js.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f
 F ext/wasm/api/sqlite3-api-cleanup.js ecdc69dbfccfe26146f04799fcfd4a6f5790d46e7e3b9b6e9b0491f92ed8ae34
 F ext/wasm/api/sqlite3-api-glue.js 056f44b82c126358a0175e08a892d56fadfce177b0d7a0012502a6acf67ea6d5
 F ext/wasm/api/sqlite3-api-oo1.js 06ad2079368e16cb9f182c18cd37bdc3932536856dff4f60582d0ca5f6c491a8
-F ext/wasm/api/sqlite3-api-opfs.js 583650ffdc1452496df6b9459d018fa2aede221ae6ea0cbbbe83bd2e1bdba966
+F ext/wasm/api/sqlite3-api-opfs.js ee97811004fd0da9311527293b519543fbb0c6b0c9beaa9b6704400bfd74d150
 F ext/wasm/api/sqlite3-api-prologue.js 7fce4c6a138ec3d7c285b7c125cee809e6b668d2cb0d2328a1b790b7037765bd
 F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
-F ext/wasm/api/sqlite3-opfs-async-proxy.js b5dd7eda8e74e07453457925a0dd793d7785da720954e0e37e847c5c6e4d9526
+F ext/wasm/api/sqlite3-opfs-async-proxy.js 4b8973711ae4825bb047da932b9046b4e8f678fcea759158caebc5821a655ac7
 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
 F ext/wasm/api/sqlite3-wasm.c 8b32787a3b6bb2990cbaba2304bd5b75a9652acbc8d29909b3279019b6cbaef5
 F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
@@ -2064,8 +2064,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 0cb2fd14179397051a25d066256a553fc198656d5668c7010c016f2b8f495bf4
-R 115b7898d7b2ce79a9261f36a9b959d1
+P 0c5c51f4fb04a4b90c50ec9704cfea9a3fb7d7d0ee55c1b0d4476129188217a6
+R e8239b21ab627d1eba84cc5be45ed7a1
 U stephan
-Z f4ff31d5e2499971cf67cb62dbdd0ac3
+Z 1147c5417905a9e8323d8798a4fd57dd
 # Remove this line to create a well-formed Fossil manifest.
index fb6fdac183f9816ef8aba1a118f9c0f51d9aa928..85d7059802a2f0f5aeff0799f4683141efb6fdde 100644 (file)
@@ -1 +1 @@
-0c5c51f4fb04a4b90c50ec9704cfea9a3fb7d7d0ee55c1b0d4476129188217a6
\ No newline at end of file
+61799b05ff232c2ac349169c27bfe7f8d9277366093b0c9dd2739828993b3066
\ No newline at end of file