Context
Currently, anonymous users cannot use MediaWiki-extensions-Gadgets, as these are available to logged-in users only. Temporary account users are logged-in, but will not be able to access their preferences to enable/disable Gadgets, including ones that are enabled by default on a given wiki (marked with default on e.g. https://www.mediawiki.org/w/index.php?title=MediaWiki:Gadgets-definition)
In BeforePageDisplay in GadgetHooks, we should check if the user is a temporary account, and if so, prevent loading the gadget code.