xiaoxiaoflood / firefox-scripts

userChromeJS / autoconfig.js and extensions
Mozilla Public License 2.0
944 stars 83 forks source link

Services.jsm and XPCOMUtils.jsm will be remove #164

Open onemen opened 1 year ago

onemen commented 1 year ago

@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.

xiaoxiaoflood commented 1 year ago

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.