Fix xhr event handling.

Onload is called whenever we successfully completed the communication
with the server (including error cases like 404). Onerror is for lower
level errors (and thus status and statusText aren't available there).
Merge pull request #458 from google/rsturgell

Fix xhr event handling.