xiaoxiaoflood / firefox-scripts

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

BootstrapLoader stop working: TypeError: "AppConstants" is read-only #196

Closed onemen closed 1 year ago

onemen commented 1 year ago

BootstrapLoader stop working Starting today with Firefox Nightly 108.0a1, Build ID: 20221019211615

the error BootstrapLoader: TypeError: "AppConstants" is read-only is trigger by this line from BootstrapLoader.js Constants.AppConstants = Object.freeze(temp);

Maybe it is related to changes made by bug 1792341 AppConstants.jsm renamed to AppConstants.sys.mjs and it is now an Esm module

onemen commented 1 year ago

Look like there is a simple fix to this issue

Add the line delete Constants.AppConstants;

https://github.com/xiaoxiaoflood/firefox-scripts/blob/c9ad50550b18bcce78046362b137613335da997b/chrome/utils/BootstrapLoader.jsm#L18-L22

    // signing bypass by onemen
    const Constants = ChromeUtils.import('resource://gre/modules/AppConstants.jsm');
    const temp = Object.assign({}, Constants.AppConstants);
    temp.MOZ_REQUIRE_SIGNING = false
+   delete Constants.AppConstants;
    Constants.AppConstants = Object.freeze(temp);
onemen commented 1 year ago

but now i get BootstrapLoader: TypeError: property "AppConstants" is non-configurable and can't be deleted

need to investigate more !!!

117649 commented 1 year ago

This may prevent release channel to use legacy add-ons ever again ?!!

If the AppConstants is unchangeable in the future, Is it possible we redirect whole file to an edited one? Like what Mozilla are doing now with from .jsm to .sys.mjs ?

xiaoxiaoflood commented 1 year ago

Fixed, right?

onemen commented 1 year ago

@xiaoxiaoflood, it is working,

however it may trigger an issue for Waterfox users, same as #149, maybe you can move all the bootstrap loading code into a new file in chrome/utils

marty60 commented 1 year ago

xiaoxiaoflood,

This is puzzling trying to figure out where the problem is coming from but since updating BootstrapLoader.jsm the custom and script buttons are larger now than the addon icons on the toolbars. Aris cannot reproduce it so it does not appear to be a firefox issue.

Can you reproduce it? I have downloaded and installed some of your script buttons and those icons are larger too.

xiaoxiaoflood commented 1 year ago

@onemen

The change shouldn't disturb ESR v102. As you can see in the code, it works with both v108+ (AppConstants.sys.mjs) and v107- (AppConstants.jsm). Even because I use DevEd, I'd never push an update that doesn't work on DevEd (currently in v107, actually I'm still using v106).

And I can't move signing bypass code away from config.js because this new version would cause recursion.

@marty60

No, everything is fine for me and I see no relation between latest change and the size of anything.