diff options
author | stephan <stephan@noemail.net> | 2022-09-18 03:05:55 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-09-18 03:05:55 +0000 |
commit | 0db3089576b6df43fa477100446ab330b5bda905 (patch) | |
tree | 00f7909eda9f785d6c0c5b0b720a2a79588f9db6 /ext/wasm/sqlite3-opfs-async-proxy.js | |
parent | c5313afea7bf38bbe98b5a472b16a8f3efda07c0 (diff) | |
download | sqlite-0db3089576b6df43fa477100446ab330b5bda905.tar.gz sqlite-0db3089576b6df43fa477100446ab330b5bda905.zip |
Move the OPFS VFS bits back into api/sqlite3-api-opfs.js. Refactor the OPFS VFS init process to use a Promise-returning function which the client must call, as that eliminates any uncertainty about when the VFS (necessarily activated asynchronously) actually becomes available to the client. Rename x-sync-async.* to test-opfs-vfs.* Milestone: first successful test of OPFS without WASMFS.
FossilOrigin-Name: b2abf60dbfa6648f671a3932cb65feb28d05a0d5b7f792351d14f9c13d9798c5
Diffstat (limited to 'ext/wasm/sqlite3-opfs-async-proxy.js')
-rw-r--r-- | ext/wasm/sqlite3-opfs-async-proxy.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/wasm/sqlite3-opfs-async-proxy.js b/ext/wasm/sqlite3-opfs-async-proxy.js index 58498e006..00b402556 100644 --- a/ext/wasm/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/sqlite3-opfs-async-proxy.js @@ -260,7 +260,7 @@ const vfsAsyncImpls = { const fh = __openFiles[fid]; try{ const aRead = new Uint8Array(fh.sab, 0, n); - const nRead = fh.accessHandle.read(aRead, {at: offset}); + const nRead = fh.accessHandle.read(aRead, {at: Number(offset)}); if(nRead < n){/* Zero-fill remaining bytes */ new Uint8Array(fh.sab).fill(0, nRead, n); rc = state.sq3Codes.SQLITE_IOERR_SHORT_READ; @@ -302,7 +302,8 @@ const vfsAsyncImpls = { const fh = __openFiles[fid]; try{ affirmNotRO('xWrite', fh); - const nOut = fh.accessHandle.write(new Uint8Array(fh.sab, 0, n), {at: offset}); + const nOut = fh.accessHandle.write(new Uint8Array(fh.sab, 0, n), + {at: Number(offset)}); rc = (nOut===n) ? 0 : state.sq3Codes.SQLITE_IOERR_WRITE; }catch(e){ error("xWrite():",e,fh); |