#56357Do not save failed token messages in session
Description
In #30272 the backend formprotection has been changed
to not save flash messages in the user session if
the current request is an Ajax request.
Unfortunately the check for that is broken
since the TYPO3_AJAX global is reset in the
bootstrap now.
Introduce a method which uses the request type
constants and adapt the tests accordingly.