Replace history and location when xhr response status is 40x.

webkit has a bug in history state api. It occurs when 404 page is pushed to
history state and then reload the page.
This commit escape the bug with code retrieved from jquery.pjax.
Merge branch 'replace_location' of https://github.com/YasuOza/turbolinks into YasuOza-replace_location
Extracted fetchReplacement onload logic into new validateResponse method