Fix duplicate onload function calls

Sinon was previously calling the `onload` callback twice which resulted in some issues running tests in my own test suite. This PR removes the additional `onload` function call and adds a more comprehensive coverage (by checking how many times it was actually called). In development of the solution, I had to also fix another failing test case for the `onerror` callback.