MCPcopy Index your code
hub / github.com/OtsoBear/chrome2moz

github.com/OtsoBear/chrome2moz @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
365 symbols 688 edges 46 files 88 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Chrome to Firefox Extension Converter

License: MIT Rust WebAssembly Build Status

A Rust-based CLI tool and WebAssembly library that converts Chrome Manifest V3 extensions to Firefox-compatible format.

Live Demo: https://otsobear.github.io/chrome2moz/

Why This Tool?

Firefox natively supports chrome.* APIs, but some Chrome-only APIs don't exist in Firefox. This tool:

  • Detects 176 Chrome-only APIs (e.g., chrome.offscreen, chrome.declarativeContent, chrome.tabGroups)
  • Converts manifests (service workers → event pages, permission separation)
  • Provides runtime shims for Chrome-only APIs
  • Checks keyboard shortcuts for conflicts with Firefox built-ins

Read more: ARCHITECTURE.md covers Chrome API detection system, detection scope, and keyboard shortcuts in detail.

Features

  • Smart Detection: Identifies Chrome-only APIs that need conversion
  • Manifest Transformation: Handles MV3 manifest differences for Firefox
  • Keyboard Shortcut Checker: Detects conflicts with 60+ Firefox shortcuts
  • Multiple Formats: Supports .crx, .zip, or unpacked directories
  • Web Interface: Browser-based UI (no installation required)

Quick Start

Web UI (Recommended)

./build-wasm.sh
cd web && python3 -m http.server 8080
# Open http://localhost:8080

Drag & drop your Chrome extension ZIP, analyze, and download the converted Firefox version.

CLI

# Install
git clone https://github.com/OtsoBear/chrome2moz.git
cd chrome2moz
cargo build --release

# Analyze
./target/release/chrome2moz analyze -i ./chrome-extension

# Convert
./target/release/chrome2moz convert -i ./chrome-extension -o ./output

# List Chrome-only APIs
./target/release/chrome2moz chrome-only-apis

Options: --report (generate report), --yes (skip prompts), --preserve-chrome (keep both namespaces)

What Gets Converted

Chrome-Only APIs → Runtime shims provided for: - chrome.storage.session → In-memory polyfill - chrome.sidePanel → Firefox sidebarAction - chrome.offscreen → Web Workers/content scripts - chrome.declarativeContent → Content script patterns - chrome.tabGroups → No-op stub (Firefox doesn't support) - And more... (see ARCHITECTURE.md)

Manifest Changes: - background.service_workerbackground.scripts (event page) - Add browser_specific_settings.gecko for Firefox ID - Separate permissions from host_permissions - Convert web_accessible_resources format - Handle importScripts() → Add to manifest

Firefox Compatibility Fixes: - Automatically disables browser.management.uninstallSelf() calls - Prevents extensions from self-destructing when detecting Firefox - See docs/FIREFOX_SELF_UNINSTALL_FIX.md for details

API Coverage

View Full API Status →

Testing in Firefox

  1. Open about:debugging#/runtime/this-firefox
  2. Click "Load Temporary Add-on"
  3. Select the converted manifest.json or .xpi file

Check Browser Console (Ctrl+Shift+J) for any errors.

Important Notes

  • Firefox supports chrome.* namespace natively - no need to rewrite to browser.*
  • Static analysis has limits - runtime behavior differences need manual testing
  • ~90% of conversions work automatically; remaining 10% may need manual adjustments
  • See ARCHITECTURE.md for what's detected vs. what requires testing

Contributing

Contributions welcome! See ARCHITECTURE.md for architectural details.

cargo fmt && cargo clippy && cargo test

Resources

License

MIT License - See LICENSE file for details.

Core symbols most depended-on inside this repo

convert_extension
called by 10
src/lib.rs
replace_chrome_urls
called by 8
src/utils/url_replacer.rs
with_suggestion
called by 8
src/models/incompatibility.rs
showError
called by 8
web/app.js
auto_fixable
called by 7
src/models/incompatibility.rs
escapeHtml
called by 7
web/app.js
normalize_shortcut
called by 6
src/scripts/check_keyboard_shortcuts.rs
get_file_content
called by 6
src/models/extension.rs

Shape

Function 194
Method 94
Class 58
Enum 19

Languages

Rust94%
TypeScript6%

Modules by API surface

web/app.js23 symbols
src/models/chrome_only.rs23 symbols
src/scripts/check_keyboard_shortcuts.rs21 symbols
src/scripts/fetch_chrome_only_apis.rs18 symbols
src/transformer/manifest.rs17 symbols
src/models/conversion.rs17 symbols
src/models/chrome_api_data.rs16 symbols
tests/integration_tests.rs15 symbols
tests/chrome_only_api_tests.rs15 symbols
src/transformer/shims.rs15 symbols
src/transformer/offscreen_converter.rs13 symbols
src/analyzer/offscreen.rs13 symbols

For agents

$ claude mcp add chrome2moz \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact