Changes of location should be visible immediately after history.pushState. Calling such JS command:
window.history.pushState(stateObj, 'page 2', 'bar.html');
var newLocationVisible = (location.href.indexOf('bar.html') > -1);
should set newLocationVisible to true, but in HU this change is not visible if such script is one block (function), see attached test.
It seems that changes in Page object are not visible during execution of one JS block.
Testcase added com.gargoylesoftware.htmlunit.javascript.host.History2Test.pushStateLocationHref()
It seems that calling loadDownloadedResponses did the trick, please see attachment.
Last edit: Adam Afeltowicz 2016-02-26