Prerequisites
To build Glide you must have: You must also verify that your system has the dependencies that Firefox requires:Getting Started
Install dependencies and bootstrap
pnpm bootstrap will:- Download Firefox source code to the
engine/directory - Bundle Glide’s dependencies
- Build the docs
- Apply all patches to the Firefox source code
pnpm bootstrap:mach will:- Download missing system dependencies
- Configure Firefox’s internal
machtool
Build Glide
pnpm bootstrap:mach configures git to use watchman for tracking file access.
On many systems, running git commands in the engine directory may hit the watch limit.
See the watchman docs for details.- Linux: Add
fs.inotify.max_user_watches=524288to/etc/sysctl.confand runsudo sysctl -p - macOS: Add
kern.maxfilesandkern.maxfilesperprocparameters
Development Workflow
File Watcher
You should always have a terminal open running the file watcher:- Compiling TypeScript files to JavaScript
- Rebuilding docs
- Copying source files to the Firefox
engine/directory
Reloading Changes
Most of Glide is implemented in bundled TypeScript files (.mts). These files are loaded on browser start, but not on new tabs or windows. To reload changes:
- Close the browser
- Run
pnpm launchagain
Logging
Generally, useGlideBrowser._log. Some parts of the code use a more specific logger (search for console.createInstance()).
By default, only error level logging is shown. Enable more verbose logging:
ConsoleLogLevel for available log levels. For more information, see Firefox’s logging docs.
User Config
The config file insrc/glide.ts takes precedence over the user-wide config. pnpm bootstrap creates an empty config automatically, but you can edit it manually for testing.
Editor Setup
Pre-push Hook
Glide has a pre-push hook that runs lints automatically before eachgit push:
Linting
Glide uses oxlint for linting. Available extensions:- VSCode extension
- Zed extension
oxc_language_serverLSP
Neovim Configuration
Neovim Configuration
For Neovim 11, use this config:
Formatting
Glide uses dprint for formatting. Install and configure it for your editor. Run auto-formatting manually:Testing
Running Tests
Tests are written using mochitest and located insrc/glide/browser/base/content/test/.
Run all tests:
The file must be the
dist/$file.js version - you cannot pass TypeScript files directly.Writing Tests
Test files must follow the naming conventionbrowser_$name.ts.
A typical test file:
Assertion Functions
Mochitest provides these assertion functions:Adding New Tests
When adding a new test file, include it in thebrowser.toml file for that test directory:
.only() or .skip():
Key Concepts
Firefox Integration
Glide inherits many concepts from Firefox:-
mach CLI: The main way to interact with the Firefox build system. Access it through
pnpm mach. See Firefox docs. - Mochitest: Test framework for browser chrome tests. See testing docs.
- JAR Manifests: Files are included in the Firefox build through JAR Manifests.
-
JS Actors: All interaction with web content is centralized to
GlideHandlerChildactor. See JS Actors docs. -
Module imports: JS imports must use Firefox’s
ChromeUtils.importESModule(). Types can be imported withimport type { .. } from '...'. See system modules docs.
TypeScript Build System
Glide takes a non-standard approach to TypeScript:- TypeScript files are converted to JS by stripping all TS syntax with ts-blank-space
- Output is stored in a relative
./dist/directory - Type syntax is replaced with spaces, so no sourcemaps are needed
- Important: You cannot use any TS syntax that has a runtime effect (e.g.,
enum)
- Integrating TS directly into the Firefox build system is hard
- Aligns with the philosophy that TS should just be JS + types
- Simplifies debugging by preserving line numbers
JS Actors
To interact with web content, Glide uses a single JSWindowActor:GlideHandlerChild.sys.mts.
- Code in
GlideHandlerChild.sys.mtsruns outside the main process - Communicates with the main process by sending messages
- Messages are typed and sent through
.send_async_message(name, args?)
- Parent → Child messages:
GlideHandlerParent.sys.mts::ParentMessages - Child → Parent messages:
GlideHandlerChild.sys.mts::ChildMessages
Firefox Patches
Use the internal script to patch Firefox source code:Documentation Development
The docs pages are written in Markdown and located insrc/glide/docs/. The markdown is converted to HTML using a custom Markdoc integration.
Syntax Highlighting
Performed by Shiki with a custom Tokyo Night theme.Live Reload
Glide ships with a built-in file watcher for docs. Enable it:file:// URI:
Debugging
Debugging Hints
Hint popups disappear when you try to inspect them with the Browser Toolbox. To prevent this:- Disable popup auto-hide in the Browser Toolbox
- See Firefox docs for instructions
<Esc> is pressed.
Community
- Chat: Join the Zulip chat for realtime discussion
- Issues: Report bugs and issues on GitHub
- Discussions: Ask questions on GitHub Discussions