[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:12:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2137ddbbedd8b48020e4e885724c8c2349b06772
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 17 01:36:46 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
            - without causing 3484608 -- REGRESSION: Flash broken at http://www.macromedia.com/
    
            The WebKit part of this fix is making setDefersCallbacks: work. It had succumbed to bit rot.
            This has a side effect of not considering a page load done until all the plug-in streams are loaded.
            If that's not a good idea, we'll have to keep two separate lists in WebDataSource.
    
            * 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). Also loosen the type
            so we can call this on clients for plug-in streams too.
            (-[WebDataSource _removeSubresourceClient:]): Loosen type here too.
            (-[WebDataSource _defersCallbacksChanged]): And here.
            * WebView.subproj/WebDataSourcePrivate.h: Loosen type of subresource client so we can pass in the
            delegates for plug-in streams too.
    
            * 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.
    
            * Plugins.subproj/WebNetscapePluginStream.m:
            (-[WebNetscapePluginStream start]): Call _addSubresourceClient, and then _removeSubresourceClient
            if the load fails to even start.
            (-[WebNetscapePluginConnectionDelegate connectionDidFinishLoading:]): Call _removeSubresourceClient.
            (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]): Call _removeSubresourceClient.
    
            * Plugins.subproj/WebBaseNetscapePluginStream.h: Removed unneeded import.
            * Plugins.subproj/WebPluginDatabase.m: Add import needed now that WebBaseNetscapePluginStream.h
            imports less than before.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5531 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d2734bd..5a87570 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,51 @@
+2003-11-15  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
+        - without causing 3484608 -- REGRESSION: Flash broken at http://www.macromedia.com/
+
+        The WebKit part of this fix is making setDefersCallbacks: work. It had succumbed to bit rot.
+        This has a side effect of not considering a page load done until all the plug-in streams are loaded.
+        If that's not a good idea, we'll have to keep two separate lists in WebDataSource.
+
+        * 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). Also loosen the type
+        so we can call this on clients for plug-in streams too.
+        (-[WebDataSource _removeSubresourceClient:]): Loosen type here too.
+        (-[WebDataSource _defersCallbacksChanged]): And here.
+        * WebView.subproj/WebDataSourcePrivate.h: Loosen type of subresource client so we can pass in the
+        delegates for plug-in streams too.
+
+        * 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.
+
+        * Plugins.subproj/WebNetscapePluginStream.m:
+        (-[WebNetscapePluginStream start]): Call _addSubresourceClient, and then _removeSubresourceClient
+        if the load fails to even start.
+        (-[WebNetscapePluginConnectionDelegate connectionDidFinishLoading:]): Call _removeSubresourceClient.
+        (-[WebNetscapePluginConnectionDelegate connection:didFailWithError:]): Call _removeSubresourceClient.
+
+        * Plugins.subproj/WebBaseNetscapePluginStream.h: Removed unneeded import.
+        * Plugins.subproj/WebPluginDatabase.m: Add import needed now that WebBaseNetscapePluginStream.h
+        imports less than before.
+
 2003-11-16  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by John.
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
index 853fbca..abc800f 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginStream.h
@@ -5,7 +5,6 @@
 
 #import <Foundation/Foundation.h>
 
-#import <WebKit/WebBaseResourceHandleDelegate.h>
 #import <WebKit/npapi.h>
 
 @class WebNetscapePluginPackage;
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginStream.m b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
index d8373b9..180bdac 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginStream.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginStream.m
@@ -5,6 +5,7 @@
 
 #import <WebKit/WebNetscapePluginStream.h>
 
+#import <WebKit/WebBaseResourceHandleDelegate.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebKitLogging.h>
@@ -60,9 +61,16 @@
 - (void)start
 {
     ASSERT(_startingRequest);
-    [_loader loadWithRequest:_startingRequest];
+
+    [[_loader dataSource] _addSubresourceClient:_loader];
+
+    BOOL succeeded = [_loader loadWithRequest:_startingRequest];
     [_startingRequest release];
     _startingRequest = nil;
+
+    if (!succeeded) {
+        [[_loader dataSource] _removeSubresourceClient:_loader];
+    }
 }
 
 - (void)cancelWithReason:(NPReason)theReason
@@ -140,19 +148,29 @@
 
 - (void)connectionDidFinishLoading:(NSURLConnection *)con
 {
-    [[view webView] _finishedLoadingResourceFromDataSource:[view dataSource]];
+    // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
+    [self retain];
+
+    [[self dataSource] _removeSubresourceClient:self];
+    [[view webView] _finishedLoadingResourceFromDataSource:[self dataSource]];
     [stream finishedLoadingWithData:resourceData];
     [super connectionDidFinishLoading:con];
+
+    [self release];
 }
 
 - (void)connection:(NSURLConnection *)con didFailWithError:(NSError *)error
 {
-    // retain/release self in this delegate method since the additional processing can do
-    // anything including possibly releasing self; one example of this is 3266216
+    // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
+    // The other additional processing can do anything including possibly releasing self;
+    // one example of this is 3266216
     [self retain];
-    [[view webView] _receivedError:error fromDataSource:[view dataSource]];
+
+    [[self dataSource] _removeSubresourceClient:self];
+    [[view webView] _receivedError:error fromDataSource:[self dataSource]];
     [stream receivedError:error];
     [super connection:con didFailWithError:error];
+
     [self release];
 }
 
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.m b/WebKit/Plugins.subproj/WebPluginDatabase.m
index e51b177..f5dc2b4 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.m
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.m
@@ -3,6 +3,8 @@
 	Copyright (c) 2002, Apple, Inc. All rights reserved.
 */
 
+#import <WebKit/WebPluginDatabase.h>
+
 #import <WebKit/WebAssertions.h>
 #import <WebKit/WebBasePluginPackage.h>
 #import <WebKit/WebDataSourcePrivate.h>
@@ -12,8 +14,8 @@
 #import <WebKit/WebNetscapePluginDocumentView.h>
 #import <WebKit/WebNetscapePluginPackage.h>
 #import <WebKit/WebNetscapePluginRepresentation.h>
-#import <WebKit/WebPluginDatabase.h>
 #import <WebKit/WebPluginPackage.h>
+#import <WebKit/WebViewPrivate.h>
 
 #import <CoreGraphics/CPSProcesses.h>
 
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..05c778c 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -27,7 +27,6 @@
 #import <WebKit/WebFrameLoadDelegate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebDefaultResourceLoadDelegate.h>
-#import <WebKit/WebSubresourceClient.h>
 #import <WebKit/WebKitErrorsPrivate.h>
 #import <Foundation/NSString_NSURLExtras.h>
 #import <WebKit/WebNSURLExtras.h>
@@ -206,19 +205,16 @@
     }
 }
 
-- (void)_addSubresourceClient:(WebSubresourceClient *)client
+- (void)_addSubresourceClient:(WebBaseResourceHandleDelegate *)client
 {
     if (_private->subresourceClients == nil) {
         _private->subresourceClients = [[NSMutableArray alloc] init];
     }
-    if ([_private->webView defersCallbacks]) {
-        [client setDefersCallbacks:YES];
-    }
     [_private->subresourceClients addObject:client];
     [self _setLoading:YES];
 }
 
-- (void)_removeSubresourceClient:(WebSubresourceClient *)client
+- (void)_removeSubresourceClient:(WebBaseResourceHandleDelegate *)client
 {
     [_private->subresourceClients removeObject:client];
     [self _updateLoading];
@@ -668,7 +664,7 @@
     [_private->mainClient setDefersCallbacks:defers];
 
     NSEnumerator *e = [_private->subresourceClients objectEnumerator];
-    WebSubresourceClient *client;
+    WebBaseResourceHandleDelegate *client;
     while ((client = [e nextObject])) {
         [client setDefersCallbacks:defers];
     }
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 81a658e..d892987 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -9,13 +9,13 @@
 #import <WebKit/WebDataSource.h>
 
 @class NSError;
+ at class NSURLRequest;
+ at class NSURLResponse;
+ at class WebBaseResourceHandleDelegate;
 @class WebBridge;
 @class WebHistoryItem;
 @class WebIconLoader;
 @class WebMainResourceClient;
- at class NSURLRequest;
- at class NSURLResponse;
- at class WebSubresourceClient;
 @class WebView;
 
 @protocol WebDocumentRepresentation;
@@ -123,8 +123,8 @@
 - (void)_stopLoadingInternal;
 - (BOOL)_isStopping;
 - (void)_recursiveStopLoading;
-- (void)_addSubresourceClient:(WebSubresourceClient *)client;
-- (void)_removeSubresourceClient:(WebSubresourceClient *)client;
+- (void)_addSubresourceClient:(WebBaseResourceHandleDelegate *)client;
+- (void)_removeSubresourceClient:(WebBaseResourceHandleDelegate *)client;
 - (void)_setPrimaryLoadComplete:(BOOL)flag;
 - (double)_loadingStartedTime;
 - (void)_setTitle:(NSString *)title;
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