New XHR test fixes, solving issues found in Firefox test run

(Don't merge this quite yet, not done with the test run and probably other issues will show up)