Reviewed by John Sullivan.
authortomernic <tomernic@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Mar 2006 22:07:37 +0000 (22:07 +0000)
committertomernic <tomernic@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Mar 2006 22:07:37 +0000 (22:07 +0000)
        At John's suggestion, renamed a private WebFrame method and tightened up some of the redirect logic I recently touched.

        * WebView/WebFramePrivate.h:
        Renamed -_clientRedirectCancelled: to -_clientRedirectCancelledOrFinished:, since we call this both when a redirect is
        cancelled and when a redirect is successfully committed.
        * WebCoreSupport/WebFrameBridge.m:
        (-[WebFrameBridge reportClientRedirectCancelled:]):
        Call renamed WebFrame method.
        * WebView/WebFrame.m:
        Added sentRedirectNotification flag to WebFramePrivate.  This flag is set when we notify the frame load delegate that a
        redirect will occur.  We check this flag when committing a provisional load to ensure that the frame load delegate is
        notified that the redirect finished.
        (-[WebFrame _commitProvisionalLoad:]):
        After committing a provisional load, make sure that the frame load delegate is notified that there is no longer a pending
        redirect.
        (-[WebFrame _clientRedirectedTo:delay:fireDate:lockHistory:isJavaScriptFormAction:]):
        Set the new sentRedirectNotification flag.
        (-[WebFrame _clientRedirectCancelledOrFinished:]):
        Renamed method.
        Clear the sentRedirectNotification flag.
        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
        Call renamed method.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13459 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebCoreSupport/WebFrameBridge.m
WebKit/WebView/WebFrame.m
WebKit/WebView/WebFramePrivate.h

index 89645fb0a3e17e904059e5ed3a5e02418955a036..55266067c89050d7afd5fa3abc9b37eade4e82b1 100644 (file)
@@ -1,3 +1,30 @@
+2006-03-23  Tim Omernick  <timo@apple.com>
+
+        Reviewed by John Sullivan.
+
+        At John's suggestion, renamed a private WebFrame method and tightened up some of the redirect logic I recently touched.
+
+        * WebView/WebFramePrivate.h:
+        Renamed -_clientRedirectCancelled: to -_clientRedirectCancelledOrFinished:, since we call this both when a redirect is
+        cancelled and when a redirect is successfully committed.
+        * WebCoreSupport/WebFrameBridge.m:
+        (-[WebFrameBridge reportClientRedirectCancelled:]):
+        Call renamed WebFrame method.
+        * WebView/WebFrame.m:
+        Added sentRedirectNotification flag to WebFramePrivate.  This flag is set when we notify the frame load delegate that a
+        redirect will occur.  We check this flag when committing a provisional load to ensure that the frame load delegate is
+        notified that the redirect finished.
+        (-[WebFrame _commitProvisionalLoad:]):
+        After committing a provisional load, make sure that the frame load delegate is notified that there is no longer a pending
+        redirect.
+        (-[WebFrame _clientRedirectedTo:delay:fireDate:lockHistory:isJavaScriptFormAction:]):
+        Set the new sentRedirectNotification flag.
+        (-[WebFrame _clientRedirectCancelledOrFinished:]):
+        Renamed method.
+        Clear the sentRedirectNotification flag.
+        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
+        Call renamed method.
+
 2006-03-23  Tim Omernick  <timo@apple.com>
 
         Reviewed by John Sullivan.
index 774b9048b9eee732418beda4acb8f57b715aad69..e3751a55289249b6012bfe5e820233d17e4a036e 100644 (file)
@@ -609,7 +609,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
 
 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress
 {
-    [_frame _clientRedirectCancelled:cancelWithLoadInProgress];
+    [_frame _clientRedirectCancelledOrFinished:cancelWithLoadInProgress];
 }
 
 - (void)close
index c9550ca6e9e17c9e153f3136366e9927e912a38b..e443a4c76ad121c244f1726d0955fc983b72daaf 100644 (file)
@@ -191,6 +191,7 @@ NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
     WebFrameLoadType policyLoadType;
 
     BOOL quickRedirectComing;
+    BOOL sentRedirectNotification;
     BOOL isStoppingLoad;
     BOOL delegateIsHandlingProvisionalLoadError;
     BOOL delegateIsDecidingNavigationPolicy;
@@ -851,11 +852,12 @@ static inline WebFrame *Frame(WebCoreFrameBridge *bridge)
     
     [self _transitionToCommitted:pageCache];
 
-    // Call -_clientRedirectCancelled: here so that the frame load delegate is notified that the redirect's
+    // Call -_clientRedirectCancelledOrFinished: here so that the frame load delegate is notified that the redirect's
     // status has changed, if there was a redirect.  The frame load delegate may have saved some state about
     // the redirect in its -webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:.  Since we are
     // just about to commit a new page, there cannot possibly be a pending redirect at this point.
-    [self _clientRedirectCancelled:NO];
+    if (_private->sentRedirectNotification)
+        [self _clientRedirectCancelledOrFinished:NO];
     
     NSURL *baseURL = [[provisionalDataSource request] _webDataRequestBaseURL];        
     NSURL *URL = baseURL ? baseURL : [response URL];
@@ -2023,6 +2025,11 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
                                                          delay:seconds
                                                       fireDate:date
                                                       forFrame:self];
+                                                      
+    // Remember that we sent a redirect notification to the frame load delegate so that when we commit
+    // the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
+    _private->sentRedirectNotification = YES;
+    
     // If a "quick" redirect comes in an, we set a special mode so we treat the next
     // load as part of the same navigation.
 
@@ -2037,12 +2044,18 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     }
 }
 
-- (void)_clientRedirectCancelled:(BOOL)cancelWithLoadInProgress
+- (void)_clientRedirectCancelledOrFinished:(BOOL)cancelWithLoadInProgress
 {
+    // Note that -webView:didCancelClientRedirectForFrame: is called on the frame load delegate even if
+    // the redirect succeeded.  We should either rename this API, or add a new method, like
+    // -webView:didFinishClientRedirectForFrame:
     [[[self webView] _frameLoadDelegateForwarder] webView:[self webView]
                                didCancelClientRedirectForFrame:self];
     if (!cancelWithLoadInProgress)
         _private->quickRedirectComing = NO;
+        
+    _private->sentRedirectNotification = NO;
+    
     LOG(Redirect, "%@(%p) _private->quickRedirectComing = %d", [self name], self, (int)_private->quickRedirectComing);
 }
 
@@ -2257,7 +2270,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         // If we were waiting for a quick redirect, but the policy delegate decided to ignore it, then we 
         // need to report that the client redirect was cancelled.
         if (_private->quickRedirectComing)
-            [self _clientRedirectCancelled:NO];
+            [self _clientRedirectCancelledOrFinished:NO];
 
         [self _setPolicyDataSource:nil];
         // If the navigation request came from the back/forward menu, and we punt on it, we have the 
index 5a40c5bb0ab9602f5b9d87f8657fc3feeb9d6517..1eea71c9a47b3e647869142c56d3ea3de46dde44 100644 (file)
@@ -112,7 +112,7 @@ extern NSString *WebPageCacheDocumentViewKey;
 - (void)_loadRequest:(NSURLRequest *)request inFrameNamed:(NSString *)frameName;
 
 - (void)_clientRedirectedTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
-- (void)_clientRedirectCancelled:(BOOL)cancelWithLoadInProgress;
+- (void)_clientRedirectCancelledOrFinished:(BOOL)cancelWithLoadInProgress;
 
 - (void)_defersCallbacksChanged;