User scripts @startup and @shutdown broken with 142
If a user script has @startup or @shutdown attributes, these no longer work. Most scripts don't have a @startup, so still work, just can't be successfully unloaded. In userChrome.js, these are called using eval which is no longer allowed.
Perhaps a workaround might be to change the userScript definition so the startup and shutdown methods are hard-coded known names, rather than defined by attributes? Or open to other ideas...
Replace eval with Cu.evalInSandbox Demo: https://github.com/alice0775/userChrome.js/blob/master/141/restore_warnOnClose66.uc.js
https://github.com/xiaoxiaoflood/firefox-scripts/issues/363#issuecomment-3110211567
That seems to work, thanks. I think a similar change will need to be made to rebuild_userChrome.uc.js too?
That seems to work, thanks. I think a similar change will need to be made to rebuild_userChrome.uc.js too?
If so mine was changed long ago.
I couldn't find your changed rebuild_userChrome.uc.js on any other issue, but I've made the change myself as rebuild_userChrome.uc.js if anyone else needs it.
I couldn't find your changed rebuild_userChrome.uc.js on any other issue, but I've made the change myself as rebuild_userChrome.uc.js if anyone else needs it.
I wasn't understand what you mean before now I see.
I didn't need change rebuild_userChrome.uc.js because none of the script I'm using use @shutdown.
And I just slapped
Cu.evalInSandbox(`(function(script, doc, win, loc){${script.shutdown}})`, _uc.getSandbox(win))(script, doc, win, loc);
there. I give it more argument in case I'd every encounter a wild script which in no case meaning you did anything wrong.