firefox-scripts icon indicating copy to clipboard operation
firefox-scripts copied to clipboard

Services.jsm and XPCOMUtils.jsm will be remove

Open onemen opened this issue 2 years ago • 1 comments

@xiaoxiaoflood,

Firefox are going to change the way it import modules.

According to Bug 1667455 - Expose a "Services" property on all privileged JS scopes - Services.jsm will be remove in future versions of Firefox.

This fix work for all Firefox versions, globalThis.Services exist from Firefox 104.

const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

Bug 1777486 - Migrate XPCOMUtils.jsm, removed XPCOMUtils.jsm in Firefox 104 and replaced it with XPCOMUtils.sys.mjs file.

Currently firefox uses redirect shim to load XPCOMUtils.sys.mjs when it detect imports for XPCOMUtils.jsm. The redirect shim can slow the import and it will be remove eventually in the future.

More .jsm will be converted to .sys.mjs in the future.

I can work on PR I you want.

onemen avatar Jul 27 '22 18:07 onemen

Thanks. I just upgraded to Fx 104 and as for now only two extensions needed minor changes (DTA! and QuickFox Notes), everything else still work at first sight.

Later I'll see if it's worth to change/remove obsolete code even though things are still working.

xiaoxiaoflood avatar Aug 01 '22 21:08 xiaoxiaoflood