You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/06/11 02:51:31 UTC

[17/36] ios commit: [CB-3530] PhoneGap app crashes on iOS with error "CDVWebViewDelegate: Navigation started when state=1"

[CB-3530] PhoneGap app crashes on iOS with error "CDVWebViewDelegate: Navigation started when state=1"


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/e7fbca99
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/e7fbca99
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/e7fbca99

Branch: refs/heads/3.0.0
Commit: e7fbca99e3e38586f68771bfc2a09f5ee420dd67
Parents: dad3425
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri May 31 15:45:44 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri May 31 15:45:44 2013 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewDelegate.m | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e7fbca99/CordovaLib/Classes/CDVWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewDelegate.m b/CordovaLib/Classes/CDVWebViewDelegate.m
index fd9c032..1ee7aea 100644
--- a/CordovaLib/Classes/CDVWebViewDelegate.m
+++ b/CordovaLib/Classes/CDVWebViewDelegate.m
@@ -193,11 +193,16 @@ typedef enum {
                     break;
 
                 default:
-                    NSLog(@"CDVWebViewDelegate: Navigation started when state=%d", _state);
-                    _loadCount = 0;
-                    _state = STATE_WAITING_FOR_LOAD_START;
-                    if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
-                        [_delegate webView:webView didFailLoadWithError:nil];
+                    {
+                        NSString* description = [NSString stringWithFormat:@"CDVWebViewDelegate: Navigation started when state=%d", _state];
+                        NSLog(@"%@", description);
+                        _loadCount = 0;
+                        _state = STATE_WAITING_FOR_LOAD_START;
+                        if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
+                            NSDictionary* errorDictionary = @{NSLocalizedDescriptionKey : description};
+                            NSError* error = [[NSError alloc] initWithDomain:@"CDVWebViewDelegate" code:1 userInfo:errorDictionary];
+                            [_delegate webView:webView didFailLoadWithError:error];
+                        }
                     }
             }
         } else {