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) { ...@@ -2408,6 +2408,22 @@ function createPage(casper) {
2408 url, type, willNavigate, isMainFrame), "debug"); 2408 url, type, willNavigate, isMainFrame), "debug");
2409 casper.browserInitializing = false; 2409 casper.browserInitializing = false;
2410 if (isMainFrame && casper.requestUrl !== url) { 2410 if (isMainFrame && casper.requestUrl !== url) {
2411 var currentUrl = casper.requestUrl;
2412 var newUrl = url;
2413 var pos = currentUrl.indexOf('#')
2414 if (pos !== -1) {
2415 currentUrl = currentUrl.substring(0, pos);
2416 }
2417 pos = newUrl.indexOf('#')
2418 if (pos !== -1) {
2419 newUrl = newUrl.substring(0, pos);
2420 }
2421 // for URLs that are only different by their hash part
2422 // don't turn navigationRequested to true, because
2423 // there will not be loadStarted, loadFinished events
2424 // so it could cause issues (for exemple, checkStep that
2425 // do no execute the next step -> infinite loop on checkStep)
2426 if (currentUrl !== newUrl)
2411 casper.navigationRequested = true; 2427 casper.navigationRequested = true;
2412 2428
2413 if (willNavigate) { 2429 if (willNavigate) {
......