-
Notifications
You must be signed in to change notification settings - Fork 9
Description
On Firefox v141.0 I get error:- "userChrome.js Ex(TypeError: Components.utils.import is not a function) userChrome.js:24"
According to https://bugzilla.mozilla.org/show_bug.cgi?id=1954693 "Components.utils.import" is now replaced by "ChromeUtils.importESModule", for example like this:-
var { AddonManager } = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs");
var { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
(and also see
https://groups.google.com/a/mozilla.org/g/enterprise/c/ILrFpLX43iM
https://firefox-source-docs.mozilla.org/jsloader/system-modules.html import sections)
I tried replacing with :-
const { AddonManager } = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs");
const { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
However I then get error:-
userChrome.js Ex(Expected absolute path: ReferenceError: FileUtils is not defined) userChrome.js:24
reportError userChrome.js:24
installExtension userChrome.js:62
Two ways it does work:-
1/ Make them vars instead of consts.
2/ Leave as const and move the statements to within the installExtension function