[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 06:32:32 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 3b3f9125fd79ffd1a1c18fcb671912d34a5d1734
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 19 00:20:27 2002 +0000

    WebFoundation:
    
    	Step 5 of adding user-agent API.
    
    	Add API to pass user agent into WebFoundation when creating a WebResourceHandle,
    	or to compute the user agent for each URL in a WebResourceClient method.
    
    	Also renamed the WebResourceClient methods to be more like delegate methods in AppKit.
    
            * CacheLoader.subproj/WebHTTPResourceLoader.m:
            (-[WebHTTPProtocolHandler addUserAgentHeader:]): Treat nil for user agent as "no user-agent header".
            (-[WebHTTPProtocolHandler createWFLoadRequest]): Treat nil for user agent as "no user-agent header".
            * CacheLoader.subproj/WebResourceCallbackClient.m: Updated methods for new names. Added nil-returning
    	handleWillUseUserAgent:forURL:.
            * CacheLoader.subproj/WebResourceClient.h: New names.
            * CacheLoader.subproj/WebResourceHandle.h: Added userAgent parameter to init function.
            * CacheLoader.subproj/WebResourceHandle.m: Updated method for new names.
            (-[WebResourceHandleInstanceVariables dealloc]): Store originalUserAgent so we don't ask the handle
    	twice about that same URL. Could do a bit more of this if needed.
            (-[WebResourceHandle _originalCanonicalURL]): Renamed canonicalURL to this for clarity.
            (-[WebResourceHandle _originalUserAgent]): Added.
            (-[WebResourceHandle _userAgentForURL:]): Made this actually call handleWillUseUserAgent:forURL:.
    	Now we have no hard-coded user-agent string in WebFoundation at all.
            * CacheLoader.subproj/WebResourceHandlePrivate.h: Added _originalUserAgent.
            * CacheLoader.subproj/WebResourceLoad.h: Added userAgent, originalUserAgent.
            * CacheLoader.subproj/WebResourceLoad.m:
            (-[WebResourceLoad userAgent]): Return this rather than recomputing it.
            (-[WebResourceLoad dealloc]): Release this.
            (-[WebResourceLoad _originalUserAgent]): Return this rather than recomputing it.
            (-[WebResourceLoad didRedirectToURL:cacheRedirect:]): Store userAgent when we update URL.
            (-[WebResourceLoad _cacheKey]): Allow userAgent of nil.
            * CacheLoader.subproj/WebResourceLoadManager.m:
            (+[WebResourceLoadKey keyWithHandle:]): Allow userAgent of nil, and get it, don't compute it.
            (-[WebResourceLoadKey isEqual:]): Handle userAgent of nil properly.
    
    WebKit:
    
    	Update WebResourceClient instances for new API, including adding
    	the handleWillUseUserAgent:forURL: method.
    
            * Misc.subproj/WebIconLoader.m:
            * Plugins.subproj/WebPluginStream.m:
            * WebCoreSupport.subproj/WebSubresourceClient.m:
            * WebView.subproj/WebMainResourceClient.m:
    	These were all the clients that needed updating.
    
            * WebView.subproj/WebController.m:
            (-[WebController setUserAgent:]): Lock so that we can set the user agent
    	even though another thread could be calling userAgentForURL:.
            (-[WebController userAgentForURL:]): Ditto.
    
            * WebView.subproj/WebControllerPrivate.h: Add lock.
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebControllerPrivate init]): Create lock.
            (-[WebControllerPrivate dealloc]): Release lock.
    
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _stopLoading]): Improve comment.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9e2c069..bf353a9 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,29 @@
 2002-08-18  Darin Adler  <darin at apple.com>
 
+	Update WebResourceClient instances for new API, including adding
+	the handleWillUseUserAgent:forURL: method.
+
+        * Misc.subproj/WebIconLoader.m:
+        * Plugins.subproj/WebPluginStream.m:
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        * WebView.subproj/WebMainResourceClient.m:
+	These were all the clients that needed updating.
+
+        * WebView.subproj/WebController.m:
+        (-[WebController setUserAgent:]): Lock so that we can set the user agent
+	even though another thread could be calling userAgentForURL:.
+        (-[WebController userAgentForURL:]): Ditto.
+
+        * WebView.subproj/WebControllerPrivate.h: Add lock.
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate init]): Create lock.
+        (-[WebControllerPrivate dealloc]): Release lock.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _stopLoading]): Improve comment.
+
+2002-08-18  Darin Adler  <darin at apple.com>
+
         * Misc.subproj/WebIconLoader.m:
         (-[WebIconLoader iconFromCache]):
         (-[WebIconLoader WebResourceHandleDidFinishLoading:data:]):
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 9e2c069..bf353a9 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,29 @@
 2002-08-18  Darin Adler  <darin at apple.com>
 
+	Update WebResourceClient instances for new API, including adding
+	the handleWillUseUserAgent:forURL: method.
+
+        * Misc.subproj/WebIconLoader.m:
+        * Plugins.subproj/WebPluginStream.m:
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        * WebView.subproj/WebMainResourceClient.m:
+	These were all the clients that needed updating.
+
+        * WebView.subproj/WebController.m:
+        (-[WebController setUserAgent:]): Lock so that we can set the user agent
+	even though another thread could be calling userAgentForURL:.
+        (-[WebController userAgentForURL:]): Ditto.
+
+        * WebView.subproj/WebControllerPrivate.h: Add lock.
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate init]): Create lock.
+        (-[WebControllerPrivate dealloc]): Release lock.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _stopLoading]): Improve comment.
+
+2002-08-18  Darin Adler  <darin at apple.com>
+
         * Misc.subproj/WebIconLoader.m:
         (-[WebIconLoader iconFromCache]):
         (-[WebIconLoader WebResourceHandleDidFinishLoading:data:]):
diff --git a/WebKit/Misc.subproj/WebIconLoader.m b/WebKit/Misc.subproj/WebIconLoader.m
index edcccbb..40522d1 100644
--- a/WebKit/Misc.subproj/WebIconLoader.m
+++ b/WebKit/Misc.subproj/WebIconLoader.m
@@ -18,7 +18,6 @@
     WebResourceHandle *handle;
     id delegate;
     NSURL *URL;
-    BOOL doingSyncLoad;
 }
 
 @end;
@@ -133,14 +132,12 @@
     }
     
     NSDictionary *attributes = [NSDictionary dictionaryWithObject:@"" forKey:@"only-if-cached"];
-    WebResourceHandle *handle = [[WebResourceHandle alloc] initWithClient:self
-                                                                      URL:_private->URL
-                                                               attributes:attributes
-                                                                    flags:WebResourceHandleFlagNone];
+    WebResourceHandle *handle = [[WebResourceHandle alloc] initWithURL:_private->URL
+                                                             userAgent:nil
+                                                            attributes:attributes
+                                                                 flags:WebResourceHandleFlagNone];
     if (handle) {        
-        _private->doingSyncLoad = YES;
         NSData *data = [handle loadInForeground];
-        _private->doingSyncLoad = NO;
         if (data) {
             icon = [[[NSImage alloc] initWithData:data] autorelease];
             if (icon) {
@@ -179,19 +176,21 @@
     _private->handle = nil;
 }
 
-- (void)WebResourceHandleDidBeginLoading:(WebResourceHandle *)sender
+- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
 {
+    return nil;
 }
 
-- (void)WebResourceHandleDidCancelLoading:(WebResourceHandle *)sender
+- (void)handleDidBeginLoading:(WebResourceHandle *)sender
 {
 }
 
-- (void)WebResourceHandleDidFinishLoading:(WebResourceHandle *)sender data:(NSData *)data
+- (void)handleDidCancelLoading:(WebResourceHandle *)sender
+{
+}
+
+- (void)handleDidFinishLoading:(WebResourceHandle *)sender data:(NSData *)data
 {
-    if (_private->doingSyncLoad) {
-        return;
-    }
     NSImage *icon = [[NSImage alloc] initWithData:data];
     if (icon) {
         [[self class] _resizeImage:icon];
@@ -201,15 +200,15 @@
     }
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)sender dataDidBecomeAvailable:(NSData *)data
+- (void)handleDidReceiveData:(WebResourceHandle *)sender data:(NSData *)data
 {
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)sender didFailLoadingWithResult:(WebError *)result
+- (void)handleDidFailLoading:(WebResourceHandle *)sender withError:(WebError *)result
 {
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)sender didRedirectToURL:(NSURL *)URL
+- (void)handleDidRedirect:(WebResourceHandle *)sender toURL:(NSURL *)URL
 {
 }
 
diff --git a/WebKit/Plugins.subproj/WebPluginStream.m b/WebKit/Plugins.subproj/WebPluginStream.m
index 74b49e4..4151c7a 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.m
+++ b/WebKit/Plugins.subproj/WebPluginStream.m
@@ -14,6 +14,13 @@
 #import <WebFoundation/WebFoundation.h>
 #import <WebFoundation/WebNSFileManagerExtras.h>
 
+ at interface WebPluginStream (ClassInternal)
+- (void)receivedData:(NSData *)data;
+- (void)receivedError:(NPError)error;
+- (void)finishedLoadingWithData:(NSData *)data;
+- (void)setUpGlobalsWithHandle:(WebResourceHandle *)handle;
+ at end
+
 @interface WebPluginStream (WebResourceClient) <WebResourceClient>
 @end
 
@@ -232,14 +239,23 @@
     [self finishedLoadingWithData:[dataSource data]];
 }
 
+ at end
+
 #pragma mark WebResourceHandle
 
-- (void)WebResourceHandleDidBeginLoading:(WebResourceHandle *)handle
+ at implementation WebPluginStream (WebResourceClient)
+
+- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)theURL
+{
+    return [[view webController] userAgentForURL:theURL];
+}
+
+- (void)handleDidBeginLoading:(WebResourceHandle *)handle
 {
     [[view webController] _didStartLoading:URL];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
+- (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
 {
     WebController *webController = [view webController];
 
@@ -252,7 +268,7 @@
         forResourceHandle: handle fromDataSource: [view webDataSource] complete: NO];
 }
 
-- (void)WebResourceHandleDidFinishLoading:(WebResourceHandle *)handle data: (NSData *)data
+- (void)handleDidFinishLoading:(WebResourceHandle *)handle data: (NSData *)data
 {
     WebController *webController = [view webController];
     
@@ -264,7 +280,7 @@
     [webController _didStopLoading:URL];
 }
 
-- (void)WebResourceHandleDidCancelLoading:(WebResourceHandle *)handle
+- (void)handleDidCancelLoading:(WebResourceHandle *)handle
 {
     WebController *webController = [view webController];
     
@@ -276,7 +292,7 @@
     [webController _didStopLoading:URL];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didFailLoadingWithResult:(WebError *)result
+- (void)handleDidFailLoading:(WebResourceHandle *)handle withError:(WebError *)result
 {
     WebController *webController = [view webController];
     
@@ -291,7 +307,7 @@
     [webController _didStopLoading:URL];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didRedirectToURL:(NSURL *)toURL
+- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)toURL
 {
     WebController *webController = [view webController];
     
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 25777a1..9d64d95 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -92,13 +92,18 @@
         partialProgress:[WebLoadProgress progressWithResourceHandle:handle] fromDataSource:dataSource];
 }
 
-- (void)WebResourceHandleDidBeginLoading:(WebResourceHandle *)handle
+- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
+{
+    return [[dataSource controller] userAgentForURL:URL];
+}
+
+- (void)handleDidBeginLoading:(WebResourceHandle *)handle
 {
     [self didStartLoadingWithURL:[handle URL]];
     [self receivedProgressWithHandle:handle complete: NO];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
+- (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
 {
     WEBKIT_ASSERT([currentURL isEqual:[handle URL]]);
 
@@ -106,7 +111,7 @@
     [loader addData:data];
 }
 
-- (void)WebResourceHandleDidCancelLoading:(WebResourceHandle *)handle
+- (void)handleDidCancelLoading:(WebResourceHandle *)handle
 {
     WebError *error;
     
@@ -122,7 +127,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandleDidFinishLoading:(WebResourceHandle *)handle data:(NSData *)data
+- (void)handleDidFinishLoading:(WebResourceHandle *)handle data:(NSData *)data
 {    
     WEBKIT_ASSERT([currentURL isEqual:[handle URL]]);
     WEBKIT_ASSERT([handle statusCode] == WebResourceHandleStatusLoadComplete);
@@ -142,7 +147,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didFailLoadingWithResult:(WebError *)error
+- (void)handleDidFailLoading:(WebResourceHandle *)handle withError:(WebError *)error
 {
     WEBKIT_ASSERT([currentURL isEqual:[handle URL]]);
 
@@ -155,7 +160,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didRedirectToURL:(NSURL *)URL
+- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
 {
     WEBKIT_ASSERT(currentURL != nil);
     WEBKIT_ASSERT([URL isEqual:[handle URL]]);
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 25777a1..9d64d95 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -92,13 +92,18 @@
         partialProgress:[WebLoadProgress progressWithResourceHandle:handle] fromDataSource:dataSource];
 }
 
-- (void)WebResourceHandleDidBeginLoading:(WebResourceHandle *)handle
+- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
+{
+    return [[dataSource controller] userAgentForURL:URL];
+}
+
+- (void)handleDidBeginLoading:(WebResourceHandle *)handle
 {
     [self didStartLoadingWithURL:[handle URL]];
     [self receivedProgressWithHandle:handle complete: NO];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
+- (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
 {
     WEBKIT_ASSERT([currentURL isEqual:[handle URL]]);
 
@@ -106,7 +111,7 @@
     [loader addData:data];
 }
 
-- (void)WebResourceHandleDidCancelLoading:(WebResourceHandle *)handle
+- (void)handleDidCancelLoading:(WebResourceHandle *)handle
 {
     WebError *error;
     
@@ -122,7 +127,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandleDidFinishLoading:(WebResourceHandle *)handle data:(NSData *)data
+- (void)handleDidFinishLoading:(WebResourceHandle *)handle data:(NSData *)data
 {    
     WEBKIT_ASSERT([currentURL isEqual:[handle URL]]);
     WEBKIT_ASSERT([handle statusCode] == WebResourceHandleStatusLoadComplete);
@@ -142,7 +147,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didFailLoadingWithResult:(WebError *)error
+- (void)handleDidFailLoading:(WebResourceHandle *)handle withError:(WebError *)error
 {
     WEBKIT_ASSERT([currentURL isEqual:[handle URL]]);
 
@@ -155,7 +160,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didRedirectToURL:(NSURL *)URL
+- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
 {
     WEBKIT_ASSERT(currentURL != nil);
     WEBKIT_ASSERT([URL isEqual:[handle URL]]);
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index ccd3a47..a3eeed4 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -384,15 +384,20 @@
 - (void)setUserAgent:(NSString *)userAgentString
 {
     NSString *override = [userAgentString copy];
+    [_private->userAgentLock lock];
     [_private->userAgentOverride release];
     _private->userAgentOverride = override;
+    [_private->userAgentLock unlock];
 }
 
 // Get the appropriate user-agent string for a particular URL.
 - (NSString *)userAgentForURL:(NSURL *)URL
 {
-    if (_private->userAgentOverride) {
-        return _private->userAgentOverride;
+    [_private->userAgentLock lock];
+    NSString *result = [[_private->userAgentOverride copy] autorelease];
+    [_private->userAgentLock unlock];
+    if (result) {
+        return result;
     }
 
     // Note that we currently don't look at the URL.
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index 69d9cb6..838b436 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -13,6 +13,7 @@
 {
 @public
     WebFrame *mainFrame;
+    
     id<WebWindowContext> windowContext;
     id<WebResourceProgressHandler> resourceProgressHandler;
     id<WebResourceProgressHandler> downloadProgressHandler;
@@ -20,11 +21,15 @@
     id<WebContextMenuHandler> defaultContextMenuHandler;
     id<WebControllerPolicyHandler> policyHandler;
     id<WebLocationChangeHandler> locationChangeHandler;
+    
     WebBackForwardList *backForwardList;
-    float textSizeMultiplier;
     BOOL useBackForwardList;
+    
+    float textSizeMultiplier;
+
     NSString *applicationNameForUserAgent;
     NSString *userAgentOverride;
+    NSLock *userAgentLock;
 }
 @end
 
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 127647c..490f4d2 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -28,6 +28,7 @@
     backForwardList = [[WebBackForwardList alloc] init];
     defaultContextMenuHandler = [[WebDefaultContextMenuHandler alloc] init];
     textSizeMultiplier = 1;
+    userAgentLock = [[NSLock alloc] init];
     return self;
 }
 
@@ -63,6 +64,7 @@
     [defaultContextMenuHandler release];
     [applicationNameForUserAgent release];
     [userAgentOverride release];
+    [userAgentLock release];
     
     [super dealloc];
 }
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 00cf28e..c0ea252 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -208,8 +208,7 @@
 {
     NSArray *handles;
 
-    // Stop download here because we can't rely on WebResourceHandleDidCancelLoading
-    // as it isn't sent when the app quits.
+    // Stop download here because handleDidCancelLoading isn't sent when the app quits.
     [[_private->mainHandleClient downloadHandler] cancel];
 
     if (!_private->loading) {
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index a3e1926..c1b5ef5 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -101,14 +101,19 @@
     }
 }
 
-- (void)WebResourceHandleDidBeginLoading:(WebResourceHandle *)handle
+- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
+{
+    return [[dataSource controller] userAgentForURL:URL];
+}
+
+- (void)handleDidBeginLoading:(WebResourceHandle *)handle
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "URL = %s\n", DEBUG_OBJECT([handle URL]));
     
     [self didStartLoadingWithURL:[handle URL]];
 }
 
-- (void)WebResourceHandleDidCancelLoading:(WebResourceHandle *)handle
+- (void)handleDidCancelLoading:(WebResourceHandle *)handle
 {
     WebError *error;
     
@@ -126,7 +131,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandleDidFinishLoading:(WebResourceHandle *)handle data: (NSData *)data
+- (void)handleDidFinishLoading:(WebResourceHandle *)handle data: (NSData *)data
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "URL = %s\n", DEBUG_OBJECT([handle URL]));
     
@@ -161,7 +166,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
+- (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
 {
     WebController *controller = [dataSource controller];
     NSString *contentType = [handle contentType];
@@ -226,7 +231,7 @@
     isFirstChunk = NO;
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didFailLoadingWithResult:(WebError *)result
+- (void)handleDidFailLoading:(WebResourceHandle *)handle withError:(WebError *)result
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "URL = %s, result = %s\n", DEBUG_OBJECT([handle URL]), DEBUG_OBJECT([result errorDescription]));
 
@@ -242,7 +247,7 @@
 }
 
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didRedirectToURL:(NSURL *)URL
+- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_REDIRECT, "URL = %s\n", DEBUG_OBJECT(URL));
 
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index a3e1926..c1b5ef5 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -101,14 +101,19 @@
     }
 }
 
-- (void)WebResourceHandleDidBeginLoading:(WebResourceHandle *)handle
+- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
+{
+    return [[dataSource controller] userAgentForURL:URL];
+}
+
+- (void)handleDidBeginLoading:(WebResourceHandle *)handle
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "URL = %s\n", DEBUG_OBJECT([handle URL]));
     
     [self didStartLoadingWithURL:[handle URL]];
 }
 
-- (void)WebResourceHandleDidCancelLoading:(WebResourceHandle *)handle
+- (void)handleDidCancelLoading:(WebResourceHandle *)handle
 {
     WebError *error;
     
@@ -126,7 +131,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandleDidFinishLoading:(WebResourceHandle *)handle data: (NSData *)data
+- (void)handleDidFinishLoading:(WebResourceHandle *)handle data: (NSData *)data
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "URL = %s\n", DEBUG_OBJECT([handle URL]));
     
@@ -161,7 +166,7 @@
     [self didStopLoading];
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle dataDidBecomeAvailable:(NSData *)data
+- (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
 {
     WebController *controller = [dataSource controller];
     NSString *contentType = [handle contentType];
@@ -226,7 +231,7 @@
     isFirstChunk = NO;
 }
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didFailLoadingWithResult:(WebError *)result
+- (void)handleDidFailLoading:(WebResourceHandle *)handle withError:(WebError *)result
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_LOADING, "URL = %s, result = %s\n", DEBUG_OBJECT([handle URL]), DEBUG_OBJECT([result errorDescription]));
 
@@ -242,7 +247,7 @@
 }
 
 
-- (void)WebResourceHandle:(WebResourceHandle *)handle didRedirectToURL:(NSURL *)URL
+- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
 {
     WEBKITDEBUGLEVEL(WEBKIT_LOG_REDIRECT, "URL = %s\n", DEBUG_OBJECT(URL));
 
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index ccd3a47..a3eeed4 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -384,15 +384,20 @@
 - (void)setUserAgent:(NSString *)userAgentString
 {
     NSString *override = [userAgentString copy];
+    [_private->userAgentLock lock];
     [_private->userAgentOverride release];
     _private->userAgentOverride = override;
+    [_private->userAgentLock unlock];
 }
 
 // Get the appropriate user-agent string for a particular URL.
 - (NSString *)userAgentForURL:(NSURL *)URL
 {
-    if (_private->userAgentOverride) {
-        return _private->userAgentOverride;
+    [_private->userAgentLock lock];
+    NSString *result = [[_private->userAgentOverride copy] autorelease];
+    [_private->userAgentLock unlock];
+    if (result) {
+        return result;
     }
 
     // Note that we currently don't look at the URL.
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 69d9cb6..838b436 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -13,6 +13,7 @@
 {
 @public
     WebFrame *mainFrame;
+    
     id<WebWindowContext> windowContext;
     id<WebResourceProgressHandler> resourceProgressHandler;
     id<WebResourceProgressHandler> downloadProgressHandler;
@@ -20,11 +21,15 @@
     id<WebContextMenuHandler> defaultContextMenuHandler;
     id<WebControllerPolicyHandler> policyHandler;
     id<WebLocationChangeHandler> locationChangeHandler;
+    
     WebBackForwardList *backForwardList;
-    float textSizeMultiplier;
     BOOL useBackForwardList;
+    
+    float textSizeMultiplier;
+
     NSString *applicationNameForUserAgent;
     NSString *userAgentOverride;
+    NSLock *userAgentLock;
 }
 @end
 
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 127647c..490f4d2 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -28,6 +28,7 @@
     backForwardList = [[WebBackForwardList alloc] init];
     defaultContextMenuHandler = [[WebDefaultContextMenuHandler alloc] init];
     textSizeMultiplier = 1;
+    userAgentLock = [[NSLock alloc] init];
     return self;
 }
 
@@ -63,6 +64,7 @@
     [defaultContextMenuHandler release];
     [applicationNameForUserAgent release];
     [userAgentOverride release];
+    [userAgentLock release];
     
     [super dealloc];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list