Bug 252138

Summary: Sqlite wasm opfs support
Product: WebKit Reporter: Philip Wedemann <mybztg>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: cdumez, mark.lam, sihui_liu, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Apple Silicon)   
OS: macOS 13   

Description Philip Wedemann 2023-02-12 12:54:58 PST
I tried to use Sqlite WASM with OPFS as described in https://developer.chrome.com/blog/sqlite-wasm-in-the-browser-backed-by-the-origin-private-file-system/.
The release version of Safari 16.3 (18614.4.6.1.5) does not support nested webworkers (https://bugs.webkit.org/show_bug.cgi?id=22723), so I used 163 (Safari 16.4, WebKit 18615.1.18.100.1).

Expected:
A working persistence sqlite database using opfs, actually the same results like in Chrome (109.0.5414.119 (arm64))

```
Loading and initializing sqlite3 module...
Done initializing. Running demo...
sqlite3 version 3.40.0 2022-10-25 16:04:44 ff4fc29c38b78dfd471e25942304cba352469d6018f1c09158172795dbdd438c
The OPFS is available.
transient db = /mydb.sqlite3
Create a table...
Insert some data using exec()...
Query data with exec() using rowMode 'array'...
row  1 = 20
row  2 = 21
row  3 = 22
```

Actual behaviour:
16.3 (18614.4.6.1.5):
```
Loading and initializing sqlite3 module...
Done initializing. Running demo...
sqlite3 version 3.40.0 2022-10-25 16:04:44 ff4fc29c38b78dfd471e25942304cba352469d6018f1c09158172795dbdd438c
The OPFS is not available.
transient db = /mydb.sqlite3
Create a table...
Insert some data using exec()...
Query data with exec() using rowMode 'array'...
row  1 = 20
row  2 = 21
row  3 = 22
```

163 (Safari 16.4, WebKit 18615.1.18.100.1):
```
Loading and initializing sqlite3 module...
```

While 16.3 release does not support opfs, it is using the kvvs fallback.
With the latest preview, opfs is supported, but there are no results/errors at all.

To reproduce:
Open https://sqlite-wasm-opfs.glitch.me

I did open the issue in webkit and not in sqlite, because it works with chrome.
Comment 1 Radar WebKit Bug Importer 2023-02-19 12:55:18 PST
<rdar://problem/105652735>
Comment 2 Philip Wedemann 2023-07-13 04:21:53 PDT
With Version 17.0 (19616.1.20.11.3) I get this message:
```
Loading and initializing sqlite3 module...
Done initializing. Running demo...
sqlite3 version 3.40.0 2022-10-25 16:04:44 ff4fc29c38b78dfd471e25942304cba352469d6018f1c09158172795dbdd438c
The OPFS is available.
transient db = /mydb.sqlite3
Create a table...
Insert some data using exec()...
Query data with exec() using rowMode 'array'...
row  1 = 20
row  2 = 20
row  3 = 20
```

So OPFS is available.
Comment 3 Sihui Liu 2023-08-28 15:42:06 PDT
This issue is fixed based on my local testing in latest Safari, so I am going to close it.

Please file a new bug if you still see issue related to sqlite wasm.