Assign the correct XHR method to NewXHR rather than re-testing each time it's invoked

NewXHR's initial assignment is now to a self executing function which invokes the same tests, but assigns the result to a variable instead of immediately returning it. Instead it, returns a function which calls that variable. This way the test runs immediately and doesn't need to be executed multiple times.