Skip to content

fix(tauri): restore the Linux renderer environment, re-enabling SharedArrayBuffer (0.1.19) - #343

Merged
zackees merged 2 commits into
mainfrom
fix/linux-webview-shared-array-buffer
Sep 21, 2026
Merged

zackees merged 2 commits into
mainfrom
fix/linux-webview-shared-array-buffer

Conversation

@zackees

@zackees zackees commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

The regression

The WebKitGTK adapter rewrite dropped prepare_renderer_environment, so the Linux view no longer sets JSC_useSharedArrayBuffer=1 before Wry launches WebKit. JavaScriptCore gates SharedArrayBuffer behind that switch — a cross-origin-isolated page alone does not enable it — so SharedArrayBuffer has been undefined in every Linux view since 0.1.15.

Any guest that uses threads then fails at its first worker message. An Emscripten pthread build rejects inside loadWasmModuleToWorker and never paints.

Evidence

Found from fastled-wasm's viewer, whose CI render smoke passes on v0.1.11 and fails on 0.1.15+ (it fails identically on a re-run, and reproduces locally). Bisected with a probe page injected into the served sketch:

kernal-api crossOriginIsolated SharedArrayBuffer viewer
v0.1.11 true function setup runs
0.1.15 / 0.1.16 / 0.1.18 true undefined rejects in loadWasmModuleToWorker, no canvas
this branch true function renders a full frame

With this fix, fastled-wasm's render smoke passes locally end to end: exit 0, no unhandled rejection, ci/check_render.py reports 28160/28160 pixels lit, and the late-screenmap recovery marker is present.

The fix

Restores HostFacts/environment_overrides/detect_host/prepare_renderer_environment and calls it from NativeWebviewLoop::new before Wry::new, where it ran before. The NVIDIA explicit-sync and DMABUF-renderer workarounds were lost with the same function and come back with it. Existing user values still win, and the decision table keeps its unit test.

Also bumps to 0.1.19, so this ships.

Local validation: fmt, clippy --no-default-features --features tauri-webview --lib -D warnings, the linux_webkitgtk unit tests (4 passed), --test source_policy (21 passed).

🤖 Generated with Claude Code

zackees and others added 2 commits September 20, 2026 16:38
…dArrayBuffer

The WebKitGTK adapter rewrite dropped `prepare_renderer_environment`, so the
view no longer sets `JSC_useSharedArrayBuffer=1` before Wry launches WebKit.
JavaScriptCore gates `SharedArrayBuffer` behind that switch, and a
cross-origin-isolated page alone does not enable it, so `SharedArrayBuffer`
became undefined in every Linux view. A guest that uses threads then fails at
the first worker message: an Emscripten pthread build rejects in
`loadWasmModuleToWorker` and never paints.

Observed with fastled-wasm's viewer, whose render smoke passes on v0.1.11 and
fails from 0.1.15 on. A probe page reports `crossOriginIsolated=true` with
`SharedArrayBuffer=undefined` before this change and `=function` after, and the
viewer then renders a full frame.

The NVIDIA explicit-sync and DMABUF-renderer workarounds were lost with the
same function and come back with it. Existing user values still win, and the
decision table is unit-tested.

Release 0.1.19.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees merged commit f836403 into main Sep 21, 2026
1 of 9 checks passed
@zackees
zackees deleted the fix/linux-webview-shared-array-buffer branch September 21, 2026 02:04
zackees added a commit to FastLED/cli that referenced this pull request Sep 21, 2026
0.1.15 through 0.1.18 dropped the WebKitGTK renderer environment, so the Linux
view never set JSC_useSharedArrayBuffer=1 and SharedArrayBuffer was undefined.
The viewer's Emscripten pthread build then rejected in loadWasmModuleToWorker
and never painted a canvas, which is what the render smoke caught.
forge-ci/kernal-api#343 restores it in 0.1.19.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zackees added a commit to FastLED/cli that referenced this pull request Sep 21, 2026
* build: depend on kernal-api 0.1.18 from crates.io, as one crate

The git dependency on kernal-api's repository becomes an exact crates.io pin,
for both the library and the build script. kernal-api 0.1.18 amalgamated its
build-script companion into the one crate, so build.rs now calls
kernal_api::build_resources and the build-dependency is kernal-api itself with
default-features = false and only the build-resources feature.

The viewer feature no longer forwards kernal-api/tauri-webview: Cargo applies a
`kernal-api/<feature>` entry in this package's feature table to every
dependency of that name, including the build-dependency, which would compile
Tauri, GTK and glib for the host build script. Tauri is enabled on the normal
dependency declaration instead, and `viewer` gates only this crate's own code.
The build script's dependency graph is 16 crates: kernal-api's native base plus
the resource compiler.

The boundary tests pin the exact version for both dependency kinds, assert the
lockfile resolves both from the crates.io registry rather than a patch, git
source or path override, and reject any `kernal-api/<feature>` entry in this
package's feature table.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* build: take kernal-api 0.1.19, which restores SharedArrayBuffer on Linux

0.1.15 through 0.1.18 dropped the WebKitGTK renderer environment, so the Linux
view never set JSC_useSharedArrayBuffer=1 and SharedArrayBuffer was undefined.
The viewer's Emscripten pthread build then rejected in loadWasmModuleToWorker
and never painted a canvas, which is what the render smoke caught.
forge-ci/kernal-api#343 restores it in 0.1.19.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant