File: bridge/loader-features/loader/nma/README.md
NMA โ Noraneko Module Archive
This directory contains the Noraneko Module Archive (NMA) subsystem,
ported from noraneko. NMA is a
dynamic module loading system that uses Sigstore
to verify the authenticity of module archives before loading them into the
browser.
Think of it as a secure, content-addressed module delivery pipeline: the
browser downloads a signed archive, verifies the signer's identity against a
trusted list, then swaps in updated modules at runtime โ no full reinstall
required.
Status: foundation only (types + state)
The Floorp port is not yet complete. Two of the five NMA files are
intentionally absent: they depend on @freedomofpress/sigstore-browser, which
is not yet a Floorp dependency.
What's here
| File | Layer | What it does |
|---|---|---|
types.ts |
N0 | All NMA interfaces and enums. No imports, no side effects โ pure declarations. |
state.ts |
N1 | Singleton state container. Depends only on types.ts. Contains TODO(Floorp) comments marking what needs to change. |
mod.ts |
N3 (stub) | Public API re-export. Currently exports types and state only; fuller exports will be wired in once core.ts and loader.ts are ported. |
What's missing
| File | Layer | Blocked by |
|---|---|---|
core.ts |
N2 | @freedomofpress/sigstore-browser โ handles FS/network/crypto IO and Sigstore verification |
loader.ts |
N3 | core.ts โ the orchestrator that drives init, verify, and hotswap |
Architecture
NMA is a self-contained subsystem: it does not depend on the main loader'stypes/ or state/ directories. The internal dependency graph is a clean
four-level DAG:
N0: types.ts pure type definitions, no imports
โ
N1: state.ts singleton state + event bus, imports types.ts only
โ
N2: core.ts FS / network / crypto IO, Sigstore verify โ needs sigstore-browser
โ
N3: loader.ts orchestrator: initializeNMALoader, verifyNMA, hotswapโฆ
mod.ts public re-export surfaceThe main loader connects to NMA at its own L2/L3
(io/loading.ts and mod.ts), using initNMASystem(), isNMAActive(),hasNMAModule(), and loadNMAModule(). When NMA is inactive, isNMAActive()
returns false and the existing module path is taken unchanged โ no
disruption to what works today.
Next steps
Complete the port in this order:
Add
@freedomofpress/sigstore-browserto Floorp'sdeno.jsonimportsPort
nma/core.tsโ FS/network/crypto IO and Sigstore verification
Reference:bridge/loader-features/loader/nma/core.tsin noranekorftr-bridgePort
nma/loader.tsโ the orchestrator (initializeNMALoader,verifyNMA,hotswapModule, etc.)
Reference:bridge/loader-features/loader/nma/loader.tsin noranekoWire
initNMASystem()intobridge/loader-features/loader/index.ts
Call it early in the startup sequence, beforeloadEnabledModules(). NMA is
self-silencing when no archive is present, so this won't break anything on
its own.Resolve the
TODO(Floorp)markers instate.ts:- Add Floorp's repository (e.g.
"nyanrus/Floorp") toDEFAULT_NMA_TRUSTED_CONFIG.allowedRepositories - Update
NMA_PATHS.FILE_PATTERNto match Floorp's archive naming convention
- Add Floorp's repository (e.g.
Rename
PREF_HASH_STATEincore.tsfrom"noraneko.nma.hash_state"
to"floorp.nma.hash_state"โ see critical notes below
โ ๏ธ Critical notes
Three things that must be correct for NMA to work safely:
registerNMAResourceordering โ must be called beforeloadEnabledModules(). If it runs after,jar:URL resolution fails
silently and modules don't load.state.loader.isActiveatomicity โ the sequenceverifyNMA โ readManifest โ isActive = truemust not be interrupted or
reordered. SettingisActivebefore verification completes would allow
unverified modules to be loaded.Pref key collision โ if
PREF_HASH_STATEstays as"noraneko.nma.hash_state", Floorp and noraneko share the same preference
on any system where both are installed. Rename to"floorp.nma.hash_state"
before enabling NMA in production.
Pointers
- Upstream NMA source:
bridge/loader-features/loader/nma/inf3liz-dev/noraneko, branchrftr-bridge - Architecture analysis (DAG levels, category-theoretic formalization,
"what would break" notes):~/.mio/notes/noraneko-nma-structure.md - Merge strategy and full roadmap:
~/.myu/notes/noraneko-floorp-merge.md - Session resume notes (Phase A context):
~/.myu/notes/noraneko-floorp-resume.md
File: browser-features/skin/fluerial/README.md
Floorp Fluent UI (floorplegacy)
Used Files
css/fluerial.css (test_legacy.css) icons/menu.svg (menu.svg) icons/newtab.svg
(newtab.svg) icons/material.svg (material.svg) icons/bookmark.svg
(../fluentUI/bookmark.svg)
License
MPL2.0
File: browser-features/modules/modules/chrome-web-store/polyfills/README.md
Chrome API Polyfills for Firefox
This directory contains polyfill implementations for Chrome extension APIs that are not natively supported in Firefox. These polyfills are automatically injected during Chrome extension conversion to provide compatibility.
Purpose
Polyfills in this directory:
- Emulate Chrome-specific APIs using Firefox capabilities
- Are automatically injected during CRX to XPI conversion
- Provide transparent compatibility for extension developers
- Maintain API compatibility with Chrome's implementation
Available Polyfills
Offscreen API Polyfill
File: OffscreenPolyfill.sys.mts
Status: Draft - Not yet integrated
Chrome API: chrome.offscreen
Investigation: docs/investigations/offscreen-api-support.md
Description:
Provides compatibility for Chrome's Offscreen API by creating hidden iframes in Firefox MV3 background scripts. The Offscreen API allows extensions to run DOM-based operations in hidden background contexts.
How it works:
- Creates hidden iframes to emulate offscreen documents
- Leverages Firefox MV3 background scripts' DOM access
- Provides same API surface as Chrome's Offscreen API
- Enforces same constraints (single document, lifecycle rules)
Usage:
// This code works in both Chrome and Firefox with the polyfill
await chrome.offscreen.createDocument({
url: 'offscreen.html',
reasons: ['DOM_PARSER'],
justification: 'Parse HTML content'
});
// Use the offscreen document via message passing
// ...
await chrome.offscreen.closeDocument();Limitations:
- Only works in contexts with DOM access (background scripts)
- Won't work in pure service worker contexts
- Slight lifecycle differences vs. Chrome
- Performance may differ from native implementation
DocumentId Polyfill
Directory: documentId/
Status: Draft - Not yet integrated
Chrome API: documentId property in chrome.scripting and chrome.tabs
Description:
Provides compatibility for Chrome's documentId property (introduced in Chrome 106+) by generating synthetic documentIds based on tabId and frameId. Wraps chrome.scripting.executeScript() and chrome.tabs.sendMessage() to translate documentIds to Firefox-compatible parameters.
How it works:
- Generates unique documentIds in format:
floorp-doc-{tabId}-{frameId}-{instanceId} - Intercepts API calls with
documentIdsand converts totabId/frameIdpairs - Caches parsed documentIds for efficient lookups
Usage:
// This code works in both Chrome and Firefox with the polyfill
await chrome.scripting.executeScript({
target: { documentIds: ['floorp-doc-123-0-abc123'] },
func: () => console.log('Executed!')
});
// With tabs.sendMessage
await chrome.tabs.sendMessage(tabId, message, {
documentId: 'floorp-doc-123-0-abc123'
});Limitations:
- DocumentIds are synthetic and may not persist across browser restarts
- Not fully compatible with all Chrome documentId use cases
- Event handler documentId injection not yet implemented
Integration with Extension Conversion
Current State
Polyfills are currently not integrated into the conversion pipeline. They are reference implementations showing how compatibility could be achieved.
Planned Integration
Manifest Transformation (
ManifestTransformer.sys.mts):- Detect when polyfilled APIs are requested
- Inject polyfill scripts into background context
- Mark manifest with polyfill metadata
Build Integration (
CRXConverter.sys.mts):- Bundle polyfill scripts with converted extension
- Place polyfills in
__floorp_polyfills__/directory - Ensure polyfills load before extension code
Permission Handling (
Constants.sys.mts):- Move polyfilled permissions to
POLYFILLED_PERMISSIONS - Remove from
UNSUPPORTED_PERMISSIONS - Allow permission during conversion
- Move polyfilled permissions to
Creating New Polyfills
When creating a new polyfill:
Research - Create investigation document in
docs/investigations/Implementation - Create polyfill module following this template:
typescript/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * <API Name> Polyfill for Firefox * * Description... * See: docs/investigations/<api-name>-support.md */ // Types export interface APIInterface { // ... } // Implementation class APIPolyfillImpl implements APIInterface { // ... } // Installation export function installAPIPolyfill(): boolean { // ... }Documentation - Document:
- What Chrome API it polyfills
- How it works internally
- Known limitations
- Usage examples
- Testing approach
Testing - Create tests:
- Unit tests for polyfill logic
- Integration tests with sample extensions
- Real-world extension testing
Integration - Update:
Constants.sys.mts- Permission listsManifestTransformer.sys.mts- Injection logicCRXConverter.sys.mts- Build integration
Guidelines
API Compatibility
- Match Chrome's API surface - Same method names, parameters, return types
- Match Chrome's behavior - Same constraints, errors, edge cases
- Document differences - Clearly note any unavoidable differences
Performance
- Minimize overhead - Polyfills should be lightweight
- Lazy initialization - Don't create resources until needed
- Cleanup - Properly dispose of resources
Error Handling
- Match Chrome's errors - Same error messages and conditions
- Fail gracefully - Provide helpful error messages
- Don't break extensions - Errors shouldn't crash the extension
Code Quality
- TypeScript - Use proper type definitions
- Documentation - Comprehensive JSDoc comments
- Testing - Unit and integration tests
- Linting - Follow project code style
Testing Polyfills
Unit Tests
Test polyfill logic in isolation:
// Test basic functionality
await polyfill.createDocument({ /* ... */ });
assert(await polyfill.hasDocument());
await polyfill.closeDocument();
assert(!(await polyfill.hasDocument()));Integration Tests
Test with real extensions:
- Find Chrome extensions using the API
- Convert using Floorp's CRX converter
- Install and test functionality
- Verify API compatibility
Real-world Testing
Test with popular extensions:
- Extensions with many users
- Extensions using the API heavily
- Extensions with different use cases
Maintenance
Monitoring Chrome Changes
- Watch Chrome release notes for API changes
- Update polyfills when Chrome changes behavior
- Test compatibility with new Chrome versions
Monitoring Firefox Changes
- Track Firefox's MV3 implementation
- Adapt polyfills to Firefox changes
- Watch for new native APIs that could replace polyfills
Performance Monitoring
- Benchmark polyfill performance
- Compare with native implementation
- Optimize hot paths
Future Work
Potential Future Polyfills
Based on extension usage patterns, consider polyfills for:
chrome.sidePanel- Chrome's side panel APIchrome.tabCapture- Tab audio/video capture- Other highly-requested Chrome APIs
Native API Migration
If Firefox adds native support for an API:
- Update polyfill to detect native API
- Use native API when available
- Keep polyfill for older Firefox versions
- Eventually deprecate polyfill
Resources
File: browser-features/chrome/common/pwa/README.md
PWA
PWA stands for Progressive Web App, which is a technology that allows web pages available in modern browsers to be used like applications.
What is PWA on Floorp?
Floorp realizes PWA by refactoring Firefox's code, utilizing the SSB (Site Specific Browser) feature that Firefox provided.
For example, ManifestProcesser.ts is written with reference to Firefox code, and functions with the same name exist.
Architecture Overview
The PWA feature consists mainly of two parts:
Frontend part (
src/apps/main/core/common/pwa/)- UI elements (SsbPageAction, SsbPanelView)
- PWA window management
- High-level service API
Backend part (
src/apps/modules/src/modules/pwa/)- Command line integration
- Data storage
- OS integration features
Main Components
- PwaService: Central service class. Integrates other components and provides high-level API
- SiteSpecificBrowserManager: Responsible for PWA installation and management
- SsbRunner: Handles launching PWA windows
- DataManager: Manages information of installed PWAs
- ManifestProcesser: Extracts and processes PWA information from web manifests
OS Integration
Currently, the following integration features are available on the Windows platform:
- Pinning to the taskbar
- Launching in dedicated windows
- Icon integration
On macOS, launcher bundles are created in ~/Applications/Floorp Apps/.
Each bundle contains an executable launcher, Info.plist, and a 512px ICNS icon.
The launcher passes the installing profile and SSB ID to Floorp. Bundle identity
includes the profile, so copied SSB IDs in different profiles do not collide.
Opening an existing PWA from Floorp also creates or repairs its launcher.
Renaming or uninstalling a PWA updates or removes its owned bundle.
This is launcher integration: it does not automatically pin apps to the Dock
or provide a separate native process/Dock identity for each running PWA.
On macOS, verify Finder launch with Floorp both running and closed, manual Dock
pinning, icon display, rename/uninstall, and two profiles before release.
File-generation tests on other platforms do not verify Launch Services behavior.
PWA regression tests are colocated under test/ and underbrowser-features/modules/modules/pwa/supports/test/. They cover toolbar
preferences (including existing configurations and live changes), legacy SSB
data migration, launcher metadata, profile isolation, bundle repair/removal,
and fallback icon encoding. Run with deno task test --near <directory> in
an isolated test profile.
Directory Structure
src/apps/main/core/common/pwa/
โโโ config.ts # Configuration options
โโโ dataStore.ts # Data persistence
โโโ default-pref.ts # Default settings
โโโ iconProcesser.ts # Icon processing
โโโ imageTools.ts # Image processing utilities
โโโ index.ts # Main entry point
โโโ manifestProcesser.ts # Manifest processing
โโโ pwa-window.tsx # PWA window UI
โโโ pwaService.ts # Central service
โโโ SsbPageAction.tsx # URL bar PWA action
โโโ SsbPanelView.tsx # PWA management panel
โโโ ssbManager.ts # SSB management
โโโ ssbRunner.ts # SSB execution
โโโ type.ts # Type definitions
src/apps/modules/src/modules/pwa/
โโโ DataStore.sys.mts # System-level data store
โโโ SsbCommandLineHandler.sys.mts # Command line integration
โโโ ImageTools.sys.mts # Image processing utilities
โโโ supports/ # OS-specific support features
โโโ type.ts # Type definitionsDeveloper Information
To extend the PWA functionality, you mainly need to understand the following files:
pwaService.ts: Adding/changing service APIsssbManager.ts: Extending installation and management featuresmanifestProcesser.ts: Customizing manifest processingSsbPageAction.tsx/SsbPanelView.tsx: Customizing UI elements
To add support for a new platform, implement it in the supports/ directory.
File: browser-features/chrome/common/reverse-sidebar-position/README.md
Reverse Sidebar Position
Currently there is no sidebar impl, so this codes has no effect.
File: browser-features/chrome/README.md
@nora/core
When build, placed on noraneko/content
This component handles almost all of Noraneko's core code.
For menu customization behavior and settings, see the
context menu customization guide.
If you are to make feature modifying preferences, or other internal html, go toroot/apps/main/about/.
Directory Structure
common/
- main codes
- supports hot reload
static/
- codes that can't be hot-reloaded
nora/
- codes that requires noraneko-runtime (esp. cpp patch)
- should be disabled easily for other-runtime
utils/
- Utilities that helps you to code comfortable.
- It is preferred that single file but folder with index.ts can be in.
example/
- as test and template for basic codes
File: docs/development/directories/browser-features/modules/browser-glue.mdx
title: "BrowserGlue & Window Actors" sidebar_label: "BrowserGlue" floorp_commit: "9955ae2e96646d1e323c241fa738b06ea33cf553" generated: true
BrowserGlue & Window Actors
This page is intentionally seeded before Codex rewrites it from the source inventory and allowed source files.
Source Anchors
- Firefox Base:
static/gecko/pref/override.ini - ESM Modules:
browser-features/modules/modules/BrowserGlue.sys.mts - Bridge:
bridge/startup/src/chrome_root.ts - Chrome UI:
browser-features/chrome/common/mod.ts - Pages:
browser-features/pages-settings/vite.config.ts - Loader entrypoint:
bridge/loader-features/loader/index.ts - Loader module registry:
bridge/loader-features/loader/modules.ts - Loader module hooks:
bridge/loader-features/loader/modules-hooks.ts - Chrome feature overview:
browser-features/chrome/README.md - Static chrome feature discovery:
browser-features/chrome/static/mod.ts - Gecko version configuration:
static/gecko/config/README.md - Settings app entry:
browser-features/pages-settings/src/main.tsx - Settings routes:
browser-features/pages-settings/src/App.tsx - Browser test runner:
tools/src/colocated_test_runner.ts - Browser test result collector:
tools/src/browser_test_collector.ts - Development inspection CLI:
tools/dev-tool.ts - Build CLI:
tools/feles-build.ts - Root Deno tasks:
deno.json - Chrome feature discovery:
browser-features/chrome/common/mod.ts - Window Actors:
browser-features/modules/modules/BrowserGlue.sys.mts - Bridge loader:
bridge/startup/src/chrome_root.ts - Loader dev server:
bridge/loader-features/vite.config.ts
File: docs/development/directories/browser-features/modules/overview.mdx
title: "Modules Overview" sidebar_label: "Overview" floorp_commit: "9955ae2e96646d1e323c241fa738b06ea33cf553" generated: true
Modules Overview
This page is intentionally seeded before Codex rewrites it from the source inventory and allowed source files.
Source Anchors
- Firefox Base:
static/gecko/pref/override.ini - ESM Modules:
browser-features/modules/modules/BrowserGlue.sys.mts - Bridge:
bridge/startup/src/chrome_root.ts - Chrome UI:
browser-features/chrome/common/mod.ts - Pages:
browser-features/pages-settings/vite.config.ts - Loader entrypoint:
bridge/loader-features/loader/index.ts - Loader module registry:
bridge/loader-features/loader/modules.ts - Loader module hooks:
bridge/loader-features/loader/modules-hooks.ts - Chrome feature overview:
browser-features/chrome/README.md - Static chrome feature discovery:
browser-features/chrome/static/mod.ts - Gecko version configuration:
static/gecko/config/README.md - Settings app entry:
browser-features/pages-settings/src/main.tsx - Settings routes:
browser-features/pages-settings/src/App.tsx - Browser test runner:
tools/src/colocated_test_runner.ts - Browser test result collector:
tools/src/browser_test_collector.ts - Development inspection CLI:
tools/dev-tool.ts - Build CLI:
tools/feles-build.ts - Root Deno tasks:
deno.json - Chrome feature discovery:
browser-features/chrome/common/mod.ts - Window Actors:
browser-features/modules/modules/BrowserGlue.sys.mts - Bridge loader:
bridge/startup/src/chrome_root.ts - Loader dev server:
bridge/loader-features/vite.config.ts