Skip to content

Fix for Firefox 136+: Replace removed JSM imports with ESM#11

Open
oxidworks wants to merge 1 commit intotsaost:mainfrom
oxidworks:fix/esm-firefox-136
Open

Fix for Firefox 136+: Replace removed JSM imports with ESM#11
oxidworks wants to merge 1 commit intotsaost:mainfrom
oxidworks:fix/esm-firefox-136

Conversation

@oxidworks
Copy link
Copy Markdown

Firefox 136 completed ESMification and removed ChromeUtils.import() along with all legacy JSM modules. This broke userChrome.js because it relied on:

  • Components.utils.import("resource://gre/modules/Services.jsm")
  • Components.utils.import("resource://gre/modules/AddonManager.jsm")
  • Components.utils.import("resource://gre/modules/FileUtils.jsm")

This PR replaces them with the ESM equivalents:

var Services = globalThis.Services;
var { AddonManager } = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs");
var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");

Tested on Firefox 148 (Linux). Also simplified userChrome.js and added Linux/macOS install paths to the README.

Fixes #5, #7, #8, #9 (related to Firefox compatibility issues).

Firefox 136 removed ChromeUtils.import() and all legacy JSM modules.
This breaks the original userChrome.js which used:
- Components.utils.import("resource://gre/modules/Services.jsm")
- Components.utils.import("resource://gre/modules/AddonManager.jsm")
- Components.utils.import("resource://gre/modules/FileUtils.jsm")

Replaced with ESM equivalents:
- globalThis.Services
- ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs")
- ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs")

Tested on Firefox 148 (Linux).
Also simplified userChrome.js and updated README with Linux/macOS install instructions.
@oxidworks oxidworks force-pushed the fix/esm-firefox-136 branch from 773807c to 6df50bb Compare April 4, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wouldn't AddonManager.installAddonFromSources allow you to install permanently?

1 participant