Web: WebAssembly build served cross-origin isolated, immutable and precompressed

The web app is built with --wasm (skwasm, JS/CanvasKit fallback beside it).
The proxy serves it with COOP same-origin + COEP credentialless so skwasm
renders on a worker; an installed build loads from /_v/<buildId>/ cached as
immutable, other files revalidate by ETag, and the installer precompresses
.br/.gz variants the proxy sends by Accept-Encoding. The bootstrap no
longer registers Flutter's deprecated service worker (a reload per install).
Read aloud on the web uses the Web Speech API through package:web: the
flutter_tts web plugin's interop casts fail under wasm. Bench kit: isolation
and headed modes, renderer and memory reporting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 21:05:17 +00:00
parent 23d8658e80
commit 3b1760fe8e
17 changed files with 737 additions and 17 deletions
+19
View File
@@ -116,6 +116,25 @@ class AppBuildTests(unittest.TestCase):
self.assertEqual(json.loads((output / "release.json").read_text()), {
"schema": 1, "platform": "web", "buildId": identity})
def test_web_build_is_precompressed_before_it_is_cached(self):
runner = Runner()
with patch.object(app_build.shutil, "which", return_value="/usr/bin/node"):
output = app_build.build("web", runner=runner, cache=Path(self.home.name) / "cache", log=lambda *_: None)
call = next(call for call in runner.calls if call[0] == "/usr/bin/node")
self.assertEqual(call[1], str(app_build.PRECOMPRESS))
# It ran on the build's staging directory, which became the entry.
self.assertEqual(Path(call[2]).parent, output.parent)
docker_run = next(i for i, c in enumerate(runner.calls) if c[:2] == ["docker", "run"])
self.assertLess(docker_run, runner.calls.index(call))
def test_web_build_without_node_is_served_uncompressed(self):
runner = Runner()
messages = []
with patch.object(app_build.shutil, "which", return_value=None):
app_build.build("web", runner=runner, cache=Path(self.home.name) / "cache", log=messages.append)
self.assertFalse(any("precompress_web.mjs" in " ".join(c) for c in runner.calls))
self.assertTrue(any("uncompressed" in m for m in messages))
def test_old_web_cache_without_release_metadata_is_rebuilt(self):
runner = Runner()
cache = Path(self.home.name) / "cache"