fix(harbour-t3code): run T3 in-app via Gecko 91 compat layer (0.2.0) #2

Merged
Grok merged 1 commit from fix/gecko91-compat-layer into main 2026-10-05 19:12:48 +02:00
Contributor

Root cause

Reproduced on Firefox 91.13 ESR, the same Gecko as the SFOS 5.2 Browser/WebView:

  • JS: boot throws TypeError: Object.hasOwn is not a function (Firefox 92+), so T3 shows "T3 Code could not load". This is the white/blank screen from 0.1.x. The bundle also needs toSorted, findLast, structuredClone, AbortSignal.any, and a few more. Its syntax is fine for FF91; only runtime APIs are missing.
  • CSS: Tailwind v4 puts every rule inside @layer (FF97+) and uses oklch() / color-mix() (FF113+). Gecko 91 drops all of it, so the page is unstyled.

The earlier conclusion ("Gecko can't run the SPA") was wrong. Both gaps can be patched from inside the page.

Fix

  • qml/js/t3frame.js: WebView frame script. On DOMWindowCreated it evals the payload in the page global, before any page script runs.
  • qml/js/t3compat.js:
    • gap-filling polyfills;
    • stylesheet lowering: unwraps @layer (keeps layer order), converts literal oklch/lab/color-mix to rgb, maps dvh to vh;
    • a runtime resolver for color-mix(var()) theme variables, which follows light/dark/theme switches;
    • auto-skips the CSS work on engines that support @layer + color-mix (the upcoming ESR115).
  • WebViewPage: frame-script handshake, then load(). The page stays hidden until #boot-shell is replaced; otherwise a diagnostics fallback appears.
  • Launcher: Open T3 Code (in-app) is the primary action again. The external browser has no compat layer.
  • Version 0.2.0. Also removes a literal %install from a spec comment, which broke mb2 ("second %install").

Verification

  • FF91 ESR + payload: T3 mounts and renders like Firefox 157, in light and dark mode. __t3Sfos.errors is empty.
  • FF91 ESR frame-script path (messageManager.loadFrameScript, same mechanism as embedlite): handshake → injected → mounted.
  • Firefox 157: CSS lowering is skipped and the app is unchanged.
  • qmllint is clean and the scaffold check passes.
  • Not yet tested on a real device.

🤖 Generated with Claude Code

## Root cause Reproduced on **Firefox 91.13 ESR**, the same Gecko as the SFOS 5.2 Browser/WebView: - **JS:** boot throws `TypeError: Object.hasOwn is not a function` (Firefox 92+), so T3 shows *"T3 Code could not load"*. This is the white/blank screen from 0.1.x. The bundle also needs `toSorted`, `findLast`, `structuredClone`, `AbortSignal.any`, and a few more. Its syntax is fine for FF91; only runtime APIs are missing. - **CSS:** Tailwind v4 puts every rule inside `@layer` (FF97+) and uses `oklch()` / `color-mix()` (FF113+). Gecko 91 drops all of it, so the page is unstyled. The earlier conclusion ("Gecko can't run the SPA") was wrong. Both gaps can be patched from inside the page. ## Fix - `qml/js/t3frame.js`: WebView frame script. On `DOMWindowCreated` it evals the payload in the page global, before any page script runs. - `qml/js/t3compat.js`: - gap-filling polyfills; - stylesheet lowering: unwraps `@layer` (keeps layer order), converts literal `oklch`/`lab`/`color-mix` to rgb, maps `dvh` to `vh`; - a runtime resolver for `color-mix(var())` theme variables, which follows light/dark/theme switches; - auto-skips the CSS work on engines that support `@layer` + `color-mix` (the upcoming ESR115). - `WebViewPage`: frame-script handshake, then `load()`. The page stays hidden until `#boot-shell` is replaced; otherwise a diagnostics fallback appears. - Launcher: **Open T3 Code** (in-app) is the primary action again. The external browser has no compat layer. - Version 0.2.0. Also removes a literal `%install` from a spec comment, which broke `mb2` ("second %install"). ## Verification - FF91 ESR + payload: T3 mounts and renders like Firefox 157, in light and dark mode. `__t3Sfos.errors` is empty. - FF91 ESR frame-script path (`messageManager.loadFrameScript`, same mechanism as embedlite): handshake → injected → mounted. - Firefox 157: CSS lowering is skipped and the app is unchanged. - `qmllint` is clean and the scaffold check passes. - **Not yet tested on a real device.** 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(harbour-t3code): run T3 in-app via Gecko 91 compat layer (0.2.0)
All checks were successful
harbour-t3code-rpm / gate (pull_request) Successful in 1s
harbour-t3code-rpm / build-blocked (pull_request) Has been skipped
harbour-t3code-rpm / build (pull_request) Successful in 12s
0b03435128
Root cause of the blank / "T3 Code could not load" screen, reproduced on
Firefox 91.13 ESR (same Gecko as SFOS 5.2 Browser/WebView):

- JS: boot dies on `Object.hasOwn is not a function` (FF92+); the bundle
  also needs toSorted/findLast/structuredClone/AbortSignal.any etc.
  Syntax is fine for FF91 — only runtime APIs are missing.
- CSS: Tailwind v4 wraps every rule in @layer (FF97+) and uses
  oklch()/color-mix() (FF113+), so nothing is styled on Gecko 91.

Fix: WebViewPage loads js/t3frame.js as a WebView frame script, hands it
js/t3compat.js, and only then loads the URL. On DOMWindowCreated the frame
script evals the payload in the page global before any page script:

- gap-filling polyfills for the missing ES2022+/Web APIs
- stylesheet lowering: unwrap @layer (layer order kept), literal
  oklch/lab/color-mix -> rgb, dvh -> vh, color-mix(var()) handled by a
  runtime resolver that evaluates computed values (light/dark/themes)
- skipped automatically on engines with @layer + color-mix (ESR115+)

Verified on FF91 ESR: app mounts and renders like Firefox 157, in light
and dark mode, via both direct injection and the frame-script path.

Also: "Open T3 Code" (in-app) is the primary launcher action again; WebView
stays hidden until #boot-shell is replaced, with a diagnostics fallback.
Spec comment no longer contains a literal %install (mb2 "second %install"
parse error).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Grok merged commit 99ebda3548 into main 2026-10-05 19:12:48 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
donach/t3code-sfos!2
No description provided.