Commit ba3b7436 ba3b7436439e5abfeabe6e6c533fb299afb02c6a by Laurent Jouanneau

Fixes an infinite loop with checkStep

the navigationRequested boolean should be false when the new URL
has only a difference on the hash part with the previous URL, because
in this case we don't have a loadStarted/loadFinished event (at least
with Gecko) and then navigationRequested cannot be turn into false.
The consequence is that checkStep doesn't execute the next step because
of its test on navigationRequested.
1 parent a735ca6e
......@@ -2408,6 +2408,22 @@ function createPage(casper) {
url, type, willNavigate, isMainFrame), "debug");
casper.browserInitializing = false;
if (isMainFrame && casper.requestUrl !== url) {
var currentUrl = casper.requestUrl;
var newUrl = url;
var pos = currentUrl.indexOf('#')
if (pos !== -1) {
currentUrl = currentUrl.substring(0, pos);
}
pos = newUrl.indexOf('#')
if (pos !== -1) {
newUrl = newUrl.substring(0, pos);
}
// for URLs that are only different by their hash part
// don't turn navigationRequested to true, because
// there will not be loadStarted, loadFinished events
// so it could cause issues (for exemple, checkStep that
// do no execute the next step -> infinite loop on checkStep)
if (currentUrl !== newUrl)
casper.navigationRequested = true;
if (willNavigate) {
......