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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:11:46 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 67c8e863e77ab48571b5ac97b08ecfe8e8943bc6
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 14 17:47:13 2003 +0000

            Reviewed by John.
    
            - fixes 3457162 -- selecting text during a page load that blows the text field away causes a crash
            - fixes 3160035 -- crash or hang if you hold down a button while "go to about:blank soon" test runs
    
            The WebKit part of this fix is making setDefersCallbacks: work. It had succumbed to bit rot.
    
            * WebView.subproj/WebBaseResourceHandleDelegate.m: (-[WebBaseResourceHandleDelegate setDataSource:]):
            Set the defersCallbacks state from the WebView here so that clients don't have to do it.
            * WebView.subproj/WebDataSource.m: (-[WebDataSource _addSubresourceClient:]): Remove call to
            set the defersCallbacks state on the subresource client, because the above change obviates it.
            (the client/delegate terminology makes it confusing, but it's a subclass).
    
            * WebView.subproj/WebMainResourceClient.h: Added an _initialRequest field so we can defer the very
            first callback, which does not rely on NSURLConnection.
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient dealloc]): Release the initial request.
            (-[WebMainResourceClient loadWithRequestNow:]): Moved the guts of loadWithRequest in here; to be
            used when the request is no longer deferred. Also removed the code to call setDefersCallbacks:
            on the connection, and assert that we are only called when callbacks are not deferred. Because
            the very first callback was not deferred, we would end up calling setDefersCallbacks:NO on the
            WebView, so nothing would be deferred.
            (-[WebMainResourceClient loadWithRequest:]): If callbacks are not deferred, then call the
            loadWithRequestNow: method, otherwise simply store the request in _initialRequest.
            (-[WebMainResourceClient setDefersCallbacks:]): If there is an _initialRequest and we are
            ceasing deferral of callbacks, then call the loadWithRequestNow: method.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5495 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b1cb265..f1c6a8b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,32 @@
+2003-11-14  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+        - fixes 3457162 -- selecting text during a page load that blows the text field away causes a crash
+        - fixes 3160035 -- crash or hang if you hold down a button while "go to about:blank soon" test runs
+
+        The WebKit part of this fix is making setDefersCallbacks: work. It had succumbed to bit rot.
+
+        * WebView.subproj/WebBaseResourceHandleDelegate.m: (-[WebBaseResourceHandleDelegate setDataSource:]):
+        Set the defersCallbacks state from the WebView here so that clients don't have to do it.
+        * WebView.subproj/WebDataSource.m: (-[WebDataSource _addSubresourceClient:]): Remove call to
+        set the defersCallbacks state on the subresource client, because the above change obviates it.
+        (the client/delegate terminology makes it confusing, but it's a subclass).
+
+        * WebView.subproj/WebMainResourceClient.h: Added an _initialRequest field so we can defer the very
+        first callback, which does not rely on NSURLConnection.
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient dealloc]): Release the initial request.
+        (-[WebMainResourceClient loadWithRequestNow:]): Moved the guts of loadWithRequest in here; to be
+        used when the request is no longer deferred. Also removed the code to call setDefersCallbacks:
+        on the connection, and assert that we are only called when callbacks are not deferred. Because
+        the very first callback was not deferred, we would end up calling setDefersCallbacks:NO on the
+        WebView, so nothing would be deferred.
+        (-[WebMainResourceClient loadWithRequest:]): If callbacks are not deferred, then call the
+        loadWithRequestNow: method, otherwise simply store the request in _initialRequest.
+        (-[WebMainResourceClient setDefersCallbacks:]): If there is an _initialRequest and we are
+        ceasing deferral of callbacks, then call the loadWithRequestNow: method.
+
 2003-11-13  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by John
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 04ebe3a..b70005d 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -155,6 +155,8 @@
 
     [downloadDelegate release];
     downloadDelegate = [[webView downloadDelegate] retain];
+
+    [self setDefersCallbacks:[webView defersCallbacks]];
 }
 
 - (WebDataSource *)dataSource
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index e1abab3..05b60fe 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -211,9 +211,6 @@
     if (_private->subresourceClients == nil) {
         _private->subresourceClients = [[NSMutableArray alloc] init];
     }
-    if ([_private->webView defersCallbacks]) {
-        [client setDefersCallbacks:YES];
-    }
     [_private->subresourceClients addObject:client];
     [self _setLoading:YES];
 }
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 04ebe3a..b70005d 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -155,6 +155,8 @@
 
     [downloadDelegate release];
     downloadDelegate = [[webView downloadDelegate] retain];
+
+    [self setDefersCallbacks:[webView defersCallbacks]];
 }
 
 - (WebDataSource *)dataSource
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index bee0ecf..a62ae53 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -21,6 +21,7 @@
     WebPolicyDecisionListener *listener;
     NSURLResponse *policyResponse;
     NSURLConnectionDelegateProxy *proxy;
+    NSURLRequest *_initialRequest;
 }
 
 - (id)initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 69ae773..ccd3ec1 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -50,6 +50,8 @@
 
 - (void)dealloc
 {
+    [_initialRequest release];
+
     [proxy setDelegate:nil];
     [proxy release];
     
@@ -311,14 +313,16 @@
     [self receivedError:error];
 }
 
-- (BOOL)loadWithRequest:(NSURLRequest *)r
+- (void)loadWithRequestNow:(NSURLRequest *)r
 {
     ASSERT(connection == nil);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource _webView] defersCallbacks]);
     
     // Send this synthetic delegate callback since clients expect it, and
     // we no longer send the callback from within NSURLConnection for
     // initial requests.
-    r = [proxy connection:nil willSendRequest:r redirectResponse:nil];
+    r = [self connection:nil willSendRequest:r redirectResponse:nil];
 
     NSURL *URL = [r URL];
     BOOL shouldLoadEmpty = [URL _webkit_shouldLoadAsEmptyDocument];
@@ -330,15 +334,25 @@
             MIMEType = [WebView _generatedMIMETypeForURLScheme:[URL scheme]];
         }
 
-	NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
+        NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
             expectedContentLength:0 textEncodingName:nil];
 	[self connection:nil didReceiveResponse:resp];
 	[resp release];
     } else {
         connection = [[NSURLConnection alloc] initWithRequest:r delegate:proxy];
-        if ([self defersCallbacks]) {
-            [connection setDefersCallbacks:YES];
-        }
+    }
+}
+
+- (BOOL)loadWithRequest:(NSURLRequest *)r
+{
+    ASSERT(connection == nil);
+    
+    if (![self defersCallbacks]) {
+        [self loadWithRequestNow:r];
+    } else {
+        NSURLRequest *copy = [r copy];
+        [_initialRequest release];
+        _initialRequest = copy;
     }
 
     return YES;
@@ -346,13 +360,15 @@
 
 - (void)setDefersCallbacks:(BOOL)defers
 {
-    if (request
-            && ![[request URL] _webkit_shouldLoadAsEmptyDocument]
-            && ![WebView _representationExistsForURLScheme:[[request URL] scheme]]) {
-	[super setDefersCallbacks:defers];
+    [super setDefersCallbacks:defers];
+    if (!defers) {
+        NSURLRequest *r = _initialRequest;
+        if (r != nil) {
+            _initialRequest = nil;
+            [self loadWithRequestNow:r];
+            [r release];
+        }
     }
 }
 
-
 @end
-
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index bee0ecf..a62ae53 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -21,6 +21,7 @@
     WebPolicyDecisionListener *listener;
     NSURLResponse *policyResponse;
     NSURLConnectionDelegateProxy *proxy;
+    NSURLRequest *_initialRequest;
 }
 
 - (id)initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 69ae773..ccd3ec1 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -50,6 +50,8 @@
 
 - (void)dealloc
 {
+    [_initialRequest release];
+
     [proxy setDelegate:nil];
     [proxy release];
     
@@ -311,14 +313,16 @@
     [self receivedError:error];
 }
 
-- (BOOL)loadWithRequest:(NSURLRequest *)r
+- (void)loadWithRequestNow:(NSURLRequest *)r
 {
     ASSERT(connection == nil);
+    ASSERT(![self defersCallbacks]);
+    ASSERT(![[dataSource _webView] defersCallbacks]);
     
     // Send this synthetic delegate callback since clients expect it, and
     // we no longer send the callback from within NSURLConnection for
     // initial requests.
-    r = [proxy connection:nil willSendRequest:r redirectResponse:nil];
+    r = [self connection:nil willSendRequest:r redirectResponse:nil];
 
     NSURL *URL = [r URL];
     BOOL shouldLoadEmpty = [URL _webkit_shouldLoadAsEmptyDocument];
@@ -330,15 +334,25 @@
             MIMEType = [WebView _generatedMIMETypeForURLScheme:[URL scheme]];
         }
 
-	NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
+        NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
             expectedContentLength:0 textEncodingName:nil];
 	[self connection:nil didReceiveResponse:resp];
 	[resp release];
     } else {
         connection = [[NSURLConnection alloc] initWithRequest:r delegate:proxy];
-        if ([self defersCallbacks]) {
-            [connection setDefersCallbacks:YES];
-        }
+    }
+}
+
+- (BOOL)loadWithRequest:(NSURLRequest *)r
+{
+    ASSERT(connection == nil);
+    
+    if (![self defersCallbacks]) {
+        [self loadWithRequestNow:r];
+    } else {
+        NSURLRequest *copy = [r copy];
+        [_initialRequest release];
+        _initialRequest = copy;
     }
 
     return YES;
@@ -346,13 +360,15 @@
 
 - (void)setDefersCallbacks:(BOOL)defers
 {
-    if (request
-            && ![[request URL] _webkit_shouldLoadAsEmptyDocument]
-            && ![WebView _representationExistsForURLScheme:[[request URL] scheme]]) {
-	[super setDefersCallbacks:defers];
+    [super setDefersCallbacks:defers];
+    if (!defers) {
+        NSURLRequest *r = _initialRequest;
+        if (r != nil) {
+            _initialRequest = nil;
+            [self loadWithRequestNow:r];
+            [r release];
+        }
     }
 }
 
-
 @end
-

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list