As I investigated in the comment, this is a feature supported by Greasy Fork and TamperMonkey.
It's worth noting that this is not a W3C standard implementation. Refer to the implementation in the browser.
However, implementing this feature will help improve the security of users using such user scripts.