aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-opfs.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-09-17 15:08:22 +0000
committerstephan <stephan@noemail.net>2022-09-17 15:08:22 +0000
commit132a87baa366bcda8b26e0e4e56c6abba4c5d453 (patch)
treec89ea37362f99b7f2f5f47d773a6a07f476f0925 /ext/wasm/api/sqlite3-api-opfs.js
parentce260f4e4389d75fe2e89f608faf7d995206bc36 (diff)
downloadsqlite-132a87baa366bcda8b26e0e4e56c6abba4c5d453.tar.gz
sqlite-132a87baa366bcda8b26e0e4e56c6abba4c5d453.zip
Add initial bits of an experimental async-impl-via-synchronous-interface proxy intended to marshal OPFS via sqlite3_vfs API.
FossilOrigin-Name: 38da059b472415da52f57de7332fbeb8a91e3add1f4be3ff9c1924b52672f77c
Diffstat (limited to 'ext/wasm/api/sqlite3-api-opfs.js')
-rw-r--r--ext/wasm/api/sqlite3-api-opfs.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js
index 693432b35..3faf956c7 100644
--- a/ext/wasm/api/sqlite3-api-opfs.js
+++ b/ext/wasm/api/sqlite3-api-opfs.js
@@ -34,11 +34,12 @@
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const warn = console.warn.bind(console),
error = console.error.bind(console);
- if(!self.importScripts || !self.FileSystemFileHandle){
- //|| !self.FileSystemFileHandle.prototype.createSyncAccessHandle){
- // ^^^ sync API is not required with WASMFS/OPFS backend.
+ if(self.window===self || !self.importScripts || !self.FileSystemFileHandle
+ || !self.FileSystemFileHandle.prototype.createSyncAccessHandle){
warn("OPFS is not available in this environment.");
return;
+ }else if(!navigator.storage.getDirectory){
+ warn("The OPFS VFS requires navigator.storage.getDirectory.");
}else if(!sqlite3.capi.wasm.bigIntEnabled){
error("OPFS requires BigInt support but sqlite3.capi.wasm.bigIntEnabled is false.");
return;