Skip to content

Commit c514aad

Browse files
committed
17 - testing clarification
1 parent a37a302 commit c514aad

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

CONTRIBUTE.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,38 @@ common prefix of the files you downloaded as the first argument:
8282
```bash
8383
# For example, if you downloaded FMOD 2.01.07:
8484
./update_fmod.sh ~/Downloads/fmodstudioapi20107
85-
```
85+
```
86+
87+
## Testing HTML5/WASM pthread builds locally
88+
89+
WASM pthread builds require specific CORS headers to enable `SharedArrayBuffer`.
90+
Regular `python3 -m http.server` will **not** work so please send required headers.
91+
92+
**Required headers:**
93+
- `Cross-Origin-Opener-Policy: same-origin`
94+
- `Cross-Origin-Embedder-Policy: require-corp`
95+
96+
So for python serving, you can add the request CORS handler like
97+
```python3
98+
class CORSRequestHandler(SimpleHTTPRequestHandler):
99+
(...)
100+
def end_headers(self):
101+
self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
102+
self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
103+
```
104+
105+
106+
**Build with both architectures** (loader needs both for fallback):
107+
108+
```bash
109+
java -jar bob.jar build bundle --platform js-web \
110+
--architectures wasm-web,wasm_pthread-web \
111+
--bundle-format html5
112+
(...)
113+
```
114+
115+
Validate in the console
116+
117+
```javascript
118+
console.log("Pthread:", Module.isWASMPthreadSupported); // Should be: true
119+
```

0 commit comments

Comments
 (0)