You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/01 17:53:34 UTC

ios commit: [CB-2389] Fix page load detection for late-loaded iframes

Updated Branches:
  refs/heads/master 227452b1c -> 822d3a2df


[CB-2389] Fix page load detection for late-loaded iframes


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

Branch: refs/heads/master
Commit: 822d3a2df0652500f16951592d402ea0c59e1342
Parents: 227452b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Mar 1 11:52:56 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Mar 1 11:52:56 2013 -0500

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewDelegate.m |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/822d3a2d/CordovaLib/Classes/CDVWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewDelegate.m b/CordovaLib/Classes/CDVWebViewDelegate.m
index ea7f752..32c5e45 100644
--- a/CordovaLib/Classes/CDVWebViewDelegate.m
+++ b/CordovaLib/Classes/CDVWebViewDelegate.m
@@ -100,6 +100,7 @@ typedef enum {
 
     if (shouldLoad) {
         BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
+        NSLog(@"should (tl=%d): %@", isTopLevelNavigation, request.URL);
         if (isTopLevelNavigation) {
             _loadCount = 0;
             _state = STATE_NORMAL;
@@ -110,6 +111,7 @@ typedef enum {
 
 - (void)webViewDidStartLoad:(UIWebView*)webView
 {
+    NSLog(@"start %d", _loadCount);
     if (_state == STATE_NORMAL) {
         if (_loadCount == 0) {
             if ([_delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
@@ -136,12 +138,13 @@ typedef enum {
 
 - (void)webViewDidFinishLoad:(UIWebView*)webView
 {
+    NSLog(@"finish %d", _loadCount);
     if (_state == STATE_NORMAL) {
         if (_loadCount == 1) {
             if ([_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
                 [_delegate webViewDidFinishLoad:webView];
             }
-            _loadCount -= 1;
+            _loadCount = -1;
         } else if (_loadCount > 1) {
             _loadCount -= 1;
         }
@@ -158,7 +161,7 @@ typedef enum {
             if ([_delegate respondsToSelector:@selector(didFailLoadWithError:)]) {
                 [_delegate webView:webView didFailLoadWithError:error];
             }
-            _loadCount -= 1;
+            _loadCount = -1;
         } else if (_loadCount > 1) {
             _loadCount -= 1;
         }