SecurePoll ActionPages often need to access services; however there is currently no way to inject them.
ActionPages are instantiated via SpecialSecurePoll::getSubPage:
public function getSubpage( $name ) { if ( !isset( self::$pages[$name] ) ) { return false; } $className = self::$pages[$name]; return new $className( $this ); }
We could create an ActionPageFactory service, which could be injected into SpecialSecurePoll. This could use the ObjectFactory service to create a given ActionPage, according to spec.
Note that there are some other places where ActionPages are instantiated, e.g. ApiStrikeVote instantiates a ListPage. These should also use the new factory service.
Actually injecting the services could happen in separate follow-up tasks.
Further reading