repaired implementation for XHR contructor to work independently of a possibly present mocking framework, resolved infinite loop error