Repository: cordova-ios Updated Branches: refs/heads/master 3058347d4 -> d72a48acd
CB-7813 - CDVWebViewDelegate fails to update the webview state properly in iOS CDVWebViewDelegate fails to update the webview state properly in iOS when a page loads an iframe using javascript and does a redirect to another page using javascript. Method didFailLoadWithError gets called while in STATE_WAITING_FOR_LOAD_START with a NSURLErrorCancelled (-999) error. Instead of entering STATE_CANCELLED in this situation it always enters STATE_IDLE, which causes didFailLoadWithError event to never fire (which depending on the app, and definitely in our case, can cause a hang condition). For a simplified Cordova project that reproduces the problem in the most straigtforward way possible, please refer to: https://github.com/greatvines/cordova-webview-state-bug-www Signed-off-by: Shazron Abdullah <shaz...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/5de0f3f7 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/5de0f3f7 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/5de0f3f7 Branch: refs/heads/master Commit: 5de0f3f7f1d39e5b45909d00862869b4fc245bb3 Parents: 3058347 Author: pbenschop <pbensc...@cox.net> Authored: Mon Sep 29 17:31:30 2014 -0700 Committer: Shazron Abdullah <shaz...@apache.org> Committed: Fri Oct 17 15:13:30 2014 -0700 ---------------------------------------------------------------------- CordovaLib/Classes/CDVWebViewDelegate.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/5de0f3f7/CordovaLib/Classes/CDVWebViewDelegate.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVWebViewDelegate.m b/CordovaLib/Classes/CDVWebViewDelegate.m index cdc3980..5a187f4 100644 --- a/CordovaLib/Classes/CDVWebViewDelegate.m +++ b/CordovaLib/Classes/CDVWebViewDelegate.m @@ -378,7 +378,11 @@ static NSString *stripFragment(NSString* url) break; case STATE_WAITING_FOR_LOAD_START: - _state = STATE_IDLE; + if ([error code] == NSURLErrorCancelled) { + _state = STATE_CANCELLED; + } else { + _state = STATE_IDLE; + } fireCallback = YES; break; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org