fair-acc / opendigitizer

Generic Digitizer Framework based on OpenCMW
GNU Lesser General Public License v3.0
6 stars 3 forks source link

UI: Investigate the CORS issue and WASM #134

Closed ivan-cukic closed 10 months ago

ivan-cukic commented 10 months ago

Enabling pthreads support in emscripten requires SharedArrayBuffer, which in the wake of CPU speculative execution bugs was disabled by browsers if you do not restrict the CORS policies to the maximum by setting the appropriate headers. For the opencmw service worker serving the wasm client they where added but on github pages, we do not control the headers (it's not possible). According to stackoverflow there is a workaround/hack github which reloads the page and modifies the headers, alternatively we could host it somewhere where we can control the headers.

https://github.com/fair-acc/opendigitizer/pull/129 was an attempt to adding the workaround, but it's still not working, not clear if it is not correctly applied or if it is not sufficient.

EDITS

2024-01-08: @wirew0rm added a bit more description

wirew0rm commented 10 months ago

I can confirm in the browser's console that with the fix from before the holidays cross origin isolation is now enabled:

>> window.crossOriginIsolated
<- true

so it looks like this was successful, but enabling threads seems to have uncovered more than one problem, i tracked the next one down to an existing issue, unfortunately simply bumping emscripten as tried in #138 led to build errors in the emscripten build.