In includes/resourceloader/ResourceLoaderUserOptionsModule.php we have:
$userOptionsLookup = MediaWikiServices::getInstance()->getUserOptionsLookup(); $options = $userOptionsLookup->getOptions( $user, UserOptionsLookup::EXCLUDE_DEFAULTS ); // Optimisation: Only output this function call if the user has non-default settings. if ( $options ) { $script .= 'mw.user.options.set(' . $context->encodeJson( $options ) . ');'; }
It could be nice if we had a flag like GETOPTIONS_EXCLUDE_SERVERSIDE_PREFS, then in UserOptionsManager we could run a hook that asks extensions if any of their defined options should not be exported to the client-side, and maybe a Context object could be passed so that extensions could decide if the option should be exported client-side in some circumstances but not others. This could help with performance issues that arise when extensions use preferences for managing data that doesn't need to be present on each page.