Adds tests for stale-if-error behaviour.

This also fixes:
 * Adding duplicate headers on stale responses that are handled in
   onComplete.
 * Overwriting an event variable with an exception.
 * can_cache test assuming can_cache works in error conditions.
Technically, we should only be deleting our cache if we have a 410 response rather than a 404.

I think it would be a good idea to purge for both 404 and 410 since we're already purging for 404.