openzim / openzim/javascript-libzim

Upcoming issues with `SharedArrayBuffer`

Open
#22 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build
Dominant language
JavaScript
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Description

It is worth noting that Chrome will disable SharedArrayBuffer by default from Chrome 113 unless a site is cross origin isolated, which means that it serves these headers:

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

See https://developer.chrome.com/blog/enabling-shared-array-buffer/

It is relevant for this Repo, as the type of File Reader that we enable when compiling the WASM uses SharedArrayBuffer to pass a multi-gigabyte File to the WASM Worker without copying or loading in memory. This is why the WASM doesn't work on Chrome Mobile, where there is no support for SharedArrayBuffer except behind a flag, and it seems no support at all for it with POSIX threading enabled in source binaries.

For the PWA versions, we should be able to serve those headers. Other versions that don't use https: may struggle. We may need to look into alternative file systems for the WASM.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Chrome guidance, then trace how the PWA versions serve responses and where the WASM File Reader uses SharedArrayBuffer for the WASM Worker. Determine whether the required cross-origin-isolation headers cover the PWA versions and document or investigate an alternative filesystem approach for non-HTTPS and Chrome Mobile cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.