How glide-browser/glide works
Project type and purpose
• This is a desktop browser built atop Firefox’s Gecko engine.
• It injects a TypeScript-based extension layer (“Glide”) into the engine, patches C++/layout modules, bundles custom UI, offers a CLI/tooling suite, and publishes docs.
Top-level architectural layers/components
A. Build & Release Infrastructure
– .github/*, scripts/*, pnpm-workspaces, infra/*
– CI workflows → bootstrap → compile & bundle → sign → package binaries (Win/mac/Linux)
B. Configuration & Branding
– Determines the branding overlay, platform-specific flags, installer look
C. Gecko Engine & Firefox Source
– src/ (layout, modules, toolkit, network, testing)
– Standard C++ & XPCOM code, patched via *.patch files to add extension hooks
D. Glide Overlay & Native Bridge
– src/glide/cpp/Glide.h & moz.build → C++ shim to register the “Glide” actor modules in the engine
– patch files under src/glide merge into the Firefox build
E. Glide Extension Core (Actors & Content)
– src/glide/browser/actors/ → Parent/Child actors (sys.mts) for privileged messaging
– src/glide/browser/base/content/ → core content scripts (hinting, motions, commands, sandbox, IPC utils)
– src/glide/browser/components/ → UI bundles (preferences UI, tutor, customizable UI)
F. User Configuration & Runtime
– src/browser/app/profile/ → default user JS (betterfox.js, glide.js), pref overrides, removes
– src/browser/actors/ → glue code injecting Glide into a shipping Firefox build
G. Documentation & Web Site
– src/glide/docs/ → markdown + generated assets, code examples, API reference
– build scripts under scripts/ generate HTML/CSS/JS for the glide-browser.app site
Run-time component interactions
1. User presses a key →
2. Browser UI host (Gecko C++ UI) forwards event via extension APIs →
3. Glide content script (TS in browser/base/content/…) captures event, invokes hinting/motion modules →
4. If privileged work is needed (e.g. tab enumeration), send a message to a parent actor (actors/GlideHandlerParent.sys.mjs) →
5. Parent actor runs in a privileged context, calls C++ glue (Glide.h) → native engine APIs → returns data →
6. Content script displays hint overlays or executes nav/motion →
7. Configuration (TypeScript config files) influences behavior via dynamic module imports
– Actors (Parent/Child sys modules)
– Content scripts (commands, motions, hinting)
– UI components (preferences, tutor)
Architectural patterns & design principles
• Extension-host pattern: privileged actors vs unprivileged content scripts
• Patch-overlay: keep core Firefox code intact, apply via moz.build & patch files
• Mono-repo with workspace tooling: scripts + pnpm to unify TS, Python, shell, C++ builds
• Clear separation of build vs runtime vs packaging vs docs
Technologies & frameworks
• TypeScript for extension layer
• Sys.mjs actors (Mozilla’s new JS module actor system)
• Gecko C++ engine, XPCOM
• PNPM & Node.js scripts for TS compilation, docs generation
• Shell/Python for bootstrap, packaging, signing