Make the window.onerror test more resilient to old browsers

Check the number of arguments passed to window.onerror before
asserting the value of the argument.
Merge pull request #416 from arv/fix-window-onerror-test

Make the window.onerror test more resilient to old browsers