You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently @backgroundmodule scripts are loaded using ChromeUtils.import() which is old mechanism meant for loading .jsm modules. All jsm use has been removed for mozilla-central already, and while the mechanism does work still, it will be removed shortly after 128 cycle. I intend to remove support during 128 cycle.
It should be pretty simple to change your scripts to ES6 modules instead - just rename the file with .sys.mjs extension and the loader will treat it correctly, most of the time at least.
Afterwards, the @backgroundmodule header will be useless, since the loader will use file extension to determine if the script is background module or not. However, I might instead make the loader check if @backgroundmodule tag exists in the header, and then ignore such scripts with a warning.
The text was updated successfully, but these errors were encountered:
MrOtherGuy
changed the title
Remove support from jsm-style backgroundmodule scripts
Loader changes in version 0.10.0
Jun 9, 2024
I'll hijack this issue for discussion about all the changes in version 0.10.0.
tl;dr _ucUtils is no more, @backgroundmodule and @startup are ignored
_ucUtils was getting pretty annoying since it was mostly uncategorized and could not be imported very well. It is now replaced with UC_API symbol that's defined by the loader with more sane API.
@backgroundmodule is removed in favor of ES6 modules using .sys.mjs file extension
@startup was very confusing to use - but now that Windows.onCreated() exists it isn't needed any more
UC_API
This is provided as a module by and "interface script" - utils/uc_api.sys.mjs. This module can be imported into your ES6 module scripts whether they are window- or background-scripts and the properties it has should be "valid" at all times. In contrast, you could not just static-import utils.sys.mjs in all scripts because depending on situation it would not give you the actual instances that boot.sys.mjs uses which lead to problems in various cases. This new version at least to me feels much more ergonomic and simple to use.
Currently
@backgroundmodule
scripts are loaded usingChromeUtils.import()
which is old mechanism meant for loading.jsm
modules. All jsm use has been removed for mozilla-central already, and while the mechanism does work still, it will be removed shortly after 128 cycle. I intend to remove support during 128 cycle.It should be pretty simple to change your scripts to ES6 modules instead - just rename the file with
.sys.mjs
extension and the loader will treat it correctly, most of the time at least.Afterwards, the
@backgroundmodule
header will be useless, since the loader will use file extension to determine if the script is background module or not. However, I might instead make the loader check if@backgroundmodule
tag exists in the header, and then ignore such scripts with a warning.The text was updated successfully, but these errors were encountered: