[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:22:42 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f98b7fa4d9a649aea27a3c0004ed08b5ceec1884
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 29 23:40:05 2003 +0000

            Reviewed by Darin.
    
    	Fix for this bug:
    
    	Radar 3142818 (Downloading many items quickly can cause future page loads to fail)
    
    	The issue was with a mismatch between different object's idea about
    	whether callbacks were being deferred. I have simplified the code in this
    	area somewhat, and I have added some asserts to make sure that callbacks
    	are not sent when deferalls are on.
    
    	More work will need to be done in callback deferral-land, however. This change
    	fixes the bug, but it may not be a good long-term fix.  I will file a bug on
    	the need for this additonal work.
    
            * WebView.subproj/WebBaseResourceHandleDelegate.h:
            * WebView.subproj/WebBaseResourceHandleDelegate.m:
            (-[WebBaseResourceHandleDelegate defersCallbacks]): Added method.
            * WebView.subproj/WebMainResourceClient.h: Removed unneeded defersBeforeCheckingPolicy flag.
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient continueAfterNavigationPolicy:request:]): Unconditionally set
    	callback deferrals to NO.
            (-[WebMainResourceClient handle:willSendRequest:]): Remove all callback deferral code here.
            (-[WebMainResourceClient continueAfterContentPolicy:response:]): Unconditionally set
            callback deferrals to NO.
            (-[WebMainResourceClient handle:didReceiveResponse:]): Assert that the handle argument
    	to this method, the client (self), and the data source's controller all are not
    	deferring callbacks.
    	Unconditionally set callback deferrals to YES.
            (-[WebMainResourceClient handle:didReceiveData:]): Ditto
            (-[WebMainResourceClient handleDidFinishLoading:]): Ditto
            (-[WebMainResourceClient handle:didFailLoadingWithError:]): Ditto
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3497 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 88eb545..7ac5980 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,38 @@
+2003-01-29  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Darin.
+
+	Fix for this bug:
+
+	Radar 3142818 (Downloading many items quickly can cause future page loads to fail)
+
+	The issue was with a mismatch between different object's idea about
+	whether callbacks were being deferred. I have simplified the code in this
+	area somewhat, and I have added some asserts to make sure that callbacks
+	are not sent when deferalls are on. 
+
+	More work will need to be done in callback deferral-land, however. This change
+	fixes the bug, but it may not be a good long-term fix.  I will file a bug on 
+	the need for this additonal work.
+
+        * WebView.subproj/WebBaseResourceHandleDelegate.h:
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate defersCallbacks]): Added method.
+        * WebView.subproj/WebMainResourceClient.h: Removed unneeded defersBeforeCheckingPolicy flag.
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient continueAfterNavigationPolicy:request:]): Unconditionally set 
+	callback deferrals to NO.
+        (-[WebMainResourceClient handle:willSendRequest:]): Remove all callback deferral code here.
+        (-[WebMainResourceClient continueAfterContentPolicy:response:]): Unconditionally set 
+        callback deferrals to NO.
+        (-[WebMainResourceClient handle:didReceiveResponse:]): Assert that the handle argument
+	to this method, the client (self), and the data source's controller all are not
+	deferring callbacks.
+	Unconditionally set callback deferrals to YES.
+        (-[WebMainResourceClient handle:didReceiveData:]): Ditto
+        (-[WebMainResourceClient handleDidFinishLoading:]): Ditto
+        (-[WebMainResourceClient handle:didFailLoadingWithError:]): Ditto
+
 2003-01-29  John Sullivan  <sullivan at apple.com>
 
 	- fixed 3160116 -- REGRESSION:leak in WebBookmarkLeaf at startup
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index 4353ab6..18d3bed 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -49,6 +49,7 @@
 - (void)cancelWithError:(WebError *)error;
 
 - (void)setDefersCallbacks:(BOOL)defers;
+- (BOOL)defersCallbacks;
 
 - (WebError *)cancelledError;
 
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 3ed1857..b716f15 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -89,6 +89,11 @@
     [handle _setDefersCallbacks:defers];
 }
 
+- (BOOL)defersCallbacks
+{
+    return defersCallbacks;
+}
+
 - (void)setDataSource:(WebDataSource *)d
 {
     ASSERT(d);
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index 4353ab6..18d3bed 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -49,6 +49,7 @@
 - (void)cancelWithError:(WebError *)error;
 
 - (void)setDefersCallbacks:(BOOL)defers;
+- (BOOL)defersCallbacks;
 
 - (WebError *)cancelledError;
 
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 3ed1857..b716f15 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -89,6 +89,11 @@
     [handle _setDefersCallbacks:defers];
 }
 
+- (BOOL)defersCallbacks
+{
+    return defersCallbacks;
+}
+
 - (void)setDataSource:(WebDataSource *)d
 {
     ASSERT(d);
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index eec7ef4..8e84eb8 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -26,7 +26,6 @@
     NSMutableData *resourceData;
     int _contentLength; // for logging only
     int _bytesReceived; // for logging only
-    BOOL defersBeforeCheckingPolicy;
 }
 
 - initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index d646a27..b8e81da 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -10,6 +10,7 @@
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebNSURLExtras.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebHTTPResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
@@ -132,10 +133,7 @@
 
 -(void)continueAfterNavigationPolicy:(BOOL)shouldContinue request:(WebResourceRequest *)request
 {
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:NO];
-    }
-
+    [[dataSource controller] _setDefersCallbacks:NO];
     if (!shouldContinue) {
 	[self stopLoadingForPolicyChange];
     }
@@ -143,6 +141,10 @@
 
 -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
 {
+    // Note that there are no asserts here as there are for the other callbacks. This is due to the
+    // fact that this "callback" is sent when starting every load, and the state of callback
+    // deferrals plays less of a part in this function in preventing the bad behavior deferring 
+    // callbacks is meant to prevent.
     ASSERT(newRequest != nil);
 
     NSURL *URL = [newRequest URL];
@@ -161,12 +163,6 @@
     // Don't set this on the first request.  It is set
     // when the main load was started.
     [dataSource _setRequest:newRequest];
-
-    defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:YES];
-    }
-
     [[dataSource webFrame] _checkNavigationPolicyForRequest:newRequest dataSource:dataSource andCall:self withSelector:@selector(continueAfterNavigationPolicy:request:)];
 
     return newRequest;
@@ -174,10 +170,7 @@
 
 -(void)continueAfterContentPolicy:(WebPolicyAction)contentPolicy response:(WebResourceResponse *)r
 {
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:NO];
-    }
-
+    [[dataSource controller] _setDefersCallbacks:NO];
     WebResourceRequest *req = [dataSource request];
 
     switch (contentPolicy) {
@@ -272,14 +265,14 @@
 
 -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
 {
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
     [dataSource _setResponse:r];
 
     LOG(Download, "main content type: %@", [r contentType]);
 
-    defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:YES];
-    }
+    [[dataSource controller] _setDefersCallbacks:YES];
 
     // Figure out the content policy.
     if (![dataSource isDownloading]) {
@@ -295,7 +288,10 @@
 {
     ASSERT(data);
     ASSERT([data length] != 0);
-
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
+ 
     LOG(Loading, "URL = %@, data = %p, length %d", [dataSource URL], data, [data length]);
 
     WebError *downloadError= nil;
@@ -323,6 +319,9 @@
 
 - (void)handleDidFinishLoading:(WebResourceHandle *)h
 {
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
     LOG(Loading, "URL = %@", [dataSource URL]);
         
     // Calls in this method will most likely result in a call to release, so we must retain.
@@ -355,6 +354,9 @@
 
 - (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)error
 {
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
     LOG(Loading, "URL = %@, error = %@", [error failingURL], [error errorDescription]);
 
     // Calling receivedError will likely result in a call to release, so we must retain.
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index eec7ef4..8e84eb8 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -26,7 +26,6 @@
     NSMutableData *resourceData;
     int _contentLength; // for logging only
     int _bytesReceived; // for logging only
-    BOOL defersBeforeCheckingPolicy;
 }
 
 - initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index d646a27..b8e81da 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -10,6 +10,7 @@
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebNSURLExtras.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebHTTPResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
@@ -132,10 +133,7 @@
 
 -(void)continueAfterNavigationPolicy:(BOOL)shouldContinue request:(WebResourceRequest *)request
 {
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:NO];
-    }
-
+    [[dataSource controller] _setDefersCallbacks:NO];
     if (!shouldContinue) {
 	[self stopLoadingForPolicyChange];
     }
@@ -143,6 +141,10 @@
 
 -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
 {
+    // Note that there are no asserts here as there are for the other callbacks. This is due to the
+    // fact that this "callback" is sent when starting every load, and the state of callback
+    // deferrals plays less of a part in this function in preventing the bad behavior deferring 
+    // callbacks is meant to prevent.
     ASSERT(newRequest != nil);
 
     NSURL *URL = [newRequest URL];
@@ -161,12 +163,6 @@
     // Don't set this on the first request.  It is set
     // when the main load was started.
     [dataSource _setRequest:newRequest];
-
-    defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:YES];
-    }
-
     [[dataSource webFrame] _checkNavigationPolicyForRequest:newRequest dataSource:dataSource andCall:self withSelector:@selector(continueAfterNavigationPolicy:request:)];
 
     return newRequest;
@@ -174,10 +170,7 @@
 
 -(void)continueAfterContentPolicy:(WebPolicyAction)contentPolicy response:(WebResourceResponse *)r
 {
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:NO];
-    }
-
+    [[dataSource controller] _setDefersCallbacks:NO];
     WebResourceRequest *req = [dataSource request];
 
     switch (contentPolicy) {
@@ -272,14 +265,14 @@
 
 -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
 {
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
     [dataSource _setResponse:r];
 
     LOG(Download, "main content type: %@", [r contentType]);
 
-    defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
-    if (!defersBeforeCheckingPolicy) {
-	[[dataSource controller] _setDefersCallbacks:YES];
-    }
+    [[dataSource controller] _setDefersCallbacks:YES];
 
     // Figure out the content policy.
     if (![dataSource isDownloading]) {
@@ -295,7 +288,10 @@
 {
     ASSERT(data);
     ASSERT([data length] != 0);
-
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
+ 
     LOG(Loading, "URL = %@, data = %p, length %d", [dataSource URL], data, [data length]);
 
     WebError *downloadError= nil;
@@ -323,6 +319,9 @@
 
 - (void)handleDidFinishLoading:(WebResourceHandle *)h
 {
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
     LOG(Loading, "URL = %@", [dataSource URL]);
         
     // Calls in this method will most likely result in a call to release, so we must retain.
@@ -355,6 +354,9 @@
 
 - (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)error
 {
+    ASSERT(![h _defersCallbacks]);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource controller] _defersCallbacks]);
     LOG(Loading, "URL = %@, error = %@", [error failingURL], [error errorDescription]);
 
     // Calling receivedError will likely result in a call to release, so we must retain.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list