You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/11/01 00:43:35 UTC

[15/50] ios commit: CB-7813 - CDVWebViewDelegate fails to update the webview state properly in iOS

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 <sh...@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/wkwebview
Commit: 5de0f3f7f1d39e5b45909d00862869b4fc245bb3
Parents: 3058347
Author: pbenschop <pb...@cox.net>
Authored: Mon Sep 29 17:31:30 2014 -0700
Committer: Shazron Abdullah <sh...@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-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org