Fix timeouts

This is a fix for issue #142 

Basically using the polyfill function ensures that request.timedout is set to true before onreadystatechange is called (this is not guaranteed with ontimeout).
Is there another file where this would make more sense? If not, should I create a new one? And lastly, should I move the test above it along with it?