$ show mdn/webextensions-examples
This repository is a collection of over 60 simple, installable WebExtension examples, primarily maintained by Mozilla. The codebase is not a single application but a set of independent browser extensions, each in its own directory, demonstrating specific WebExtensions APIs such as tabs, storage, webRequest, menus, and declarativeNetRequest. The examples cover both Manifest V2 and V3, with patterns for background scripts, content scripts, popups, sidebars, and options pages. The repository also includes a shared examples.json metadata file with schema validation, ESLint configuration, and a GitHub Actions workflow for linting and validation. The practical value lies in being a reference and starting point for developers building browser extensions, rather than a production-ready deployable system.
The LLM identified 2 files worth highlighting for reuse:
A self-contained utility for saving, loading, and removing Blobs in IndexedDB using the idb-file-storage library. It provides clean async functions (saveCollectedBlobs, loadStoredImages, removeStoredImages) that can be extracted and reused in any extension needing persistent offline blob storage without additional dependencies.
Implements the core logic of a user script manager: parsing user script metadata blocks, generating RegisteredUserScript objects for the browser.userScripts API, computing differences between old and new script registrations, and handling privileged API calls from sandboxed user script worlds. This module is well-structured, has no hardcoded paths, and could be extracted to form the basis of a full userscript manager extension.