kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Zip-based resources render blank on Chromium 80–102 because DecompressionStream lacks 'deflate-raw'

Open rtibblesbot opened this issue 3 weeks ago • 2 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: release-v0.20.x

Observed behavior

  • On the Android app's system WebView (Chrome 83, Android 11 emulator), opening a Bloom book leaves the player pane blank grey.
  • packages/kolibri-zip/src/index.js#L16-L22 turns on zip.js useCompressionStream whenever CompressionStream exists. Chromium 80–102 has the API but only gained the deflate-raw format in 103.
  • With CompressionStream/DecompressionStream deleted from the WebView before load, zip.js falls back to its own inflater and the same book renders and pages to completion.
  • The Bloom, H5P, Perseus, QTI and safe HTML5 viewers all read their files through kolibri-zip. Only Bloom was exercised.

Errors and logs

WebView console (adb logcat chromium:I *:S):

"Handler loading/initialization failed: TypeError: Failed to construct 'DecompressionStream': Unsupported compression format: 'deflate-raw'", source: http://127.0.0.1:43351/content/static/sandbox/sandbox-bc285b08dd709cc07c27.js (2)

User-facing consequences

  • Learners on devices with a WebView or browser between Chromium 80 and 102 get a blank pane for zip-based resources. These are common on offline Android devices whose WebView never updates.

Steps to reproduce

  1. Install the Android app built from develop on an Android 11 emulator (system WebView 83, not updated).
  2. Import a channel containing a Bloom book (e.g. "Papaya" in the Kolibri QA Channel).
  3. Open the book in Learn.

Acceptance Criteria

  • [ ] On Chromium 80–102 (Android WebView 83), a Bloom book, an H5P resource and a safe HTML5 resource render and their sandbox logs no DecompressionStream error.
  • [ ] Browsers that support 'deflate-raw' still use the native DecompressionStream.
  • [ ] A kolibri-zip unit test fails when CompressionStream exists without 'deflate-raw' support and zip.js still opts into it.

Context

  • Kolibri 0.20.0a2.dev1797+g889bd8ffb (develop at 889bd8ffbb), Android app debug build, Android 11 emulator, WebView Chrome/83.0.4103.106.

AI usage

Claude Code found this during automated QA of a Bloom player PR on the Android emulator. It ran the reproduction, captured the console error and the workaround run, and drafted this issue.

rtibblesbot avatar Nov 11 '26 19:11 rtibblesbot

Plan: Zip-based viewers render on Chromium 80–102: kolibri-zip uses native compression streams only where they accept 'deflate-raw', and its fallback codec runs under Kolibri's own CSP.

  • [ ] Probe 'deflate-raw' support in kolibri-zip
  • [ ] Use zip.js's pure-JS codec build
  • [ ] Self-review the produced code

Assumptions — the issue did not settle these; say so if one is wrong.

  • Chromium 80–102 refuses WebAssembly under the main-app CSP, so kolibri-zip moves to zip.js's pure-JS build: if it does not, the swap only costs older browsers a slower inflater than wasm. Not verifiable off-device; the slow check's safe HTML5 resource on WebView 83 settles it.
  • The QA phase's Android emulator (system WebView 83) can verify the first criterion: if it cannot, that criterion needs a person with an Android 11 device.
  • Perseus and QTI get no device check, since the first criterion names only Bloom, H5P and safe HTML5: a fault specific to those two on WebView 83 would ship unseen.
  • A zip.js bump is out of scope on a release branch: if maintainers prefer one, Task 2's build swap may be redundant with upstream's own handling.

Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Nov 25 '26 02:11 rtibblesbot

Fixed in #16027

rtibbles avatar Nov 25 '26 18:11 rtibbles