fix($parse): correctly detect CSP mode via $sniffer

Also fixes the test suite, which was not actually taking CSP-mode paths when
we were expecting it to.

Numerous CSP-mode tests are failing, working on fixing these.
factored out of this part of the code due to being shared