Port the test for resource request error handling.

https://github.com/ariya/phantomjs/issues/12439