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

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:27:12 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 36cb16ef1a2c86c90584a55857c3f569f1d19811
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 4 08:40:21 2003 +0000

    WebKit:
            Switch all WebController's delegate to use informal protocols.
    
            Reviewed by trey.
    
            * Plugins.subproj/WebBaseNetscapePluginView.m:
            (-[WebBaseNetscapePluginView status:]):
            * Plugins.subproj/WebNetscapePluginDocumentView.m:
            (-[WebNetscapePluginDocumentView setDataSource:]):
            * Plugins.subproj/WebNullPluginView.m:
            (-[WebNullPluginView viewDidMoveToWindow]):
            * Plugins.subproj/WebPluginController.m:
            (-[WebPluginController showStatus:]):
            * WebCoreSupport.subproj/WebBridge.h:
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge createWindowWithURL:frameName:]):
            (-[WebBridge showWindow]):
            (-[WebBridge areToolbarsVisible]):
            (-[WebBridge setToolbarsVisible:]):
            (-[WebBridge isStatusBarVisible]):
            (-[WebBridge setStatusBarVisible:]):
            (-[WebBridge setWindowFrame:]):
            (-[WebBridge setStatusText:]):
            (-[WebBridge objectLoadedFromCacheWithURL:response:size:]):
            (-[WebBridge setWebFrame:]):
            * WebKit.exp:
            * WebKit.pbproj/project.pbxproj:
            * WebView.subproj/WebBaseResourceHandleDelegate.h:
            * WebView.subproj/WebBaseResourceHandleDelegate.m:
            (-[WebBaseResourceHandleDelegate resourceLoadDelegate]):
            (-[WebBaseResourceHandleDelegate downloadDelegate]):
            (-[WebBaseResourceHandleDelegate resource:willSendRequest:]):
            (-[WebBaseResourceHandleDelegate resource:didReceiveResponse:]):
            (-[WebBaseResourceHandleDelegate resource:didReceiveData:]):
            (-[WebBaseResourceHandleDelegate resourceDidFinishLoading:]):
            (-[WebBaseResourceHandleDelegate resource:didFailLoadingWithError:]):
            (-[WebBaseResourceHandleDelegate cancelWithError:]):
            (-[WebBaseResourceHandleDelegate notifyDelegatesOfInterruptionByPolicyChange]):
            * WebView.subproj/WebContextMenuDelegate.h:
            * WebView.subproj/WebController.h:
            * WebView.subproj/WebController.m:
            (-[WebController setWindowOperationsDelegate:]):
            (-[WebController windowOperationsDelegate]):
            (-[WebController setResourceLoadDelegate:]):
            (-[WebController resourceLoadDelegate]):
            (-[WebController setDownloadDelegate:]):
            (-[WebController downloadDelegate]):
            (-[WebController setContextMenuDelegate:]):
            (-[WebController contextMenuDelegate]):
            (-[WebController setPolicyDelegate:]):
            (-[WebController policyDelegate]):
            (-[WebController setLocationChangeDelegate:]):
            (-[WebController locationChangeDelegate]):
            (-[WebController stringByEvaluatingJavaScriptFromString:]):
            * WebView.subproj/WebControllerPolicyDelegate.h:
            * WebView.subproj/WebControllerPrivate.h:
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebController _openNewWindowWithRequest:behind:]):
            (-[WebController _menuForElement:]):
            (-[WebController _mouseDidMoveOverElement:modifierFlags:]):
            (-[WebController _locationChangeDelegateForwarder]):
            (-[WebController _resourceLoadDelegateForwarder]):
            (-[WebController _policyDelegateForwarder]):
            (-[WebController _contextMenuDelegateForwarder]):
            (-[WebController _windowOperationsDelegateForwarder]):
            (-[_WebSafeForwarder initWithTarget:defaultTarget:templateClass:]):
            (-[_WebSafeForwarder forwardInvocation:]):
            (-[_WebSafeForwarder methodSignatureForSelector:]):
            * WebView.subproj/WebDataSource.h:
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _startLoading:]):
            (-[WebDataSource _setTitle:]):
            (-[WebDataSource _setRequest:]):
            (-[WebDataSource _updateIconDatabaseWithURL:]):
            * WebView.subproj/WebDefaultContextMenuDelegate.h:
            * WebView.subproj/WebDefaultContextMenuDelegate.m:
            (+[WebDefaultContextMenuDelegate sharedContextMenuDelegate]):
            * WebView.subproj/WebDefaultLocationChangeDelegate.h: Added.
            * WebView.subproj/WebDefaultLocationChangeDelegate.m: Added.
            (+[WebDefaultLocationChangeDelegate sharedLocationChangeDelegate]):
            (-[WebDefaultLocationChangeDelegate locationChangeStartedForDataSource:]):
            (-[WebDefaultLocationChangeDelegate serverRedirectedForDataSource:]):
            (-[WebDefaultLocationChangeDelegate locationChangeCommittedForDataSource:]):
            (-[WebDefaultLocationChangeDelegate receivedPageTitle:forDataSource:]):
            (-[WebDefaultLocationChangeDelegate receivedPageIcon:forDataSource:]):
            (-[WebDefaultLocationChangeDelegate locationChangeDone:forDataSource:]):
            (-[WebDefaultLocationChangeDelegate willCloseLocationForDataSource:]):
            (-[WebDefaultLocationChangeDelegate locationChangedWithinPageForDataSource:]):
            (-[WebDefaultLocationChangeDelegate clientWillRedirectTo:delay:fireDate:forFrame:]):
            (-[WebDefaultLocationChangeDelegate clientRedirectCancelledForFrame:]):
            * WebView.subproj/WebDefaultPolicyDelegate.h:
            * WebView.subproj/WebDefaultPolicyDelegate.m:
            (+[WebDefaultPolicyDelegate sharedPolicyDelegate]):
            * WebView.subproj/WebDefaultPolicyDelegatePrivate.h: Removed.
            * WebView.subproj/WebDefaultResourceLoadDelegate.h: Added.
            * WebView.subproj/WebDefaultResourceLoadDelegate.m: Added.
            (+[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate]):
            (-[WebDefaultResourceLoadDelegate identifierForInitialRequest:fromDataSource:]):
            (-[WebDefaultResourceLoadDelegate resource:willSendRequest:fromDataSource:]):
            (-[WebDefaultResourceLoadDelegate resource:didReceiveResponse:fromDataSource:]):
            (-[WebDefaultResourceLoadDelegate resource:didReceiveContentLength:fromDataSource:]):
            (-[WebDefaultResourceLoadDelegate resource:didFinishLoadingFromDataSource:]):
            (-[WebDefaultResourceLoadDelegate resource:didFailLoadingWithError:fromDataSource:]):
            (-[WebDefaultResourceLoadDelegate pluginFailedWithError:dataSource:]):
            * WebView.subproj/WebDefaultWindowOperationsDelegate.h: Added.
            * WebView.subproj/WebDefaultWindowOperationsDelegate.m: Added.
            (+[WebDefaultWindowOperationsDelegate sharedWindowOperationsDelegate]):
            (-[WebDefaultWindowOperationsDelegate runJavaScriptConfirmPanelWithMessage:]):
            (-[WebDefaultWindowOperationsDelegate runJavaScriptTextInputPanelWithPrompt:defaultText:]):
            (-[WebDefaultWindowOperationsDelegate runOpenPanelForFileButtonWithResultListener:]):
            * WebView.subproj/WebFrame.m:
            (-[WebFrame initWithName:webView:controller:]):
            (-[WebFrame findOrCreateFrameNamed:]):
            * WebView.subproj/WebFramePrivate.m:
            (if):
            (switch):
            * WebView.subproj/WebLocationChangeDelegate.h:
            * WebView.subproj/WebLocationChangeDelegate.m: Removed.
            * WebView.subproj/WebMainResourceClient.h:
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient interruptForPolicyChangeAndKeepLoading:]):
            (-[WebMainResourceClient continueAfterContentPolicy:response:]):
            (-[WebMainResourceClient checkContentPolicyForResponse:andCallSelector:]):
            * WebView.subproj/WebResourceLoadDelegate.h:
            * WebView.subproj/WebWindowOperationsDelegate.h:
    
    WebBrowser:
            Switch all WebController's delegate to use informal protocols.
    
            Reviewed by trey.
    
            * BrowserWebController.h:
            * Debug/SnippetController.h:
            * Debug/SnippetController.m:
            (-[SnippetController dealloc]):
            (-[SnippetController windowWillClose:]):
            (-[SnippetController load]):
            (-[SnippetController locationChangeDone:forDataSource:]):
            * LoadProgressMonitor.h:
            * LocationChangeHandler.h:
    
    Tests:
            Switch all WebController's delegate to use informal protocols.
    
            Reviewed by trey.
    
            * DumpBackForward/main.m:
            * DumpRenderTree/main.m:
            * Makefile.am:
            * SimpleViewer/DocumentController.h:
            * SimpleViewer/DocumentController.m:
            (-[DocumentController loadURL:]):
            (-[DocumentController updateStatus]):
            (-[DocumentController locationChangeStartedForDataSource:]):
            (-[DocumentController receivedPageTitle:forDataSource:]):
            (-[DocumentController locationChangeDone:forDataSource:]):
            (-[DocumentController identifierForInitialRequest:fromDataSource:]):
            (-[DocumentController resource:willSendRequest:fromDataSource:]):
            * SnippetEditor/DataResourceRequest.m:
            (+[DataProtocolHandler canHandleURL:]):
            (-[DataProtocolHandler startLoadingWithCacheObject:]):
            * SnippetEditor/SnippetController.h:
            * SnippetEditor/SnippetController.m:
            (-[SnippetController dealloc]):
            (-[SnippetController windowWillClose:]):
            (-[SnippetController _resetViews]):
            (-[SnippetController locationChangeDone:forDataSource:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3740 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 778aa39..40dd00c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,130 @@
+2003-03-03  Richard Williamson   <rjw at apple.com>
+
+        Switch all WebController's delegate to use informal protocols.
+        
+        Reviewed by trey.
+
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView status:]):
+        * Plugins.subproj/WebNetscapePluginDocumentView.m:
+        (-[WebNetscapePluginDocumentView setDataSource:]):
+        * Plugins.subproj/WebNullPluginView.m:
+        (-[WebNullPluginView viewDidMoveToWindow]):
+        * Plugins.subproj/WebPluginController.m:
+        (-[WebPluginController showStatus:]):
+        * WebCoreSupport.subproj/WebBridge.h:
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge createWindowWithURL:frameName:]):
+        (-[WebBridge showWindow]):
+        (-[WebBridge areToolbarsVisible]):
+        (-[WebBridge setToolbarsVisible:]):
+        (-[WebBridge isStatusBarVisible]):
+        (-[WebBridge setStatusBarVisible:]):
+        (-[WebBridge setWindowFrame:]):
+        (-[WebBridge setStatusText:]):
+        (-[WebBridge objectLoadedFromCacheWithURL:response:size:]):
+        (-[WebBridge setWebFrame:]):
+        * WebKit.exp:
+        * WebKit.pbproj/project.pbxproj:
+        * WebView.subproj/WebBaseResourceHandleDelegate.h:
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate resourceLoadDelegate]):
+        (-[WebBaseResourceHandleDelegate downloadDelegate]):
+        (-[WebBaseResourceHandleDelegate resource:willSendRequest:]):
+        (-[WebBaseResourceHandleDelegate resource:didReceiveResponse:]):
+        (-[WebBaseResourceHandleDelegate resource:didReceiveData:]):
+        (-[WebBaseResourceHandleDelegate resourceDidFinishLoading:]):
+        (-[WebBaseResourceHandleDelegate resource:didFailLoadingWithError:]):
+        (-[WebBaseResourceHandleDelegate cancelWithError:]):
+        (-[WebBaseResourceHandleDelegate notifyDelegatesOfInterruptionByPolicyChange]):
+        * WebView.subproj/WebContextMenuDelegate.h:
+        * WebView.subproj/WebController.h:
+        * WebView.subproj/WebController.m:
+        (-[WebController setWindowOperationsDelegate:]):
+        (-[WebController windowOperationsDelegate]):
+        (-[WebController setResourceLoadDelegate:]):
+        (-[WebController resourceLoadDelegate]):
+        (-[WebController setDownloadDelegate:]):
+        (-[WebController downloadDelegate]):
+        (-[WebController setContextMenuDelegate:]):
+        (-[WebController contextMenuDelegate]):
+        (-[WebController setPolicyDelegate:]):
+        (-[WebController policyDelegate]):
+        (-[WebController setLocationChangeDelegate:]):
+        (-[WebController locationChangeDelegate]):
+        (-[WebController stringByEvaluatingJavaScriptFromString:]):
+        * WebView.subproj/WebControllerPolicyDelegate.h:
+        * WebView.subproj/WebControllerPrivate.h:
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebController _openNewWindowWithRequest:behind:]):
+        (-[WebController _menuForElement:]):
+        (-[WebController _mouseDidMoveOverElement:modifierFlags:]):
+        (-[WebController _locationChangeDelegateForwarder]):
+        (-[WebController _resourceLoadDelegateForwarder]):
+        (-[WebController _policyDelegateForwarder]):
+        (-[WebController _contextMenuDelegateForwarder]):
+        (-[WebController _windowOperationsDelegateForwarder]):
+        (-[_WebSafeForwarder initWithTarget:defaultTarget:templateClass:]):
+        (-[_WebSafeForwarder forwardInvocation:]):
+        (-[_WebSafeForwarder methodSignatureForSelector:]):
+        * WebView.subproj/WebDataSource.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _startLoading:]):
+        (-[WebDataSource _setTitle:]):
+        (-[WebDataSource _setRequest:]):
+        (-[WebDataSource _updateIconDatabaseWithURL:]):
+        * WebView.subproj/WebDefaultContextMenuDelegate.h:
+        * WebView.subproj/WebDefaultContextMenuDelegate.m:
+        (+[WebDefaultContextMenuDelegate sharedContextMenuDelegate]):
+        * WebView.subproj/WebDefaultLocationChangeDelegate.h: Added.
+        * WebView.subproj/WebDefaultLocationChangeDelegate.m: Added.
+        (+[WebDefaultLocationChangeDelegate sharedLocationChangeDelegate]):
+        (-[WebDefaultLocationChangeDelegate locationChangeStartedForDataSource:]):
+        (-[WebDefaultLocationChangeDelegate serverRedirectedForDataSource:]):
+        (-[WebDefaultLocationChangeDelegate locationChangeCommittedForDataSource:]):
+        (-[WebDefaultLocationChangeDelegate receivedPageTitle:forDataSource:]):
+        (-[WebDefaultLocationChangeDelegate receivedPageIcon:forDataSource:]):
+        (-[WebDefaultLocationChangeDelegate locationChangeDone:forDataSource:]):
+        (-[WebDefaultLocationChangeDelegate willCloseLocationForDataSource:]):
+        (-[WebDefaultLocationChangeDelegate locationChangedWithinPageForDataSource:]):
+        (-[WebDefaultLocationChangeDelegate clientWillRedirectTo:delay:fireDate:forFrame:]):
+        (-[WebDefaultLocationChangeDelegate clientRedirectCancelledForFrame:]):
+        * WebView.subproj/WebDefaultPolicyDelegate.h:
+        * WebView.subproj/WebDefaultPolicyDelegate.m:
+        (+[WebDefaultPolicyDelegate sharedPolicyDelegate]):
+        * WebView.subproj/WebDefaultPolicyDelegatePrivate.h: Removed.
+        * WebView.subproj/WebDefaultResourceLoadDelegate.h: Added.
+        * WebView.subproj/WebDefaultResourceLoadDelegate.m: Added.
+        (+[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate]):
+        (-[WebDefaultResourceLoadDelegate identifierForInitialRequest:fromDataSource:]):
+        (-[WebDefaultResourceLoadDelegate resource:willSendRequest:fromDataSource:]):
+        (-[WebDefaultResourceLoadDelegate resource:didReceiveResponse:fromDataSource:]):
+        (-[WebDefaultResourceLoadDelegate resource:didReceiveContentLength:fromDataSource:]):
+        (-[WebDefaultResourceLoadDelegate resource:didFinishLoadingFromDataSource:]):
+        (-[WebDefaultResourceLoadDelegate resource:didFailLoadingWithError:fromDataSource:]):
+        (-[WebDefaultResourceLoadDelegate pluginFailedWithError:dataSource:]):
+        * WebView.subproj/WebDefaultWindowOperationsDelegate.h: Added.
+        * WebView.subproj/WebDefaultWindowOperationsDelegate.m: Added.
+        (+[WebDefaultWindowOperationsDelegate sharedWindowOperationsDelegate]):
+        (-[WebDefaultWindowOperationsDelegate runJavaScriptConfirmPanelWithMessage:]):
+        (-[WebDefaultWindowOperationsDelegate runJavaScriptTextInputPanelWithPrompt:defaultText:]):
+        (-[WebDefaultWindowOperationsDelegate runOpenPanelForFileButtonWithResultListener:]):
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame initWithName:webView:controller:]):
+        (-[WebFrame findOrCreateFrameNamed:]):
+        * WebView.subproj/WebFramePrivate.m:
+        (if):
+        (switch):
+        * WebView.subproj/WebLocationChangeDelegate.h:
+        * WebView.subproj/WebLocationChangeDelegate.m: Removed.
+        * WebView.subproj/WebMainResourceClient.h:
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient interruptForPolicyChangeAndKeepLoading:]):
+        (-[WebMainResourceClient continueAfterContentPolicy:response:]):
+        (-[WebMainResourceClient checkContentPolicyForResponse:andCallSelector:]):
+        * WebView.subproj/WebResourceLoadDelegate.h:
+        * WebView.subproj/WebWindowOperationsDelegate.h:
+
 2003-03-03  Darin Adler  <darin at apple.com>
 
         Reviewed by Richard.
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index 3d3d2d2..0d9c1e4 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -1184,7 +1184,7 @@ typedef struct {
 
     NSString *status = (NSString *)CFStringCreateWithCString(NULL, message, kCFStringEncodingWindowsLatin1);
     LOG(Plugins, "NPN_Status: %@", status);
-    [[[self controller] windowOperationsDelegate] setStatusText:status];
+    [[[self controller] _windowOperationsDelegateForwarder] setStatusText:status];
     [status release];
 }
 
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m b/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
index 970b0e1..31e4e63 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
@@ -3,7 +3,7 @@
 	Copyright 2002, Apple, Inc. All rights reserved.
 */
 
-#import <WebKit/WebController.h>
+#import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebFrame.h>
@@ -78,7 +78,7 @@
                                                          pluginName:[thePlugin name]
                                                            MIMEType:MIME];
         
-        [[[theDataSource controller] resourceLoadDelegate] pluginFailedWithError:error dataSource:theDataSource];
+        [[[theDataSource controller] _resourceLoadDelegateForwarder] pluginFailedWithError:error dataSource:theDataSource];
         
         return;
     }
diff --git a/WebKit/Plugins.subproj/WebNullPluginView.m b/WebKit/Plugins.subproj/WebNullPluginView.m
index 2200c0c..bc20850 100644
--- a/WebKit/Plugins.subproj/WebNullPluginView.m
+++ b/WebKit/Plugins.subproj/WebNullPluginView.m
@@ -3,7 +3,7 @@
 	Copyright 2002, Apple, Inc. All rights reserved.
 */
 
-#import <WebKit/WebController.h>
+#import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebPluginError.h>
@@ -50,7 +50,7 @@ static NSImage *image = nil;
         WebController *controller = [view controller];
         WebDataSource *dataSource = [[controller frameForView:view] dataSource];
         
-        [[controller resourceLoadDelegate] pluginFailedWithError:error dataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] pluginFailedWithError:error dataSource:dataSource];
     }
 }
 
diff --git a/WebKit/Plugins.subproj/WebPluginController.m b/WebKit/Plugins.subproj/WebPluginController.m
index 7139033..b9337de 100644
--- a/WebKit/Plugins.subproj/WebPluginController.m
+++ b/WebKit/Plugins.subproj/WebPluginController.m
@@ -8,7 +8,7 @@
 
 #import <WebKit/WebPluginController.h>
 
-#import <WebKit/WebController.h>
+#import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebHTMLView.h>
 #import <WebKit/WebHTMLViewPrivate.h>
@@ -119,7 +119,7 @@
         ERROR("could not show status message (%@) because plug-in has already been destroyed", message);
         return;
     }
-    [[[_HTMLView _controller] windowOperationsDelegate] setStatusText:message];
+    [[[_HTMLView _controller] _windowOperationsDelegateForwarder] setStatusText:message];
 }
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.h b/WebKit/WebCoreSupport.subproj/WebBridge.h
index b3d6b48..a9be60e 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.h
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.h
@@ -18,7 +18,7 @@
 }
 
 - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource;
-- (void)setFrame:(WebFrame *)webFrame;
+- (void)setWebFrame:(WebFrame *)webFrame;
 - (void)runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener;
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index b4c6a15..0750295 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -8,8 +8,10 @@
 #import <WebKit/WebBackForwardList.h>
 #import <WebKit/WebBaseNetscapePluginView.h>
 #import <WebKit/WebBasePluginPackage.h>
+#import <WebKit/WebBaseResourceHandleDelegate.h>
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebHistoryItemPrivate.h>
 #import <WebKit/WebHTMLRepresentationPrivate.h>
@@ -114,26 +116,33 @@
 	[request setReferrer:[self referrer]];
     }
 
-    WebController *newController = [[[frame controller] windowOperationsDelegate] createWindowWithRequest:request];
+    id wd = [[frame controller] windowOperationsDelegate];
+    WebController *newController = nil;
+    
+    if ([wd respondsToSelector:@selector(createWindowWithRequest:)])
+        newController = [wd createWindowWithRequest:request];
     [newController _setTopLevelFrameName:name];
     return [[newController mainFrame] _bridge];
 }
 
 - (void)showWindow
 {
-    [[[frame controller] windowOperationsDelegate] showWindow];
+    [[[frame controller] _windowOperationsDelegateForwarder] showWindow];
 }
 
 - (BOOL)areToolbarsVisible
 {
     ASSERT(frame != nil);
-    return [[[frame controller] windowOperationsDelegate] areToolbarsVisible];
+    id wd = [[frame controller] windowOperationsDelegate];
+    if ([wd respondsToSelector: @selector(areToolbarsVisible)])
+        return [[[frame controller] windowOperationsDelegate] areToolbarsVisible];
+    return NO;
 }
 
 - (void)setToolbarsVisible:(BOOL)visible
 {
     ASSERT(frame != nil);
-    [[[frame controller] windowOperationsDelegate] setToolbarsVisible:visible];
+    [[[frame controller] _windowOperationsDelegateForwarder] setToolbarsVisible:visible];
 }
 
 - (BOOL)areScrollbarsVisible
@@ -151,19 +160,22 @@
 - (BOOL)isStatusBarVisible
 {
     ASSERT(frame != nil);
-    return [[[frame controller] windowOperationsDelegate] isStatusBarVisible];
+    id wd = [[frame controller] windowOperationsDelegate];
+    if ([wd respondsToSelector: @selector(isStatusBarVisible)])
+        return [[[frame controller] windowOperationsDelegate] isStatusBarVisible];
+    return NO;
 }
 
 - (void)setStatusBarVisible:(BOOL)visible
 {
     ASSERT(frame != nil);
-    [[[frame controller] windowOperationsDelegate] setStatusBarVisible:visible];
+    [[[frame controller] _windowOperationsDelegateForwarder] setStatusBarVisible:visible];
 }
 
 - (void)setWindowFrame:(NSRect)frameRect
 {
     ASSERT(frame != nil);
-    [[[frame controller] windowOperationsDelegate] setFrame:frameRect];
+    [[[frame controller] _windowOperationsDelegateForwarder] setFrame:frameRect];
 }
 
 - (NSWindow *)window
@@ -219,7 +231,7 @@
 - (void)setStatusText:(NSString *)status
 {
     ASSERT(frame != nil);
-    [[[frame controller] windowOperationsDelegate] setStatusText:status];
+    [[[frame controller] _windowOperationsDelegateForwarder] setStatusText:status];
 }
 
 - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)withDataSource
@@ -255,14 +267,18 @@
     ASSERT(response != nil);
 
     WebRequest *request = [[WebRequest alloc] initWithURL:[NSURL _web_URLWithString:URL]];
-    id <WebResourceLoadDelegate> delegate = [[frame controller] resourceLoadDelegate];
+    id delegate = [[frame controller] resourceLoadDelegate];
+    id _delegate = [[frame controller] _resourceLoadDelegateForwarder];
     id identifier;
     
     // No chance for delegate to modify request, so we don't send a willSendRequest: message.
-    identifier = [delegate identifierForInitialRequest: request fromDataSource: [self dataSource]];
-    [delegate resource: identifier didReceiveResponse: response fromDataSource: [self dataSource]];
-    [delegate resource: identifier didReceiveContentLength: bytes fromDataSource: [self dataSource]];
-    [delegate resource: identifier didFinishLoadingFromDataSource: [self dataSource]];
+    if ([delegate respondsToSelector:@selector(identifierForInitialRequest:fromDataSource:)])
+        identifier = [delegate identifierForInitialRequest: request fromDataSource: [self dataSource]];
+    else
+        identifier = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] identifierForInitialRequest:request fromDataSource:[self dataSource]];
+    [_delegate resource: identifier didReceiveResponse: response fromDataSource: [self dataSource]];
+    [_delegate resource: identifier didReceiveContentLength: bytes fromDataSource: [self dataSource]];
+    [_delegate resource: identifier didFinishLoadingFromDataSource: [self dataSource]];
     
     [[frame controller] _finishedLoadingResourceFromDataSource:[self dataSource]];
     [request release];
@@ -283,7 +299,7 @@
     [frame _clientRedirectCancelled];
 }
 
-- (void)setFrame:(WebFrame *)webFrame
+- (void)setWebFrame:(WebFrame *)webFrame
 {
     ASSERT(webFrame != nil);
 
diff --git a/WebKit/WebKit.exp b/WebKit/WebKit.exp
index 58b955f..6f0e3e1 100644
--- a/WebKit/WebKit.exp
+++ b/WebKit/WebKit.exp
@@ -19,10 +19,8 @@
 .objc_class_name_WebIconLoader
 .objc_class_name_WebJavaScriptTextInputPanel
 .objc_class_name_WebKitStatistics
-.objc_class_name_WebLocationChangeDelegate
 .objc_class_name_WebPreferences
 .objc_class_name_WebRenderNode
-.objc_class_name_WebResourceLoadDelegate
 .objc_class_name_WebStandardPanels
 .objc_class_name_WebStringTruncator
 .objc_class_name_WebTextView
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index d7c74f0..5067dda 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -303,7 +303,9 @@
 				8466AEDE03F1F82100CA2ACA,
 				8324709A03F32305003026AC,
 				2D36FD5F03F78F9E00A80166,
-				2D386AD303F822B500A80166,
+				700BC50D04144DA100A80182,
+				70BC9ED904144FC500A80182,
+				70BC9EDC0414514E00A80182,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -408,7 +410,6 @@
 				35081DA102B6D4D80ACA2ACA,
 				35081DA302B6D4D80ACA2ACA,
 				35081DA502B6D4D80ACA2ACA,
-				5152FAE8033FC52200CA2ACD,
 				F5D538ED02441FDD01A80181,
 				F5AEBB3E024A527601C1A526,
 				F5F81C3C02B67C26018635CA,
@@ -420,6 +421,9 @@
 				84A992C503CE696800CA2ACA,
 				2D81DAB503EB0B2D00A80166,
 				83730F9903FB1E660004736E,
+				700BC50E04144DA100A80182,
+				70BC9ED704144F3200A80182,
+				70BC9EDD0414514E00A80182,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -596,18 +600,6 @@
 			settings = {
 			};
 		};
-		2D386AD203F822B500A80166 = {
-			fileEncoding = 4;
-			isa = PBXFileReference;
-			path = WebDefaultPolicyDelegatePrivate.h;
-			refType = 4;
-		};
-		2D386AD303F822B500A80166 = {
-			fileRef = 2D386AD203F822B500A80166;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		2D81DAB203EB0B2D00A80166 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -1287,7 +1279,7 @@
 			isa = PBXBuildFile;
 			settings = {
 				ATTRIBUTES = (
-					Public,
+					Private,
 				);
 			};
 		};
@@ -1304,13 +1296,6 @@
 			path = WebView.subproj/WebLocationChangeDelegate.h;
 			refType = 2;
 		};
-		5152FAE6033FC52200CA2ACD = {
-			fileEncoding = 4;
-			isa = PBXFileReference;
-			name = WebLocationChangeDelegate.m;
-			path = WebView.subproj/WebLocationChangeDelegate.m;
-			refType = 2;
-		};
 		5152FAE7033FC52200CA2ACD = {
 			fileRef = 5152FAE5033FC52200CA2ACD;
 			isa = PBXBuildFile;
@@ -1320,12 +1305,6 @@
 				);
 			};
 		};
-		5152FAE8033FC52200CA2ACD = {
-			fileRef = 5152FAE6033FC52200CA2ACD;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		516F296F03A6C45A00CA2D3A = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -1615,6 +1594,30 @@
 //702
 //703
 //704
+		700BC50B04144DA100A80182 = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebDefaultResourceLoadDelegate.h;
+			refType = 4;
+		};
+		700BC50C04144DA100A80182 = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebDefaultResourceLoadDelegate.m;
+			refType = 4;
+		};
+		700BC50D04144DA100A80182 = {
+			fileRef = 700BC50B04144DA100A80182;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		700BC50E04144DA100A80182 = {
+			fileRef = 700BC50C04144DA100A80182;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		7082F56F038EADAA00A80180 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -1642,6 +1645,54 @@
 			settings = {
 			};
 		};
+		70BC9ED604144F3200A80182 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			path = WebDefaultLocationChangeDelegate.m;
+			refType = 4;
+		};
+		70BC9ED704144F3200A80182 = {
+			fileRef = 70BC9ED604144F3200A80182;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		70BC9ED804144FC500A80182 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			path = WebDefaultLocationChangeDelegate.h;
+			refType = 4;
+		};
+		70BC9ED904144FC500A80182 = {
+			fileRef = 70BC9ED804144FC500A80182;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		70BC9EDA0414514E00A80182 = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebDefaultWindowOperationsDelegate.h;
+			refType = 4;
+		};
+		70BC9EDB0414514E00A80182 = {
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebDefaultWindowOperationsDelegate.m;
+			refType = 4;
+		};
+		70BC9EDC0414514E00A80182 = {
+			fileRef = 70BC9EDA0414514E00A80182;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		70BC9EDD0414514E00A80182 = {
+			fileRef = 70BC9EDB0414514E00A80182;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 //700
 //701
 //702
@@ -2417,44 +2468,48 @@
 				933D659A03413FF2008635CE,
 				5152FAD5033FC43400CA2ACD,
 				3944606F020F50ED0ECA1767,
-				39446065020F50ED0ECA1767,
 				39446064020F50ED0ECA1767,
-				39446066020F50ED0ECA1767,
 				5152FAD7033FC44A00CA2ACD,
-				658CF8C003851FB5008C2A4B,
 				5152FAD8033FC44A00CA2ACD,
+				658CF8C003851FB5008C2A4B,
+				39446065020F50ED0ECA1767,
+				39446066020F50ED0ECA1767,
 				6523FACF032DA06B005EFCFF,
 				6523FAD0032DA06B005EFCFF,
 				39446070020F50ED0ECA1767,
-				39446072020F50ED0ECA1767,
 				39446071020F50ED0ECA1767,
+				39446072020F50ED0ECA1767,
 				39446073020F50ED0ECA1767,
 				5152FADD033FC50400CA2ACD,
 				5152FADE033FC50400CA2ACD,
-				2D386AD203F822B500A80166,
+				70BC9ED804144FC500A80182,
+				70BC9ED604144F3200A80182,
 				5152FADF033FC50400CA2ACD,
 				5152FAE0033FC50400CA2ACD,
+				700BC50B04144DA100A80182,
+				700BC50C04144DA100A80182,
+				70BC9EDA0414514E00A80182,
+				70BC9EDB0414514E00A80182,
 				35081DAE02B6D4F50ACA2ACA,
 				3944606B020F50ED0ECA1767,
 				3944606C020F50ED0ECA1767,
 				2D81DAB203EB0B2D00A80166,
-				2D36FD5E03F78F9E00A80166,
 				2D81DAB303EB0B2D00A80166,
+				2D36FD5E03F78F9E00A80166,
 				39446074020F50ED0ECA1767,
 				F5143A370221DCCE01A80181,
 				9CF0E249021361B00ECA16EA,
 				9CF0E24A021361B00ECA16EA,
 				5152FAE5033FC52200CA2ACD,
-				5152FAE6033FC52200CA2ACD,
 				F5D538E802441F2601A80181,
 				F5D538EC02441FDD01A80181,
 				3944606E020F50ED0ECA1767,
-				9CAE9D070252A4130ECA16EA,
 				F5AEBB3D024A527601C1A526,
+				9CAE9D070252A4130ECA16EA,
 				513D422E034CF55A00CA2ACD,
 				39446076020F50ED0ECA1767,
-				39446078020F50ED0ECA1767,
 				39446077020F50ED0ECA1767,
+				39446078020F50ED0ECA1767,
 				39446079020F50ED0ECA1767,
 				511D5553033FD51000CA2ACD,
 			);
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index 8be711b..ca50a89 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -13,7 +13,6 @@
 @class WebResponse;
 
 @protocol WebResourceDelegate;
- at protocol WebResourceLoadDelegate;
 
 @interface WebBaseResourceHandleDelegate : NSObject <WebResourceDelegate>
 {
@@ -25,8 +24,8 @@
     WebController *controller;
     WebResponse *response;
     id identifier;
-    id <WebResourceLoadDelegate>resourceLoadDelegate;
-    id <WebResourceLoadDelegate>downloadDelegate;
+    id resourceLoadDelegate;
+    id downloadDelegate;
     NSURL *currentURL;
     BOOL reachedTerminalState;
     BOOL defersCallbacks;
@@ -40,8 +39,8 @@
 - (void)setDataSource:(WebDataSource *)d;
 - (WebDataSource *)dataSource;
 
-- (id <WebResourceLoadDelegate>)resourceLoadDelegate;
-- (id <WebResourceLoadDelegate>)downloadDelegate;
+- resourceLoadDelegate;
+- downloadDelegate;
 - (BOOL)isDownload;
 
 - (void)cancel;
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 83e183a..9aea6c3 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -12,8 +12,9 @@
 #import <WebFoundation/WebRequest.h>
 #import <WebFoundation/WebResponse.h>
 
-#import <WebKit/WebController.h>
+#import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebKitErrors.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebStandardPanelsPrivate.h>
@@ -118,12 +119,12 @@
     return dataSource;
 }
 
-- (id <WebResourceLoadDelegate>)resourceLoadDelegate
+- resourceLoadDelegate
 {
     return resourceLoadDelegate;
 }
 
-- (id <WebResourceLoadDelegate>)downloadDelegate
+- downloadDelegate
 {
     return downloadDelegate;
 }
@@ -143,11 +144,17 @@
     if (identifier == nil) {
         // The identifier is released after the last callback, rather than in dealloc
         // to avoid potential cycles.
-        identifier = [[resourceLoadDelegate identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
+        if ([resourceLoadDelegate respondsToSelector: @selector(identifierForInitialRequest:fromDataSource:)])
+            identifier = [[resourceLoadDelegate identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
+        else
+            identifier = [[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
     }
 
     if (resourceLoadDelegate) {
-        newRequest = [resourceLoadDelegate resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
+        if ([resourceLoadDelegate respondsToSelector: @selector(resource:willSendRequest:fromDataSource:)])
+            newRequest = [resourceLoadDelegate resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
+        else
+            newRequest = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
     }
 
     // Store a copy of the request.
@@ -186,7 +193,7 @@
         [downloadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
     else {
         [dataSource _addResponse: r];
-        [resourceLoadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didReceiveResponse:r fromDataSource:dataSource];
     }
 }
 
@@ -198,7 +205,7 @@
     if ([self isDownload])
         [downloadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
     else
-        [resourceLoadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
 }
 
 - (void)resourceDidFinishLoading:(WebResource *)h
@@ -209,7 +216,7 @@
     if ([self isDownload])
         [downloadDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
     else
-        [resourceLoadDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didFinishLoadingFromDataSource:dataSource];
 
     ASSERT(currentURL);
     [[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
@@ -225,7 +232,7 @@
     if ([self isDownload])
         [downloadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
     else
-        [resourceLoadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
 
     // currentURL may be nil if the request was aborted
     if (currentURL)
@@ -248,7 +255,7 @@
         if ([self isDownload]) {
             [downloadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
         } else {
-            [resourceLoadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
+            [[controller _resourceLoadDelegateForwarder] resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
         }
     }
 
@@ -278,7 +285,7 @@
                                      inDomain:WebErrorDomainWebKit
                                    failingURL:nil];
     
-    [[self resourceLoadDelegate] resource:identifier
+    [[controller _resourceLoadDelegateForwarder] resource:identifier
                   didFailLoadingWithError:error
                            fromDataSource:dataSource];
 }
diff --git a/WebKit/WebView.subproj/WebContextMenuDelegate.h b/WebKit/WebView.subproj/WebContextMenuDelegate.h
index 6cd9db7..522c527 100644
--- a/WebKit/WebView.subproj/WebContextMenuDelegate.h
+++ b/WebKit/WebView.subproj/WebContextMenuDelegate.h
@@ -6,7 +6,7 @@
 */
 
 /*!
-    @protocol WebContextMenuDelegate
+    @category WebContextMenuDelegate
     @discussion WebContextMenuDelegate determine what context menu items are visible over
     a clicked element.
 */
@@ -29,7 +29,7 @@ enum {
     WebMenuItemTagCopy
 };
 
- at protocol WebContextMenuDelegate <NSObject>
+ at interface NSObject (WebContextMenuDelegate)
 
 /*!
     @method contextMenuItemsForElement:defaultMenuItems:
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 57018bc..ef11400 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -19,12 +19,6 @@
 @class WebPreferences;
 @class WebView;
 
- at protocol WebContextMenuDelegate;
- at protocol WebControllerPolicyDelegate;
- at protocol WebLocationChangeDelegate;
- at protocol WebResourceLoadDelegate;
- at protocol WebWindowOperationsDelegate;
-
 // These strings are keys into the element dictionary provided in
 // the WebContextMenuDelegate's contextMenuItemsForElement and the WebControllerPolicyDelegate's clickPolicyForElement.
 
@@ -115,83 +109,83 @@ extern NSString *WebElementLinkLabelKey;	// NSString of the text within the anch
     @abstract Set the controller's WebWindowOperationsDelegate.
     @param delegate The WebWindowOperationsDelegate to set as the delegate.
 */    
-- (void)setWindowOperationsDelegate: (id<WebWindowOperationsDelegate>)delegate;
+- (void)setWindowOperationsDelegate: (id)delegate;
 
 /*!
     @method windowOperationsDelegate
     @abstract Return the controller's WebWindowOperationsDelegate.
     @result The controller's WebWindowOperationsDelegate.
 */
-- (id<WebWindowOperationsDelegate>)windowOperationsDelegate;
+- (id)windowOperationsDelegate;
 
 /*!
     @method setResourceLoadDelegate:
     @abstract Set the controller's WebResourceLoadDelegate load delegate.
     @param delegate The WebResourceLoadDelegate to set as the load delegate.
 */
-- (void)setResourceLoadDelegate: (id<WebResourceLoadDelegate>)delegate;
+- (void)setResourceLoadDelegate: (id)delegate;
 
 /*!
     @method resourceLoadDelegate
     @result Return the controller's WebResourceLoadDelegate.
 */    
-- (id<WebResourceLoadDelegate>)resourceLoadDelegate;
+- (id)resourceLoadDelegate;
 
 /*!
     @method setDownloadDelegate:
     @abstract Set the controller's WebResourceLoadDelegate download delegate.
     @param delegate The WebResourceLoadDelegate to set as the download delegate.
 */    
-- (void)setDownloadDelegate: (id<WebResourceLoadDelegate>)delegate;
+- (void)setDownloadDelegate: (id)delegate;
 
 /*!
     @method downloadDelegate
     @abstract Return the controller's WebResourceLoadDelegate download delegate.
     @result The controller's WebResourceLoadDelegate download delegate.
 */    
-- (id<WebResourceLoadDelegate>)downloadDelegate;
+- (id)downloadDelegate;
 
 /*!
     @method setContextMenuDelegate:
     @abstract Set the controller's WebContextMenuDelegate.
     @param delegate The WebContextMenuDelegate to set as the delegate.
 */    
-- (void)setContextMenuDelegate: (id<WebContextMenuDelegate>)delegate;
+- (void)setContextMenuDelegate: (id)delegate;
 
 /*!
     @method contextMenuDelegate
     @abstract Return the controller's WebContextMenuDelegate.
     @result The controller's WebContextMenuDelegate.
 */    
-- (id<WebContextMenuDelegate>)contextMenuDelegate;
+- (id)contextMenuDelegate;
 
 /*!
     @method setLocationChangeDelegate:
     @abstract Set the controller's WebLocationChangeDelegate delegate.
     @param delegate The WebLocationChangeDelegate to set as the delegate.
 */    
-- (void)setLocationChangeDelegate:(id <WebLocationChangeDelegate>)delegate;
+- (void)setLocationChangeDelegate: (id)delegate;
 
 /*!
     @method locationChangeDelegate
     @abstract Return the controller's WebLocationChangeDelegate delegate.
     @result The controller's WebLocationChangeDelegate delegate.
 */    
-- (id <WebLocationChangeDelegate>)locationChangeDelegate;
+- (id)locationChangeDelegate;
 
 /*!
     @method setPolicyDelegate:
     @abstract Set the controller's WebControllerPolicyDelegate delegate.
     @param delegate The WebControllerPolicyDelegate to set as the delegate.
 */    
-- (void)setPolicyDelegate: (id<WebControllerPolicyDelegate>)delegate;
+- (void)setPolicyDelegate: (id)delegate;
 
 /*!
     @method policyDelegate
     @abstract Return the controller's WebControllerPolicyDelegate.
     @result The controller's WebControllerPolicyDelegate.
 */    
-- (id<WebControllerPolicyDelegate>)policyDelegate;
+- (id)policyDelegate;
 
 /*!
     @method mainFrame
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 259abab..574436a 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -13,7 +13,7 @@
 #import <WebKit/WebControllerPolicyDelegate.h>
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebDefaultPolicyDelegatePrivate.h>
+#import <WebKit/WebDefaultPolicyDelegate.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebDynamicScrollBarsView.h>
 #import <WebKit/WebException.h>
@@ -52,6 +52,9 @@ NSString *WebElementLinkTargetFrameKey =	@"WebElementTargetFrame";
 NSString *WebElementLinkLabelKey = 		@"WebElementLinkLabel";
 NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 
+
+
+
 @implementation WebController
 
 - init
@@ -111,67 +114,65 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
     return _private->preferences ? _private->preferences : [WebPreferences standardPreferences];
 }
 
-- (void)setWindowOperationsDelegate:(id <WebWindowOperationsDelegate>)delegate
+- (void)setWindowOperationsDelegate:delegate
 {
     _private->windowContext = delegate;
 }
 
-- (id <WebWindowOperationsDelegate>)windowOperationsDelegate
+- windowOperationsDelegate
 {
     return _private->windowContext;
 }
 
-- (void)setResourceLoadDelegate: (id <WebResourceLoadDelegate>)delegate
+- (void)setResourceLoadDelegate: delegate
 {
     _private->resourceProgressDelegate = delegate;
 }
 
 
-- (id<WebResourceLoadDelegate>)resourceLoadDelegate
+- resourceLoadDelegate
 {
     return _private->resourceProgressDelegate;
 }
 
 
-- (void)setDownloadDelegate: (id<WebResourceLoadDelegate>)delegate
+- (void)setDownloadDelegate: delegate
 {
     _private->downloadProgressDelegate = delegate;
 }
 
 
-- (id<WebResourceLoadDelegate>)downloadDelegate
+- downloadDelegate
 {
     return _private->downloadProgressDelegate;
 }
 
-- (void)setContextMenuDelegate: (id<WebContextMenuDelegate>)delegate
+- (void)setContextMenuDelegate: delegate
 {
     _private->contextMenuDelegate = delegate;
 }
 
-- (id<WebContextMenuDelegate>)contextMenuDelegate
+- contextMenuDelegate
 {
     return _private->contextMenuDelegate;
 }
 
-- (void)setPolicyDelegate:(id <WebControllerPolicyDelegate>)delegate
+- (void)setPolicyDelegate:delegate
 {
     _private->policyDelegate = delegate;
 }
 
-- (id<WebControllerPolicyDelegate>)policyDelegate
+- policyDelegate
 {
-    if (!_private->policyDelegate)
-        _private->policyDelegate = [WebDefaultPolicyDelegate _sharedWebPolicyDelegate];
     return _private->policyDelegate;
 }
 
-- (void)setLocationChangeDelegate:(id <WebLocationChangeDelegate>)delegate
+- (void)setLocationChangeDelegate:delegate
 {
     _private->locationChangeDelegate = delegate;
 }
 
-- (id <WebLocationChangeDelegate>)locationChangeDelegate
+- locationChangeDelegate
 {
     return _private->locationChangeDelegate;
 }
@@ -496,37 +497,3 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 }
 
 @end
-
- at implementation WebResourceLoadDelegate
-
-- identifierForInitialRequest: (WebRequest *)request fromDataSource: (WebDataSource *)dataSource
-{
-    return [[[NSObject alloc] init] autorelease];
-}
-
--(WebRequest *)resource:identifier willSendRequest: (WebRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
-{
-    return newRequest;
-}
-
--(void)resource:identifier didReceiveResponse: (WebResponse *)response fromDataSource:(WebDataSource *)dataSource
-{
-}
-
--(void)resource:identifier didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
-{
-}
-
--(void)resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
-{
-}
-
--(void)resource:identifier didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
-{
-}
-
-- (void)pluginFailedWithError:(WebPluginError *)error dataSource:(WebDataSource *)dataSource
-{
-}
-
- at end
diff --git a/WebKit/WebView.subproj/WebControllerPolicyDelegate.h b/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
index 46d356f..c384f79 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebControllerPolicyDelegate.h
@@ -82,7 +82,7 @@ typedef enum {
 
 
 /*!
-    @protocol WebControllerPolicyDelegate
+    @category WebControllerPolicyDelegate
     @discussion While loading a URL, WebKit asks the WebControllerPolicyDelegate for
     policies that determine the action of what to do with the URL or the data that
     the URL represents. Typically, the policy handler methods are called in this order:
@@ -90,7 +90,7 @@ typedef enum {
     decideNavigationPolicyForAction:andRequest:inFrame:decisionListener:<BR>
     contentPolicyForMIMEType:andRequest:inFrame:<BR>
 */
- at protocol WebControllerPolicyDelegate <NSObject>
+ at interface NSObject (WebControllerPolicyDelegate)
 
 /*!
      @method decideNavigationPolicyForAction:andRequest:inFrame:decisionListener:
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index 0670a53..4aabba5 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -15,20 +15,22 @@
 typedef enum { Safari, MacIE, WinIE } UserAgentStringType;
 enum { NumUserAgentStringTypes = WinIE + 1 };
 
+#define NUM_LOCATION_CHANGE_DELEGATE_SELECTORS	10
+
 @interface WebControllerPrivate : NSObject
 {
 @public
     WebFrame *mainFrame;
     
-    id <WebWindowOperationsDelegate> windowContext;
-    id <WebResourceLoadDelegate> resourceProgressDelegate;
-    id <WebResourceLoadDelegate> downloadProgressDelegate;
-    id <WebContextMenuDelegate> contextMenuDelegate;
-    id <WebControllerPolicyDelegate> policyDelegate;
-    id <WebLocationChangeDelegate> locationChangeDelegate;
+    id windowContext;
+    id resourceProgressDelegate;
+    id downloadProgressDelegate;
+    id contextMenuDelegate;
+    id policyDelegate;
+    id locationChangeDelegate;
     id <WebFormDelegate> formDelegate;
     
-    id <WebContextMenuDelegate> defaultContextMenuDelegate;
+    id defaultContextMenuDelegate;
 
     WebBackForwardList *backForwardList;
     BOOL useBackForwardList;
@@ -46,7 +48,7 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 
     WebPreferences *preferences;
     WebCoreSettings *settings;
-    
+        
     BOOL lastElementWasNonNil;
 }
 @end
@@ -55,7 +57,6 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 
 - (WebFrame *)_createFrameNamed:(NSString *)name inParent:(WebFrame *)parent allowsScrolling:(BOOL)allowsScrolling;
 
-- (id <WebContextMenuDelegate>)_defaultContextMenuDelegate;
 - (void)_finishedLoadingResourceFromDataSource:(WebDataSource *)dataSource;
 - (void)_receivedError:(WebError *)error fromDataSource:(WebDataSource *)dataSource;
 - (void)_mainReceivedBytesSoFar:(unsigned)bytesSoFar fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete;
@@ -85,4 +86,19 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 - (WebCoreSettings *)_settings;
 - (void)_updateWebCoreSettingsFromPreferences: (WebPreferences *)prefs;
 
+- _locationChangeDelegateForwarder;
+- _resourceLoadDelegateForwarder;
+- _policyDelegateForwarder;
+- _contextMenuDelegateForwarder;
+- _windowOperationsDelegateForwarder;
 @end
+
+ at interface _WebSafeForwarder : NSObject
+{
+    id target;	// Non-retainted.  Don't retain delegates;
+    id defaultTarget;
+    Class templateClass;
+}
++ safeForwarderWithTarget: t defaultTarget: dt templateClass: (Class)aClass;
+ at end
+
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 5f1a234..99358a7 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -5,12 +5,17 @@
 
 #import <WebKit/WebBackForwardList.h>
 #import <WebKit/WebContextMenuDelegate.h>
-#import <WebKit/WebFormDelegatePrivate.h>
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebControllerSets.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebDefaultContextMenuDelegate.h>
+#import <WebKit/WebDefaultLocationChangeDelegate.h>
+#import <WebKit/WebDefaultPolicyDelegate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
+#import <WebKit/WebDefaultWindowOperationsDelegate.h>
+#import <WebKit/WebFormDelegatePrivate.h>
 #import <WebKit/WebFramePrivate.h>
+#import <WebKit/WebLocationChangeDelegate.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebStandardPanelsPrivate.h>
@@ -107,11 +112,6 @@
     return newFrame;
 }
 
-- (id<WebContextMenuDelegate>)_defaultContextMenuDelegate
-{
-    return _private->defaultContextMenuDelegate;
-}
-
 - (void)_finishedLoadingResourceFromDataSource: (WebDataSource *)dataSource
 {
     WebFrame *frame = [dataSource webFrame];
@@ -298,11 +298,17 @@
 
 - (WebController *)_openNewWindowWithRequest:(WebRequest *)request behind:(BOOL)behind
 {
-    WebController *newWindowController = [[self windowOperationsDelegate] createWindowWithRequest:request];
+    id wd = [self windowOperationsDelegate];
+    WebController *newWindowController = nil;
+    if ([wd respondsToSelector:@selector(createWindowWithRequest:)])
+        newWindowController = [wd createWindowWithRequest:request];
+    else {
+        [[WebDefaultWindowOperationsDelegate sharedWindowOperationsDelegate] createWindowWithRequest: request];
+    }
     if (behind) {
-        [[newWindowController windowOperationsDelegate] showWindowBehindFrontmost];
+        [[newWindowController _windowOperationsDelegateForwarder] showWindowBehindFrontmost];
     } else {
-        [[newWindowController windowOperationsDelegate] showWindow];
+        [[newWindowController _windowOperationsDelegateForwarder] showWindow];
     }
     return newWindowController;
 }
@@ -316,9 +322,14 @@
     unsigned i;
 
     if (_private->contextMenuDelegate) {
-        menuItems = [_private->contextMenuDelegate contextMenuItemsForElement:element
-                                                             defaultMenuItems:defaultMenuItems];
-    } else {
+        id cd = _private->contextMenuDelegate;
+        
+        if ([cd respondsToSelector:@selector(contextMenuItemsForElement:defaultMenuItems:)])
+            menuItems = [cd contextMenuItemsForElement:element defaultMenuItems:defaultMenuItems];
+        else
+            menuItems = [[WebDefaultContextMenuDelegate sharedContextMenuDelegate] contextMenuItemsForElement:element defaultMenuItems:defaultMenuItems];
+    } 
+    else {
         menuItems = defaultMenuItems;
     }
 
@@ -340,7 +351,7 @@
     // for that case.
     
     if (dictionary && _private->lastElementWasNonNil) {
-        [[self windowOperationsDelegate] mouseDidMoveOverElement:dictionary modifierFlags:modifierFlags];
+        [[self _windowOperationsDelegateForwarder] mouseDidMoveOverElement:dictionary modifierFlags:modifierFlags];
     }
     _private->lastElementWasNonNil = dictionary != nil;
 }
@@ -407,4 +418,65 @@
     [self _updateWebCoreSettingsFromPreferences: preferences];
 }
 
+- _locationChangeDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self locationChangeDelegate]  defaultTarget: [WebDefaultLocationChangeDelegate sharedLocationChangeDelegate] templateClass: [WebDefaultLocationChangeDelegate class]];
+}
+
+- _resourceLoadDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self resourceLoadDelegate] defaultTarget: [WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] templateClass: [WebDefaultResourceLoadDelegate class]];
+}
+
+- _policyDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self policyDelegate] defaultTarget: [WebDefaultPolicyDelegate sharedPolicyDelegate] templateClass: [WebDefaultPolicyDelegate class]];
+}
+
+- _contextMenuDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self contextMenuDelegate] defaultTarget: [WebDefaultContextMenuDelegate sharedContextMenuDelegate] templateClass: [WebDefaultContextMenuDelegate class]];
+}
+
+- _windowOperationsDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self windowOperationsDelegate] defaultTarget: [WebDefaultWindowOperationsDelegate sharedWindowOperationsDelegate] templateClass: [WebDefaultWindowOperationsDelegate class]];
+}
+
+ at end
+
+
+ at implementation _WebSafeForwarder
+
+- initWithTarget: t defaultTarget: dt templateClass: (Class)aClass
+{
+    [super init];
+    target = t;		// Non retained.
+    defaultTarget = dt;
+    templateClass = aClass;
+    return self;
+}
+
+
+// Used to send messages to delegates that implement informal protocols.
++ safeForwarderWithTarget: t defaultTarget: dt templateClass: (Class)aClass;
+{
+    return [[[_WebSafeForwarder alloc] initWithTarget: t defaultTarget: dt templateClass: aClass] autorelease];
+}
+
+- (void)forwardInvocation:(NSInvocation *)anInvocation
+{
+    if ([target respondsToSelector: [anInvocation selector]])
+        [anInvocation invokeWithTarget: target];
+    else if ([defaultTarget respondsToSelector: [anInvocation selector]])
+        [anInvocation invokeWithTarget: defaultTarget];
+    // Do nothing quietly if method not implemented.
+}
+
+- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
+{
+    return [templateClass instanceMethodSignatureForSelector: aSelector];
+}
+
 @end
+
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index 5e8adcb..7aab92c 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -100,7 +100,7 @@
 /*!
     @method URL
     @discussion The value of URL will change if a redirect occurs.
-    To monitor change in the URL, override the <WebLocationChangeDelegate> 
+    To monitor change in the URL, override the WebLocationChangeDelegate 
     serverRedirectedForDataSource: method.
     @result Returns the current URL associated with the datasource.
 */
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index cb8fb33..6fd1cc2 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -165,7 +165,7 @@
     
     [self _setLoading:YES];
     
-    [[_private->controller locationChangeDelegate] locationChangeStartedForDataSource:self];
+    [[_private->controller _locationChangeDelegateForwarder] locationChangeStartedForDataSource:self];
 
     if (pageCache){
         _private->loadingFromPageCache = YES;
@@ -296,7 +296,7 @@
         // Must update the entries in the back-forward list too.
         [_private->ourBackForwardItems makeObjectsPerformSelector:@selector(setTitle:) withObject:_private->pageTitle];
 
-        [[_private->controller locationChangeDelegate] receivedPageTitle:_private->pageTitle forDataSource:self];
+        [[_private->controller _locationChangeDelegateForwarder] receivedPageTitle:_private->pageTitle forDataSource:self];
     }
 }
 
@@ -322,7 +322,7 @@
     // Only send serverRedirectedForDataSource: if URL changed.
     if (![[oldRequest URL] isEqual: [request URL]]) {
         LOG(Redirect, "Server redirect to: %@", [request URL]);
-        [[_private->controller locationChangeDelegate] serverRedirectedForDataSource:self];
+        [[_private->controller _locationChangeDelegateForwarder] serverRedirectedForDataSource:self];
     }
         
     [oldRequest release];
@@ -553,7 +553,7 @@
     [iconDB _setIconURL:[iconURL absoluteString] forURL:[[[self _originalRequest] URL] absoluteString]];
 
     NSImage *icon = [iconDB iconForURL:[[self URL] absoluteString] withSize:WebIconSmallSize];
-    [[_private->controller locationChangeDelegate] receivedPageIcon:icon forDataSource:self];
+    [[_private->controller _locationChangeDelegateForwarder] receivedPageIcon:icon forDataSource:self];
 }
 
 - (void)iconLoader:(WebIconLoader *)iconLoader receivedPageIcon:(NSImage *)icon;
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h
index f7d1548..24765cc 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h
@@ -8,12 +8,11 @@
 
 #import <Foundation/Foundation.h>
 
- at protocol WebContextMenuDelegate;
 
 
- at interface WebDefaultContextMenuDelegate : NSObject <WebContextMenuDelegate>
+ at interface WebDefaultContextMenuDelegate : NSObject
 {
     NSDictionary *element;
 }
-
++ (WebDefaultContextMenuDelegate *)sharedContextMenuDelegate;
 @end
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 074e3cb..a30ee87 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -22,6 +22,18 @@
 
 @implementation WebDefaultContextMenuDelegate
 
+static WebDefaultContextMenuDelegate *sharedDelegate = nil;
+
+// Return a object with vanilla implementations of the protocol's methods
+// Note this feature relies on our default delegate being stateless
++ (WebDefaultContextMenuDelegate *)sharedContextMenuDelegate
+{
+    if (!sharedDelegate) {
+        sharedDelegate = [[WebDefaultContextMenuDelegate alloc] init];
+    }
+    return sharedDelegate;
+}
+
 - (void)dealloc
 {
     [element release];
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h b/WebKit/WebView.subproj/WebDefaultFrameLoadDelegate.h
similarity index 58%
copy from WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
copy to WebKit/WebView.subproj/WebDefaultFrameLoadDelegate.h
index 42f35bd..e7223e8 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebDefaultFrameLoadDelegate.h
@@ -2,15 +2,16 @@
         WebDefaultPolicyDelegate.h
 	Copyright 2002, Apple Computer, Inc.
 
-        Public header file.
+        Private header file.
 */
 #import <Foundation/Foundation.h>
 
 /*!
-    @class WebDefaultPolicyDelegate
+    @class WebDefaultLocationChangeDelegate
     @discussion WebDefaultPolicyDelegate will be used as a WebController's
     default policy delegate.  It can be subclassed to modify policies. 
 */
- at interface WebDefaultPolicyDelegate : NSObject <WebControllerPolicyDelegate>
+ at interface WebDefaultLocationChangeDelegate : NSObject
++ (WebDefaultLocationChangeDelegate *)sharedLocationChangeDelegate;
 @end
 
diff --git a/WebKit/WebView.subproj/WebDefaultFrameLoadDelegate.m b/WebKit/WebView.subproj/WebDefaultFrameLoadDelegate.m
new file mode 100644
index 0000000..fa665ad
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultFrameLoadDelegate.m
@@ -0,0 +1,43 @@
+/*	
+        WebLocationChangeDelegate.m
+	Copyright 2002, Apple, Inc. All rights reserved.
+*/
+#import <WebFoundation/WebError.h>
+
+#import <WebKit/WebDefaultLocationChangeDelegate.h>
+#import <WebKit/WebDataSource.h>
+#import <WebKit/WebFrame.h>
+
+ at implementation WebDefaultLocationChangeDelegate
+
+static WebDefaultLocationChangeDelegate *sharedDelegate = nil;
+
+// Return a object with vanilla implementations of the protocol's methods
+// Note this feature relies on our default delegate being stateless
++ (WebDefaultLocationChangeDelegate *)sharedLocationChangeDelegate
+{
+    if (!sharedDelegate) {
+        sharedDelegate = [[WebDefaultLocationChangeDelegate alloc] init];
+    }
+    return sharedDelegate;
+}
+
+- (void)locationChangeStartedForDataSource:(WebDataSource *)dataSource { }
+
+- (void)serverRedirectedForDataSource:(WebDataSource *)dataSource { }
+
+- (void)locationChangeCommittedForDataSource:(WebDataSource *)dataSource { }
+
+- (void)receivedPageTitle:(NSString *)title forDataSource:(WebDataSource *)dataSource { }
+- (void)receivedPageIcon:(NSImage *)image forDataSource:(WebDataSource *)dataSource { }
+
+- (void)locationChangeDone:(WebError *)error forDataSource:(WebDataSource *)dataSource { }
+
+- (void)willCloseLocationForDataSource:(WebDataSource *)dataSource { }
+
+- (void)locationChangedWithinPageForDataSource:(WebDataSource *)dataSource { }
+
+- (void)clientWillRedirectTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame { }
+- (void)clientRedirectCancelledForFrame:(WebFrame *)frame { }
+
+ at end
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h b/WebKit/WebView.subproj/WebDefaultLocationChangeDelegate.h
similarity index 58%
copy from WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
copy to WebKit/WebView.subproj/WebDefaultLocationChangeDelegate.h
index 42f35bd..e7223e8 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebDefaultLocationChangeDelegate.h
@@ -2,15 +2,16 @@
         WebDefaultPolicyDelegate.h
 	Copyright 2002, Apple Computer, Inc.
 
-        Public header file.
+        Private header file.
 */
 #import <Foundation/Foundation.h>
 
 /*!
-    @class WebDefaultPolicyDelegate
+    @class WebDefaultLocationChangeDelegate
     @discussion WebDefaultPolicyDelegate will be used as a WebController's
     default policy delegate.  It can be subclassed to modify policies. 
 */
- at interface WebDefaultPolicyDelegate : NSObject <WebControllerPolicyDelegate>
+ at interface WebDefaultLocationChangeDelegate : NSObject
++ (WebDefaultLocationChangeDelegate *)sharedLocationChangeDelegate;
 @end
 
diff --git a/WebKit/WebView.subproj/WebDefaultLocationChangeDelegate.m b/WebKit/WebView.subproj/WebDefaultLocationChangeDelegate.m
new file mode 100644
index 0000000..fa665ad
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultLocationChangeDelegate.m
@@ -0,0 +1,43 @@
+/*	
+        WebLocationChangeDelegate.m
+	Copyright 2002, Apple, Inc. All rights reserved.
+*/
+#import <WebFoundation/WebError.h>
+
+#import <WebKit/WebDefaultLocationChangeDelegate.h>
+#import <WebKit/WebDataSource.h>
+#import <WebKit/WebFrame.h>
+
+ at implementation WebDefaultLocationChangeDelegate
+
+static WebDefaultLocationChangeDelegate *sharedDelegate = nil;
+
+// Return a object with vanilla implementations of the protocol's methods
+// Note this feature relies on our default delegate being stateless
++ (WebDefaultLocationChangeDelegate *)sharedLocationChangeDelegate
+{
+    if (!sharedDelegate) {
+        sharedDelegate = [[WebDefaultLocationChangeDelegate alloc] init];
+    }
+    return sharedDelegate;
+}
+
+- (void)locationChangeStartedForDataSource:(WebDataSource *)dataSource { }
+
+- (void)serverRedirectedForDataSource:(WebDataSource *)dataSource { }
+
+- (void)locationChangeCommittedForDataSource:(WebDataSource *)dataSource { }
+
+- (void)receivedPageTitle:(NSString *)title forDataSource:(WebDataSource *)dataSource { }
+- (void)receivedPageIcon:(NSImage *)image forDataSource:(WebDataSource *)dataSource { }
+
+- (void)locationChangeDone:(WebError *)error forDataSource:(WebDataSource *)dataSource { }
+
+- (void)willCloseLocationForDataSource:(WebDataSource *)dataSource { }
+
+- (void)locationChangedWithinPageForDataSource:(WebDataSource *)dataSource { }
+
+- (void)clientWillRedirectTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame { }
+- (void)clientRedirectCancelledForFrame:(WebFrame *)frame { }
+
+ at end
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h b/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
index 42f35bd..4b1c743 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
@@ -2,7 +2,7 @@
         WebDefaultPolicyDelegate.h
 	Copyright 2002, Apple Computer, Inc.
 
-        Public header file.
+        Private header file.
 */
 #import <Foundation/Foundation.h>
 
@@ -11,6 +11,7 @@
     @discussion WebDefaultPolicyDelegate will be used as a WebController's
     default policy delegate.  It can be subclassed to modify policies. 
 */
- at interface WebDefaultPolicyDelegate : NSObject <WebControllerPolicyDelegate>
+ at interface WebDefaultPolicyDelegate : NSObject
++ (WebDefaultPolicyDelegate *)sharedPolicyDelegate;
 @end
 
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m b/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m
index d18844b..8b9dc35 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultPolicyDelegate.m
@@ -18,7 +18,7 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil;
 
 // Return a object with vanilla implementations of the protocol's methods
 // Note this feature relies on our default delegate being stateless
-+ (WebDefaultPolicyDelegate *)_sharedWebPolicyDelegate
++ (WebDefaultPolicyDelegate *)sharedPolicyDelegate
 {
     if (!sharedDelegate) {
         sharedDelegate = [[WebDefaultPolicyDelegate alloc] init];
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegatePrivate.h b/WebKit/WebView.subproj/WebDefaultPolicyDelegatePrivate.h
deleted file mode 100644
index a570890..0000000
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegatePrivate.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-        WebDefaultPolicyDelegatePrivate.h
-	Copyright 2002, Apple Computer, Inc.
- */
-
-#import <Foundation/Foundation.h>
-
-#import "WebDefaultPolicyDelegate.h"
-
- at interface WebDefaultPolicyDelegate (WebPrivate)
-+ (WebDefaultPolicyDelegate *)_sharedWebPolicyDelegate;
- at end
-
diff --git a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h b/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.h
similarity index 59%
copy from WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
copy to WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.h
index 42f35bd..007fdae 100644
--- a/WebKit/WebView.subproj/WebDefaultPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.h
@@ -2,15 +2,16 @@
         WebDefaultPolicyDelegate.h
 	Copyright 2002, Apple Computer, Inc.
 
-        Public header file.
+        Private header file.
 */
 #import <Foundation/Foundation.h>
 
 /*!
-    @class WebDefaultPolicyDelegate
+    @class WebDefaultResourceLoadDelegate
     @discussion WebDefaultPolicyDelegate will be used as a WebController's
     default policy delegate.  It can be subclassed to modify policies. 
 */
- at interface WebDefaultPolicyDelegate : NSObject <WebControllerPolicyDelegate>
+ at interface WebDefaultResourceLoadDelegate : NSObject
++ (WebDefaultResourceLoadDelegate *)sharedResourceLoadDelegate;
 @end
 
diff --git a/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m b/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m
new file mode 100644
index 0000000..447c3eb
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m
@@ -0,0 +1,62 @@
+/*
+     WebDefaultResourceLoadDelegate.m
+     Copyright 2003, Apple, Inc. All rights reserved.
+*/
+
+#import <WebFoundation/WebRequest.h>
+#import <WebFoundation/WebResource.h>
+#import <WebFoundation/WebResponse.h>
+#import <WebFoundation/WebError.h>
+
+#import <WebKit/WebDataSource.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
+#import <WebKit/WebPluginError.h>
+
+
+ at implementation WebDefaultResourceLoadDelegate
+
+static WebDefaultResourceLoadDelegate *sharedDelegate = nil;
+
+// Return a object with vanilla implementations of the protocol's methods
+// Note this feature relies on our default delegate being stateless
++ (WebDefaultResourceLoadDelegate *)sharedResourceLoadDelegate
+{
+    if (!sharedDelegate) {
+        sharedDelegate = [[WebDefaultResourceLoadDelegate alloc] init];
+    }
+    return sharedDelegate;
+}
+
+- identifierForInitialRequest: (WebRequest *)request fromDataSource: (WebDataSource *)dataSource
+{
+    return [[[NSObject alloc] init] autorelease];
+}
+
+-(WebRequest *)resource:identifier willSendRequest: (WebRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
+{
+    return newRequest;
+}
+
+-(void)resource:identifier didReceiveResponse: (WebResponse *)response fromDataSource:(WebDataSource *)dataSource
+{
+}
+
+-(void)resource:identifier didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
+{
+}
+
+-(void)resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
+{
+}
+
+-(void)resource:identifier didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
+{
+}
+
+- (void)pluginFailedWithError:(WebPluginError *)error dataSource:(WebDataSource *)dataSource
+{
+}
+
+ at end
+
+
diff --git a/WebKit/WebView.subproj/WebDefaultUIDelegate.h b/WebKit/WebView.subproj/WebDefaultUIDelegate.h
new file mode 100644
index 0000000..c951702
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultUIDelegate.h
@@ -0,0 +1,13 @@
+/*	
+    WebDefaultPolicyDelegate.h
+    Copyright 2003, Apple Computer, Inc.
+    
+    Private header file.
+*/
+
+#import <Foundation/Foundation.h>
+
+
+ at interface WebDefaultWindowOperationsDelegate : NSObject
++ (WebDefaultWindowOperationsDelegate *)sharedWindowOperationsDelegate;
+ at end
diff --git a/WebKit/WebView.subproj/WebDefaultUIDelegate.m b/WebKit/WebView.subproj/WebDefaultUIDelegate.m
new file mode 100644
index 0000000..ae64c66
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultUIDelegate.m
@@ -0,0 +1,133 @@
+/*	
+    WebDefaultPolicyDelegate.m
+    Copyright 2003, Apple Computer, Inc.
+*/
+#import <Cocoa/Cocoa.h>
+
+#import <WebFoundation/WebRequest.h>
+
+#import <WebKit/WebController.h>
+#import <WebKit/WebDefaultWindowOperationsDelegate.h>
+#import <WebKit/WebWindowOperationsDelegate.h>
+
+
+ at implementation WebDefaultWindowOperationsDelegate
+
+static WebDefaultWindowOperationsDelegate *sharedDelegate = nil;
+
+// Return a object with vanilla implementations of the protocol's methods
+// Note this feature relies on our default delegate being stateless.  This
+// is probably an invalid assumption for the WebWindowOperationsDelegate.
+// If we add any real functionality to this default delegate we probably
+// won't be able to use a singleton.
++ (WebDefaultWindowOperationsDelegate *)sharedWindowOperationsDelegate
+{
+    if (!sharedDelegate) {
+        sharedDelegate = [[WebDefaultWindowOperationsDelegate alloc] init];
+    }
+    return sharedDelegate;
+}
+
+
+- (WebController *)createWindowWithRequest:(WebRequest *)request;
+{
+    return nil;
+}
+
+- (void)showWindow;
+{
+}
+
+- (void)showWindowBehindFrontmost;
+{
+}
+
+- (void)closeWindow;
+{
+}
+
+- (void)focusWindow;
+{
+}
+
+- (void)unfocusWindow;
+{
+}
+
+- (NSResponder *)firstResponderInWindow;
+{
+    return nil;
+}
+
+- (void)makeFirstResponderInWindow:(NSResponder *)responder;
+{
+}
+
+- (void)setStatusText:(NSString *)text;
+{
+}
+
+- (NSString *)statusText;
+{
+    return nil;
+}
+
+- (void)mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(unsigned int)modifierFlags;
+{
+}
+
+- (BOOL)areToolbarsVisible;
+{
+    return NO;
+}
+
+- (void)setToolbarsVisible:(BOOL)visible;
+{
+}
+
+- (BOOL)isStatusBarVisible;
+{
+    return NO;
+}
+
+- (void)setStatusBarVisible:(BOOL)visible;
+{
+}
+
+- (BOOL)isResizable;
+{
+    return NO;
+}
+
+- (void)setResizable:(BOOL)resizable;
+{
+}
+
+- (void)setFrame:(NSRect)frame;
+{
+}
+
+- (NSRect)frame;
+{
+    return NSMakeRect (0,0,0,0);
+}
+
+- (void)runJavaScriptAlertPanelWithMessage:(NSString *)message;
+{
+}
+
+- (BOOL)runJavaScriptConfirmPanelWithMessage:(NSString *)message
+{
+    return NO;
+}
+
+- (NSString *)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText
+{
+    return nil;
+}
+
+- (void)runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
+{
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebDefaultWindowOperationsDelegate.h b/WebKit/WebView.subproj/WebDefaultWindowOperationsDelegate.h
new file mode 100644
index 0000000..c951702
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultWindowOperationsDelegate.h
@@ -0,0 +1,13 @@
+/*	
+    WebDefaultPolicyDelegate.h
+    Copyright 2003, Apple Computer, Inc.
+    
+    Private header file.
+*/
+
+#import <Foundation/Foundation.h>
+
+
+ at interface WebDefaultWindowOperationsDelegate : NSObject
++ (WebDefaultWindowOperationsDelegate *)sharedWindowOperationsDelegate;
+ at end
diff --git a/WebKit/WebView.subproj/WebDefaultWindowOperationsDelegate.m b/WebKit/WebView.subproj/WebDefaultWindowOperationsDelegate.m
new file mode 100644
index 0000000..ae64c66
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDefaultWindowOperationsDelegate.m
@@ -0,0 +1,133 @@
+/*	
+    WebDefaultPolicyDelegate.m
+    Copyright 2003, Apple Computer, Inc.
+*/
+#import <Cocoa/Cocoa.h>
+
+#import <WebFoundation/WebRequest.h>
+
+#import <WebKit/WebController.h>
+#import <WebKit/WebDefaultWindowOperationsDelegate.h>
+#import <WebKit/WebWindowOperationsDelegate.h>
+
+
+ at implementation WebDefaultWindowOperationsDelegate
+
+static WebDefaultWindowOperationsDelegate *sharedDelegate = nil;
+
+// Return a object with vanilla implementations of the protocol's methods
+// Note this feature relies on our default delegate being stateless.  This
+// is probably an invalid assumption for the WebWindowOperationsDelegate.
+// If we add any real functionality to this default delegate we probably
+// won't be able to use a singleton.
++ (WebDefaultWindowOperationsDelegate *)sharedWindowOperationsDelegate
+{
+    if (!sharedDelegate) {
+        sharedDelegate = [[WebDefaultWindowOperationsDelegate alloc] init];
+    }
+    return sharedDelegate;
+}
+
+
+- (WebController *)createWindowWithRequest:(WebRequest *)request;
+{
+    return nil;
+}
+
+- (void)showWindow;
+{
+}
+
+- (void)showWindowBehindFrontmost;
+{
+}
+
+- (void)closeWindow;
+{
+}
+
+- (void)focusWindow;
+{
+}
+
+- (void)unfocusWindow;
+{
+}
+
+- (NSResponder *)firstResponderInWindow;
+{
+    return nil;
+}
+
+- (void)makeFirstResponderInWindow:(NSResponder *)responder;
+{
+}
+
+- (void)setStatusText:(NSString *)text;
+{
+}
+
+- (NSString *)statusText;
+{
+    return nil;
+}
+
+- (void)mouseDidMoveOverElement:(NSDictionary *)elementInformation modifierFlags:(unsigned int)modifierFlags;
+{
+}
+
+- (BOOL)areToolbarsVisible;
+{
+    return NO;
+}
+
+- (void)setToolbarsVisible:(BOOL)visible;
+{
+}
+
+- (BOOL)isStatusBarVisible;
+{
+    return NO;
+}
+
+- (void)setStatusBarVisible:(BOOL)visible;
+{
+}
+
+- (BOOL)isResizable;
+{
+    return NO;
+}
+
+- (void)setResizable:(BOOL)resizable;
+{
+}
+
+- (void)setFrame:(NSRect)frame;
+{
+}
+
+- (NSRect)frame;
+{
+    return NSMakeRect (0,0,0,0);
+}
+
+- (void)runJavaScriptAlertPanelWithMessage:(NSString *)message;
+{
+}
+
+- (BOOL)runJavaScriptConfirmPanelWithMessage:(NSString *)message
+{
+    return NO;
+}
+
+- (NSString *)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText
+{
+    return nil;
+}
+
+- (void)runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
+{
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 7630d3d..4f0f850 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -43,7 +43,7 @@
 
     _private->bridge = [[WebBridge alloc] init];
     [_private->bridge initializeSettings: [c _settings]];
-    [_private->bridge setFrame:self];
+    [_private->bridge setWebFrame:self];
     [_private->bridge setName:n];
 
     [_private setName:n];
@@ -201,11 +201,14 @@
     WebFrame *frame = [self findFrameNamed:name];
 
     if(!frame){
-        WebController *controller = [[[self controller] windowOperationsDelegate]
-                                        createWindowWithRequest:nil];
+        id wd = [[self controller] windowOperationsDelegate];
+        WebController *controller = nil;
+        
+        if ([wd respondsToSelector:@selector(createWindowWithRequest:)])
+            controller = [wd createWindowWithRequest:nil];
         
         [controller _setTopLevelFrameName:name];
-        [[controller windowOperationsDelegate] showWindow];
+        [[controller _windowOperationsDelegateForwarder] showWindow];
         frame = [controller mainFrame];
 	[frame _setJustOpenedForTargetedLink:YES];
     }
diff --git a/WebKit/WebView.subproj/WebFrameLoadDelegate.h b/WebKit/WebView.subproj/WebFrameLoadDelegate.h
index 5d62d89..d5db364 100644
--- a/WebKit/WebView.subproj/WebFrameLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebFrameLoadDelegate.h
@@ -12,10 +12,10 @@
 @class WebFrame;
 
 /*!
-    @protocol WebLocationChangeDelegate
+    @category WebLocationChangeDelegate
     @discussion A controller's WebLocationChangeDelegate track changes its frame's location. 
 */
- at protocol WebLocationChangeDelegate <NSObject>
+ at interface NSObject (WebLocationChangeDelegate)
 
 /*!
     @method locationChangeStartedForDataSource:
@@ -119,13 +119,3 @@
 
 @end
 
-/*!
-    @class WebLocationChangeDelegate
-    @discussion The WebLocationChangeDelegate class responds to all WebLocationChangeDelegate protocol
-    methods by doing nothing. It's provided for the convenience of clients who only want
-    to implement some of the above methods and ignore others.
-*/
- at interface WebLocationChangeDelegate : NSObject <WebLocationChangeDelegate>
-{
-}
- at end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 4d0a4bd..0ca43ab 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -353,7 +353,7 @@ Repeat load of the same URL (by any other means of navigation other than the rel
         }
     }
     if (_private->dataSource) {
-        [[[self controller] locationChangeDelegate] willCloseLocationForDataSource:_private->dataSource];
+        [[[self controller] _locationChangeDelegateForwarder] willCloseLocationForDataSource:_private->dataSource];
     }
 }
 
@@ -644,12 +644,12 @@ Repeat load of the same URL (by any other means of navigation other than the rel
             
             // Tell the client we've committed this URL.
             ASSERT([[self webView] documentView] != nil);
-            [[[self controller] locationChangeDelegate] locationChangeCommittedForDataSource:ds];
+            [[[self controller] _locationChangeDelegateForwarder] locationChangeCommittedForDataSource:ds];
             
             // If we have a title let the controller know about it.
             if (ptitle) {
                 [entry setTitle:ptitle];
-                [[[self controller] locationChangeDelegate] receivedPageTitle:ptitle forDataSource:ds];
+                [[[self controller] _locationChangeDelegateForwarder] receivedPageTitle:ptitle forDataSource:ds];
             }
             break;
         }
@@ -827,7 +827,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
                 if (![pd isLoading]) {
                     LOG(Loading, "%@:  checking complete in WebFrameStateProvisional, load done", [self name]);
 
-                    [[[self controller] locationChangeDelegate] locationChangeDone:[pd mainDocumentError] forDataSource:pd];
+                    [[[self controller] _locationChangeDelegateForwarder] locationChangeDone:[pd mainDocumentError] forDataSource:pd];
 
                     // We know the provisional data source didn't cut the muster, release it.
                     [self _setProvisionalDataSource:nil];
@@ -906,7 +906,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
                     }
                 }
 
-                [[[self controller] locationChangeDelegate] locationChangeDone:[ds mainDocumentError] forDataSource:ds];
+                [[[self controller] _locationChangeDelegateForwarder] locationChangeDone:[ds mainDocumentError] forDataSource:ds];
  
                 //if ([ds isDocumentHTML])
                 //    [[ds representation] part]->closeURL();        
@@ -976,7 +976,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     WebError *error = [WebError errorWithCode:code
                                      inDomain:WebErrorDomainWebKit
                                    failingURL:[URL absoluteString]];
-    [[[self controller] policyDelegate] unableToImplementPolicy:policy error:error forURL:URL inFrame:self];    
+    [[[self controller] _policyDelegateForwarder] unableToImplementPolicy:policy error:error forURL:URL inFrame:self];    
 }
 
 - (void)_clearProvisionalDataSource
@@ -1038,7 +1038,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         [_private setCurrentItem:item];
         [self _restoreScrollPosition];
 
-        [[[self controller] locationChangeDelegate] locationChangedWithinPageForDataSource:_private->dataSource];
+        [[[self controller] _locationChangeDelegateForwarder] locationChangedWithinPageForDataSource:_private->dataSource];
     } else {
         // Remember this item so we can traverse any child items as child frames load
         [_private setProvisionalItem:item];
@@ -1299,7 +1299,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     _private->listener = [listener retain];
     _private->policyFormState = [formState retain];
 
-    [[[self controller] policyDelegate] decideNavigationPolicyForAction:action
+    [[[self controller] _policyDelegateForwarder] decideNavigationPolicyForAction:action
                                                              andRequest:request
                                                                 inFrame:self
                                                        decisionListener:listener];
@@ -1408,7 +1408,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         [self _checkLoadComplete];
     }
 
-    [[[self controller] locationChangeDelegate] locationChangedWithinPageForDataSource:dataSrc];
+    [[[self controller] _locationChangeDelegateForwarder] locationChangedWithinPageForDataSource:dataSrc];
 }
 
 - (void)_addExtraFieldsToRequest:(WebRequest *)request alwaysFromRequest: (BOOL)f
@@ -1561,7 +1561,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 {
     LOG(Redirect, "Client redirect to: %@", URL);
 
-    [[[self controller] locationChangeDelegate] clientWillRedirectTo:URL delay:seconds fireDate:date forFrame:self];
+    [[[self controller] _locationChangeDelegateForwarder] clientWillRedirectTo:URL delay:seconds fireDate:date forFrame:self];
     // If a "quick" redirect comes in an, we set a special mode so we treat the next
     // load as part of the same navigation.
 
@@ -1576,7 +1576,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
 - (void)_clientRedirectCancelled
 {
-    [[[self controller] locationChangeDelegate] clientRedirectCancelledForFrame:self];
+    [[[self controller] _locationChangeDelegateForwarder] clientRedirectCancelledForFrame:self];
     _private->quickRedirectComing = NO;
 }
 
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index 8be711b..ca50a89 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -13,7 +13,6 @@
 @class WebResponse;
 
 @protocol WebResourceDelegate;
- at protocol WebResourceLoadDelegate;
 
 @interface WebBaseResourceHandleDelegate : NSObject <WebResourceDelegate>
 {
@@ -25,8 +24,8 @@
     WebController *controller;
     WebResponse *response;
     id identifier;
-    id <WebResourceLoadDelegate>resourceLoadDelegate;
-    id <WebResourceLoadDelegate>downloadDelegate;
+    id resourceLoadDelegate;
+    id downloadDelegate;
     NSURL *currentURL;
     BOOL reachedTerminalState;
     BOOL defersCallbacks;
@@ -40,8 +39,8 @@
 - (void)setDataSource:(WebDataSource *)d;
 - (WebDataSource *)dataSource;
 
-- (id <WebResourceLoadDelegate>)resourceLoadDelegate;
-- (id <WebResourceLoadDelegate>)downloadDelegate;
+- resourceLoadDelegate;
+- downloadDelegate;
 - (BOOL)isDownload;
 
 - (void)cancel;
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 83e183a..9aea6c3 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -12,8 +12,9 @@
 #import <WebFoundation/WebRequest.h>
 #import <WebFoundation/WebResponse.h>
 
-#import <WebKit/WebController.h>
+#import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebKitErrors.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebStandardPanelsPrivate.h>
@@ -118,12 +119,12 @@
     return dataSource;
 }
 
-- (id <WebResourceLoadDelegate>)resourceLoadDelegate
+- resourceLoadDelegate
 {
     return resourceLoadDelegate;
 }
 
-- (id <WebResourceLoadDelegate>)downloadDelegate
+- downloadDelegate
 {
     return downloadDelegate;
 }
@@ -143,11 +144,17 @@
     if (identifier == nil) {
         // The identifier is released after the last callback, rather than in dealloc
         // to avoid potential cycles.
-        identifier = [[resourceLoadDelegate identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
+        if ([resourceLoadDelegate respondsToSelector: @selector(identifierForInitialRequest:fromDataSource:)])
+            identifier = [[resourceLoadDelegate identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
+        else
+            identifier = [[[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] identifierForInitialRequest:newRequest fromDataSource:dataSource] retain];
     }
 
     if (resourceLoadDelegate) {
-        newRequest = [resourceLoadDelegate resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
+        if ([resourceLoadDelegate respondsToSelector: @selector(resource:willSendRequest:fromDataSource:)])
+            newRequest = [resourceLoadDelegate resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
+        else
+            newRequest = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] resource:identifier willSendRequest:newRequest fromDataSource:dataSource];
     }
 
     // Store a copy of the request.
@@ -186,7 +193,7 @@
         [downloadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
     else {
         [dataSource _addResponse: r];
-        [resourceLoadDelegate resource:identifier didReceiveResponse:r fromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didReceiveResponse:r fromDataSource:dataSource];
     }
 }
 
@@ -198,7 +205,7 @@
     if ([self isDownload])
         [downloadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
     else
-        [resourceLoadDelegate resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didReceiveContentLength:[data length] fromDataSource:dataSource];
 }
 
 - (void)resourceDidFinishLoading:(WebResource *)h
@@ -209,7 +216,7 @@
     if ([self isDownload])
         [downloadDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
     else
-        [resourceLoadDelegate resource:identifier didFinishLoadingFromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didFinishLoadingFromDataSource:dataSource];
 
     ASSERT(currentURL);
     [[WebStandardPanels sharedStandardPanels] _didStopLoadingURL:currentURL inController:controller];
@@ -225,7 +232,7 @@
     if ([self isDownload])
         [downloadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
     else
-        [resourceLoadDelegate resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
+        [[controller _resourceLoadDelegateForwarder] resource:identifier didFailLoadingWithError:result fromDataSource:dataSource];
 
     // currentURL may be nil if the request was aborted
     if (currentURL)
@@ -248,7 +255,7 @@
         if ([self isDownload]) {
             [downloadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
         } else {
-            [resourceLoadDelegate resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
+            [[controller _resourceLoadDelegateForwarder] resource:identifier didFailLoadingWithError:error fromDataSource:dataSource];
         }
     }
 
@@ -278,7 +285,7 @@
                                      inDomain:WebErrorDomainWebKit
                                    failingURL:nil];
     
-    [[self resourceLoadDelegate] resource:identifier
+    [[controller _resourceLoadDelegateForwarder] resource:identifier
                   didFailLoadingWithError:error
                            fromDataSource:dataSource];
 }
diff --git a/WebKit/WebView.subproj/WebLocationChangeDelegate.h b/WebKit/WebView.subproj/WebLocationChangeDelegate.h
index 5d62d89..d5db364 100644
--- a/WebKit/WebView.subproj/WebLocationChangeDelegate.h
+++ b/WebKit/WebView.subproj/WebLocationChangeDelegate.h
@@ -12,10 +12,10 @@
 @class WebFrame;
 
 /*!
-    @protocol WebLocationChangeDelegate
+    @category WebLocationChangeDelegate
     @discussion A controller's WebLocationChangeDelegate track changes its frame's location. 
 */
- at protocol WebLocationChangeDelegate <NSObject>
+ at interface NSObject (WebLocationChangeDelegate)
 
 /*!
     @method locationChangeStartedForDataSource:
@@ -119,13 +119,3 @@
 
 @end
 
-/*!
-    @class WebLocationChangeDelegate
-    @discussion The WebLocationChangeDelegate class responds to all WebLocationChangeDelegate protocol
-    methods by doing nothing. It's provided for the convenience of clients who only want
-    to implement some of the above methods and ignore others.
-*/
- at interface WebLocationChangeDelegate : NSObject <WebLocationChangeDelegate>
-{
-}
- at end
diff --git a/WebKit/WebView.subproj/WebLocationChangeDelegate.m b/WebKit/WebView.subproj/WebLocationChangeDelegate.m
deleted file mode 100644
index 83b30f7..0000000
--- a/WebKit/WebView.subproj/WebLocationChangeDelegate.m
+++ /dev/null
@@ -1,28 +0,0 @@
-/*	
-        WebLocationChangeDelegate.m
-	Copyright 2002, Apple, Inc. All rights reserved.
-*/
-
-#import "WebLocationChangeDelegate.h"
-
- at implementation WebLocationChangeDelegate
-
-- (void)locationChangeStartedForDataSource:(WebDataSource *)dataSource { }
-
-- (void)serverRedirectedForDataSource:(WebDataSource *)dataSource { }
-
-- (void)locationChangeCommittedForDataSource:(WebDataSource *)dataSource { }
-
-- (void)receivedPageTitle:(NSString *)title forDataSource:(WebDataSource *)dataSource { }
-- (void)receivedPageIcon:(NSImage *)image forDataSource:(WebDataSource *)dataSource { }
-
-- (void)locationChangeDone:(WebError *)error forDataSource:(WebDataSource *)dataSource { }
-
-- (void)willCloseLocationForDataSource:(WebDataSource *)dataSource { }
-
-- (void)locationChangedWithinPageForDataSource:(WebDataSource *)dataSource { }
-
-- (void)clientWillRedirectTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame { }
-- (void)clientRedirectCancelledForFrame:(WebFrame *)frame { }
-
- at end
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 1e7d242..4e018f8 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -17,9 +17,6 @@
 @class WebRequest;
 @class WebResponse;
 
- at protocol WebResourceDelegate;
- at protocol WebResourceLoadDelegate;
-
 @interface WebMainResourceClient : WebBaseResourceHandleDelegate
 {
     WebDownload *download;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 73cc334..8f08420 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -7,11 +7,11 @@
 
 #import <WebFoundation/WebCookieConstants.h>
 #import <WebFoundation/WebError.h>
+#import <WebFoundation/WebHTTPRequest.h>
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebNSURLExtras.h>
 #import <WebFoundation/WebResource.h>
 #import <WebFoundation/WebRequest.h>
-#import <WebFoundation/WebHTTPRequest.h>
 #import <WebFoundation/WebResponse.h>
 #import <WebFoundation/WebMutableResponse.h>
 
@@ -19,6 +19,7 @@
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultPolicyDelegate.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebDownloadPrivate.h>
 #import <WebKit/WebFrame.h>
@@ -114,7 +115,7 @@
     // is cleared so the delegate will get false if they ask the frame if it's loading.
     // There's probably a better way to do this, but this should do for now.
     if (keepLoading) {
-        [[[dataSource controller] locationChangeDelegate]
+        [[[dataSource controller] _locationChangeDelegateForwarder]
             locationChangeDone:interruptError forDataSource:dataSource];
     }
 	
@@ -187,7 +188,10 @@
             if (directory != nil && [directory isAbsolutePath]) {
                 path = [directory stringByAppendingPathComponent:[r suggestedFilenameForSaving]];
             } else {
-                path = [[[dataSource controller] policyDelegate] savePathForResponse:r andRequest:req];
+                id pd = [[dataSource controller] policyDelegate];
+                
+                if ([pd respondsToSelector: @selector(savePathForResponse:andRequest:)])
+                    path = [pd savePathForResponse:r andRequest:req];
                 // FIXME: Maybe there a cleaner way handle the bad filename case?
                 if (path == nil || ![path isAbsolutePath]) {
                     ERROR("Nil or non-absolute path returned from savePathForResponse:andRequest:.");
@@ -251,8 +255,15 @@
 
 -(void)checkContentPolicyForResponse:(WebResponse *)r andCallSelector:(SEL)selector
 {
-    WebPolicyAction contentPolicy = 
-	[[[dataSource controller] policyDelegate] contentPolicyForMIMEType:[r contentType]
+    id pd = [[dataSource controller] policyDelegate];
+    WebPolicyAction contentPolicy;
+    
+    if ([pd respondsToSelector:@selector(contentPolicyForMIMEType:andRequest:inFrame:)])
+        contentPolicy = [pd contentPolicyForMIMEType:[r contentType]
+                                                                andRequest:[dataSource request]
+                                                                   inFrame:[dataSource webFrame]];
+    else
+        contentPolicy = [[WebDefaultPolicyDelegate sharedPolicyDelegate] contentPolicyForMIMEType:[r contentType]
                                                                 andRequest:[dataSource request]
                                                                    inFrame:[dataSource webFrame]];
     [self performSelector:selector withObject:(id)contentPolicy withObject:r];
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 1e7d242..4e018f8 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -17,9 +17,6 @@
 @class WebRequest;
 @class WebResponse;
 
- at protocol WebResourceDelegate;
- at protocol WebResourceLoadDelegate;
-
 @interface WebMainResourceClient : WebBaseResourceHandleDelegate
 {
     WebDownload *download;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 73cc334..8f08420 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -7,11 +7,11 @@
 
 #import <WebFoundation/WebCookieConstants.h>
 #import <WebFoundation/WebError.h>
+#import <WebFoundation/WebHTTPRequest.h>
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebNSURLExtras.h>
 #import <WebFoundation/WebResource.h>
 #import <WebFoundation/WebRequest.h>
-#import <WebFoundation/WebHTTPRequest.h>
 #import <WebFoundation/WebResponse.h>
 #import <WebFoundation/WebMutableResponse.h>
 
@@ -19,6 +19,7 @@
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultPolicyDelegate.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebDownloadPrivate.h>
 #import <WebKit/WebFrame.h>
@@ -114,7 +115,7 @@
     // is cleared so the delegate will get false if they ask the frame if it's loading.
     // There's probably a better way to do this, but this should do for now.
     if (keepLoading) {
-        [[[dataSource controller] locationChangeDelegate]
+        [[[dataSource controller] _locationChangeDelegateForwarder]
             locationChangeDone:interruptError forDataSource:dataSource];
     }
 	
@@ -187,7 +188,10 @@
             if (directory != nil && [directory isAbsolutePath]) {
                 path = [directory stringByAppendingPathComponent:[r suggestedFilenameForSaving]];
             } else {
-                path = [[[dataSource controller] policyDelegate] savePathForResponse:r andRequest:req];
+                id pd = [[dataSource controller] policyDelegate];
+                
+                if ([pd respondsToSelector: @selector(savePathForResponse:andRequest:)])
+                    path = [pd savePathForResponse:r andRequest:req];
                 // FIXME: Maybe there a cleaner way handle the bad filename case?
                 if (path == nil || ![path isAbsolutePath]) {
                     ERROR("Nil or non-absolute path returned from savePathForResponse:andRequest:.");
@@ -251,8 +255,15 @@
 
 -(void)checkContentPolicyForResponse:(WebResponse *)r andCallSelector:(SEL)selector
 {
-    WebPolicyAction contentPolicy = 
-	[[[dataSource controller] policyDelegate] contentPolicyForMIMEType:[r contentType]
+    id pd = [[dataSource controller] policyDelegate];
+    WebPolicyAction contentPolicy;
+    
+    if ([pd respondsToSelector:@selector(contentPolicyForMIMEType:andRequest:inFrame:)])
+        contentPolicy = [pd contentPolicyForMIMEType:[r contentType]
+                                                                andRequest:[dataSource request]
+                                                                   inFrame:[dataSource webFrame]];
+    else
+        contentPolicy = [[WebDefaultPolicyDelegate sharedPolicyDelegate] contentPolicyForMIMEType:[r contentType]
                                                                 andRequest:[dataSource request]
                                                                    inFrame:[dataSource webFrame]];
     [self performSelector:selector withObject:(id)contentPolicy withObject:r];
diff --git a/WebKit/WebView.subproj/WebPolicyDelegate.h b/WebKit/WebView.subproj/WebPolicyDelegate.h
index 46d356f..c384f79 100644
--- a/WebKit/WebView.subproj/WebPolicyDelegate.h
+++ b/WebKit/WebView.subproj/WebPolicyDelegate.h
@@ -82,7 +82,7 @@ typedef enum {
 
 
 /*!
-    @protocol WebControllerPolicyDelegate
+    @category WebControllerPolicyDelegate
     @discussion While loading a URL, WebKit asks the WebControllerPolicyDelegate for
     policies that determine the action of what to do with the URL or the data that
     the URL represents. Typically, the policy handler methods are called in this order:
@@ -90,7 +90,7 @@ typedef enum {
     decideNavigationPolicyForAction:andRequest:inFrame:decisionListener:<BR>
     contentPolicyForMIMEType:andRequest:inFrame:<BR>
 */
- at protocol WebControllerPolicyDelegate <NSObject>
+ at interface NSObject (WebControllerPolicyDelegate)
 
 /*!
      @method decideNavigationPolicyForAction:andRequest:inFrame:decisionListener:
diff --git a/WebKit/WebView.subproj/WebResourceLoadDelegate.h b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
index bd93471..360ce8b 100644
--- a/WebKit/WebView.subproj/WebResourceLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
@@ -10,7 +10,7 @@
 @class WebRequest;
 
 /*!
-    @protocol  WebResourceLoadDelegate
+    @category  WebResourceLoadDelegate
     @discussion Implementors of this protocol will receive messages indicating
     that a resource is about to be loaded, data has been received for a resource,
     an error has been received for a resource, and completion of a resource load.
@@ -20,7 +20,7 @@
     resource.  For example, a single resource may generate multiple 
     resource:willSendRequest:fromDataSource: messages as it's URL is redirected.
 */
- at protocol WebResourceLoadDelegate <NSObject>
+ at interface NSObject (WebResourceLoadDelegate)
 
 /*!
     @method identifierForInitialRequest:fromDataSource:
@@ -96,16 +96,4 @@
 
 @end
 
-/*!
-    @class WebResourceLoadDelegate
-    @discussion The WebResourceLoadDelegate class responds to all WebResourceLoadDelegate protocol
-    methods by doing nothing, except for identifierForInitialRequest:fromDataSource: and
-    resource:willSendRequest:fromDataSource:, which return a new NSObject and the 
-    passed-in request, respectively. This class is provided for the convenience of clients who only want
-    to implement some of the WebResourceLoadDelegate protocol methods and ignore others.
-*/
- at interface WebResourceLoadDelegate : NSObject <WebResourceLoadDelegate>
-{
-}
- at end
 
diff --git a/WebKit/WebView.subproj/WebUIDelegate.h b/WebKit/WebView.subproj/WebUIDelegate.h
index dcbd145..aeffb80 100644
--- a/WebKit/WebView.subproj/WebUIDelegate.h
+++ b/WebKit/WebView.subproj/WebUIDelegate.h
@@ -34,13 +34,13 @@
 @class WebController;
 
 /*!
-    @protocol WebWindowOperationsDelegate
+    @category WebWindowOperationsDelegate
     @discussion A class that implements WebWindowOperationsDelegate provides
     window-related methods that may be used by Javascript, plugins and
     other aspects of web pages. These methods are used to open new
     windows and control aspects of existing windows.
 */
- at protocol WebWindowOperationsDelegate <NSObject>
+ at interface NSObject (WebWindowOperationsDelegate)
 
 /*!
     @method createWindowWithRequest:
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 57018bc..ef11400 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -19,12 +19,6 @@
 @class WebPreferences;
 @class WebView;
 
- at protocol WebContextMenuDelegate;
- at protocol WebControllerPolicyDelegate;
- at protocol WebLocationChangeDelegate;
- at protocol WebResourceLoadDelegate;
- at protocol WebWindowOperationsDelegate;
-
 // These strings are keys into the element dictionary provided in
 // the WebContextMenuDelegate's contextMenuItemsForElement and the WebControllerPolicyDelegate's clickPolicyForElement.
 
@@ -115,83 +109,83 @@ extern NSString *WebElementLinkLabelKey;	// NSString of the text within the anch
     @abstract Set the controller's WebWindowOperationsDelegate.
     @param delegate The WebWindowOperationsDelegate to set as the delegate.
 */    
-- (void)setWindowOperationsDelegate: (id<WebWindowOperationsDelegate>)delegate;
+- (void)setWindowOperationsDelegate: (id)delegate;
 
 /*!
     @method windowOperationsDelegate
     @abstract Return the controller's WebWindowOperationsDelegate.
     @result The controller's WebWindowOperationsDelegate.
 */
-- (id<WebWindowOperationsDelegate>)windowOperationsDelegate;
+- (id)windowOperationsDelegate;
 
 /*!
     @method setResourceLoadDelegate:
     @abstract Set the controller's WebResourceLoadDelegate load delegate.
     @param delegate The WebResourceLoadDelegate to set as the load delegate.
 */
-- (void)setResourceLoadDelegate: (id<WebResourceLoadDelegate>)delegate;
+- (void)setResourceLoadDelegate: (id)delegate;
 
 /*!
     @method resourceLoadDelegate
     @result Return the controller's WebResourceLoadDelegate.
 */    
-- (id<WebResourceLoadDelegate>)resourceLoadDelegate;
+- (id)resourceLoadDelegate;
 
 /*!
     @method setDownloadDelegate:
     @abstract Set the controller's WebResourceLoadDelegate download delegate.
     @param delegate The WebResourceLoadDelegate to set as the download delegate.
 */    
-- (void)setDownloadDelegate: (id<WebResourceLoadDelegate>)delegate;
+- (void)setDownloadDelegate: (id)delegate;
 
 /*!
     @method downloadDelegate
     @abstract Return the controller's WebResourceLoadDelegate download delegate.
     @result The controller's WebResourceLoadDelegate download delegate.
 */    
-- (id<WebResourceLoadDelegate>)downloadDelegate;
+- (id)downloadDelegate;
 
 /*!
     @method setContextMenuDelegate:
     @abstract Set the controller's WebContextMenuDelegate.
     @param delegate The WebContextMenuDelegate to set as the delegate.
 */    
-- (void)setContextMenuDelegate: (id<WebContextMenuDelegate>)delegate;
+- (void)setContextMenuDelegate: (id)delegate;
 
 /*!
     @method contextMenuDelegate
     @abstract Return the controller's WebContextMenuDelegate.
     @result The controller's WebContextMenuDelegate.
 */    
-- (id<WebContextMenuDelegate>)contextMenuDelegate;
+- (id)contextMenuDelegate;
 
 /*!
     @method setLocationChangeDelegate:
     @abstract Set the controller's WebLocationChangeDelegate delegate.
     @param delegate The WebLocationChangeDelegate to set as the delegate.
 */    
-- (void)setLocationChangeDelegate:(id <WebLocationChangeDelegate>)delegate;
+- (void)setLocationChangeDelegate: (id)delegate;
 
 /*!
     @method locationChangeDelegate
     @abstract Return the controller's WebLocationChangeDelegate delegate.
     @result The controller's WebLocationChangeDelegate delegate.
 */    
-- (id <WebLocationChangeDelegate>)locationChangeDelegate;
+- (id)locationChangeDelegate;
 
 /*!
     @method setPolicyDelegate:
     @abstract Set the controller's WebControllerPolicyDelegate delegate.
     @param delegate The WebControllerPolicyDelegate to set as the delegate.
 */    
-- (void)setPolicyDelegate: (id<WebControllerPolicyDelegate>)delegate;
+- (void)setPolicyDelegate: (id)delegate;
 
 /*!
     @method policyDelegate
     @abstract Return the controller's WebControllerPolicyDelegate.
     @result The controller's WebControllerPolicyDelegate.
 */    
-- (id<WebControllerPolicyDelegate>)policyDelegate;
+- (id)policyDelegate;
 
 /*!
     @method mainFrame
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 259abab..574436a 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -13,7 +13,7 @@
 #import <WebKit/WebControllerPolicyDelegate.h>
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebDefaultPolicyDelegatePrivate.h>
+#import <WebKit/WebDefaultPolicyDelegate.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebDynamicScrollBarsView.h>
 #import <WebKit/WebException.h>
@@ -52,6 +52,9 @@ NSString *WebElementLinkTargetFrameKey =	@"WebElementTargetFrame";
 NSString *WebElementLinkLabelKey = 		@"WebElementLinkLabel";
 NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 
+
+
+
 @implementation WebController
 
 - init
@@ -111,67 +114,65 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
     return _private->preferences ? _private->preferences : [WebPreferences standardPreferences];
 }
 
-- (void)setWindowOperationsDelegate:(id <WebWindowOperationsDelegate>)delegate
+- (void)setWindowOperationsDelegate:delegate
 {
     _private->windowContext = delegate;
 }
 
-- (id <WebWindowOperationsDelegate>)windowOperationsDelegate
+- windowOperationsDelegate
 {
     return _private->windowContext;
 }
 
-- (void)setResourceLoadDelegate: (id <WebResourceLoadDelegate>)delegate
+- (void)setResourceLoadDelegate: delegate
 {
     _private->resourceProgressDelegate = delegate;
 }
 
 
-- (id<WebResourceLoadDelegate>)resourceLoadDelegate
+- resourceLoadDelegate
 {
     return _private->resourceProgressDelegate;
 }
 
 
-- (void)setDownloadDelegate: (id<WebResourceLoadDelegate>)delegate
+- (void)setDownloadDelegate: delegate
 {
     _private->downloadProgressDelegate = delegate;
 }
 
 
-- (id<WebResourceLoadDelegate>)downloadDelegate
+- downloadDelegate
 {
     return _private->downloadProgressDelegate;
 }
 
-- (void)setContextMenuDelegate: (id<WebContextMenuDelegate>)delegate
+- (void)setContextMenuDelegate: delegate
 {
     _private->contextMenuDelegate = delegate;
 }
 
-- (id<WebContextMenuDelegate>)contextMenuDelegate
+- contextMenuDelegate
 {
     return _private->contextMenuDelegate;
 }
 
-- (void)setPolicyDelegate:(id <WebControllerPolicyDelegate>)delegate
+- (void)setPolicyDelegate:delegate
 {
     _private->policyDelegate = delegate;
 }
 
-- (id<WebControllerPolicyDelegate>)policyDelegate
+- policyDelegate
 {
-    if (!_private->policyDelegate)
-        _private->policyDelegate = [WebDefaultPolicyDelegate _sharedWebPolicyDelegate];
     return _private->policyDelegate;
 }
 
-- (void)setLocationChangeDelegate:(id <WebLocationChangeDelegate>)delegate
+- (void)setLocationChangeDelegate:delegate
 {
     _private->locationChangeDelegate = delegate;
 }
 
-- (id <WebLocationChangeDelegate>)locationChangeDelegate
+- locationChangeDelegate
 {
     return _private->locationChangeDelegate;
 }
@@ -496,37 +497,3 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 }
 
 @end
-
- at implementation WebResourceLoadDelegate
-
-- identifierForInitialRequest: (WebRequest *)request fromDataSource: (WebDataSource *)dataSource
-{
-    return [[[NSObject alloc] init] autorelease];
-}
-
--(WebRequest *)resource:identifier willSendRequest: (WebRequest *)newRequest fromDataSource:(WebDataSource *)dataSource
-{
-    return newRequest;
-}
-
--(void)resource:identifier didReceiveResponse: (WebResponse *)response fromDataSource:(WebDataSource *)dataSource
-{
-}
-
--(void)resource:identifier didReceiveContentLength: (unsigned)length fromDataSource:(WebDataSource *)dataSource
-{
-}
-
--(void)resource:identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource
-{
-}
-
--(void)resource:identifier didFailLoadingWithError:(WebError *)error fromDataSource:(WebDataSource *)dataSource
-{
-}
-
-- (void)pluginFailedWithError:(WebPluginError *)error dataSource:(WebDataSource *)dataSource
-{
-}
-
- at end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 0670a53..4aabba5 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -15,20 +15,22 @@
 typedef enum { Safari, MacIE, WinIE } UserAgentStringType;
 enum { NumUserAgentStringTypes = WinIE + 1 };
 
+#define NUM_LOCATION_CHANGE_DELEGATE_SELECTORS	10
+
 @interface WebControllerPrivate : NSObject
 {
 @public
     WebFrame *mainFrame;
     
-    id <WebWindowOperationsDelegate> windowContext;
-    id <WebResourceLoadDelegate> resourceProgressDelegate;
-    id <WebResourceLoadDelegate> downloadProgressDelegate;
-    id <WebContextMenuDelegate> contextMenuDelegate;
-    id <WebControllerPolicyDelegate> policyDelegate;
-    id <WebLocationChangeDelegate> locationChangeDelegate;
+    id windowContext;
+    id resourceProgressDelegate;
+    id downloadProgressDelegate;
+    id contextMenuDelegate;
+    id policyDelegate;
+    id locationChangeDelegate;
     id <WebFormDelegate> formDelegate;
     
-    id <WebContextMenuDelegate> defaultContextMenuDelegate;
+    id defaultContextMenuDelegate;
 
     WebBackForwardList *backForwardList;
     BOOL useBackForwardList;
@@ -46,7 +48,7 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 
     WebPreferences *preferences;
     WebCoreSettings *settings;
-    
+        
     BOOL lastElementWasNonNil;
 }
 @end
@@ -55,7 +57,6 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 
 - (WebFrame *)_createFrameNamed:(NSString *)name inParent:(WebFrame *)parent allowsScrolling:(BOOL)allowsScrolling;
 
-- (id <WebContextMenuDelegate>)_defaultContextMenuDelegate;
 - (void)_finishedLoadingResourceFromDataSource:(WebDataSource *)dataSource;
 - (void)_receivedError:(WebError *)error fromDataSource:(WebDataSource *)dataSource;
 - (void)_mainReceivedBytesSoFar:(unsigned)bytesSoFar fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete;
@@ -85,4 +86,19 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 - (WebCoreSettings *)_settings;
 - (void)_updateWebCoreSettingsFromPreferences: (WebPreferences *)prefs;
 
+- _locationChangeDelegateForwarder;
+- _resourceLoadDelegateForwarder;
+- _policyDelegateForwarder;
+- _contextMenuDelegateForwarder;
+- _windowOperationsDelegateForwarder;
 @end
+
+ at interface _WebSafeForwarder : NSObject
+{
+    id target;	// Non-retainted.  Don't retain delegates;
+    id defaultTarget;
+    Class templateClass;
+}
++ safeForwarderWithTarget: t defaultTarget: dt templateClass: (Class)aClass;
+ at end
+
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 5f1a234..99358a7 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -5,12 +5,17 @@
 
 #import <WebKit/WebBackForwardList.h>
 #import <WebKit/WebContextMenuDelegate.h>
-#import <WebKit/WebFormDelegatePrivate.h>
 #import <WebKit/WebControllerPrivate.h>
 #import <WebKit/WebControllerSets.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebDefaultContextMenuDelegate.h>
+#import <WebKit/WebDefaultLocationChangeDelegate.h>
+#import <WebKit/WebDefaultPolicyDelegate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
+#import <WebKit/WebDefaultWindowOperationsDelegate.h>
+#import <WebKit/WebFormDelegatePrivate.h>
 #import <WebKit/WebFramePrivate.h>
+#import <WebKit/WebLocationChangeDelegate.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebStandardPanelsPrivate.h>
@@ -107,11 +112,6 @@
     return newFrame;
 }
 
-- (id<WebContextMenuDelegate>)_defaultContextMenuDelegate
-{
-    return _private->defaultContextMenuDelegate;
-}
-
 - (void)_finishedLoadingResourceFromDataSource: (WebDataSource *)dataSource
 {
     WebFrame *frame = [dataSource webFrame];
@@ -298,11 +298,17 @@
 
 - (WebController *)_openNewWindowWithRequest:(WebRequest *)request behind:(BOOL)behind
 {
-    WebController *newWindowController = [[self windowOperationsDelegate] createWindowWithRequest:request];
+    id wd = [self windowOperationsDelegate];
+    WebController *newWindowController = nil;
+    if ([wd respondsToSelector:@selector(createWindowWithRequest:)])
+        newWindowController = [wd createWindowWithRequest:request];
+    else {
+        [[WebDefaultWindowOperationsDelegate sharedWindowOperationsDelegate] createWindowWithRequest: request];
+    }
     if (behind) {
-        [[newWindowController windowOperationsDelegate] showWindowBehindFrontmost];
+        [[newWindowController _windowOperationsDelegateForwarder] showWindowBehindFrontmost];
     } else {
-        [[newWindowController windowOperationsDelegate] showWindow];
+        [[newWindowController _windowOperationsDelegateForwarder] showWindow];
     }
     return newWindowController;
 }
@@ -316,9 +322,14 @@
     unsigned i;
 
     if (_private->contextMenuDelegate) {
-        menuItems = [_private->contextMenuDelegate contextMenuItemsForElement:element
-                                                             defaultMenuItems:defaultMenuItems];
-    } else {
+        id cd = _private->contextMenuDelegate;
+        
+        if ([cd respondsToSelector:@selector(contextMenuItemsForElement:defaultMenuItems:)])
+            menuItems = [cd contextMenuItemsForElement:element defaultMenuItems:defaultMenuItems];
+        else
+            menuItems = [[WebDefaultContextMenuDelegate sharedContextMenuDelegate] contextMenuItemsForElement:element defaultMenuItems:defaultMenuItems];
+    } 
+    else {
         menuItems = defaultMenuItems;
     }
 
@@ -340,7 +351,7 @@
     // for that case.
     
     if (dictionary && _private->lastElementWasNonNil) {
-        [[self windowOperationsDelegate] mouseDidMoveOverElement:dictionary modifierFlags:modifierFlags];
+        [[self _windowOperationsDelegateForwarder] mouseDidMoveOverElement:dictionary modifierFlags:modifierFlags];
     }
     _private->lastElementWasNonNil = dictionary != nil;
 }
@@ -407,4 +418,65 @@
     [self _updateWebCoreSettingsFromPreferences: preferences];
 }
 
+- _locationChangeDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self locationChangeDelegate]  defaultTarget: [WebDefaultLocationChangeDelegate sharedLocationChangeDelegate] templateClass: [WebDefaultLocationChangeDelegate class]];
+}
+
+- _resourceLoadDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self resourceLoadDelegate] defaultTarget: [WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] templateClass: [WebDefaultResourceLoadDelegate class]];
+}
+
+- _policyDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self policyDelegate] defaultTarget: [WebDefaultPolicyDelegate sharedPolicyDelegate] templateClass: [WebDefaultPolicyDelegate class]];
+}
+
+- _contextMenuDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self contextMenuDelegate] defaultTarget: [WebDefaultContextMenuDelegate sharedContextMenuDelegate] templateClass: [WebDefaultContextMenuDelegate class]];
+}
+
+- _windowOperationsDelegateForwarder
+{
+    return [_WebSafeForwarder safeForwarderWithTarget: [self windowOperationsDelegate] defaultTarget: [WebDefaultWindowOperationsDelegate sharedWindowOperationsDelegate] templateClass: [WebDefaultWindowOperationsDelegate class]];
+}
+
+ at end
+
+
+ at implementation _WebSafeForwarder
+
+- initWithTarget: t defaultTarget: dt templateClass: (Class)aClass
+{
+    [super init];
+    target = t;		// Non retained.
+    defaultTarget = dt;
+    templateClass = aClass;
+    return self;
+}
+
+
+// Used to send messages to delegates that implement informal protocols.
++ safeForwarderWithTarget: t defaultTarget: dt templateClass: (Class)aClass;
+{
+    return [[[_WebSafeForwarder alloc] initWithTarget: t defaultTarget: dt templateClass: aClass] autorelease];
+}
+
+- (void)forwardInvocation:(NSInvocation *)anInvocation
+{
+    if ([target respondsToSelector: [anInvocation selector]])
+        [anInvocation invokeWithTarget: target];
+    else if ([defaultTarget respondsToSelector: [anInvocation selector]])
+        [anInvocation invokeWithTarget: defaultTarget];
+    // Do nothing quietly if method not implemented.
+}
+
+- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
+{
+    return [templateClass instanceMethodSignatureForSelector: aSelector];
+}
+
 @end
+
diff --git a/WebKit/WebView.subproj/WebWindowOperationsDelegate.h b/WebKit/WebView.subproj/WebWindowOperationsDelegate.h
index dcbd145..aeffb80 100644
--- a/WebKit/WebView.subproj/WebWindowOperationsDelegate.h
+++ b/WebKit/WebView.subproj/WebWindowOperationsDelegate.h
@@ -34,13 +34,13 @@
 @class WebController;
 
 /*!
-    @protocol WebWindowOperationsDelegate
+    @category WebWindowOperationsDelegate
     @discussion A class that implements WebWindowOperationsDelegate provides
     window-related methods that may be used by Javascript, plugins and
     other aspects of web pages. These methods are used to open new
     windows and control aspects of existing windows.
 */
- at protocol WebWindowOperationsDelegate <NSObject>
+ at interface NSObject (WebWindowOperationsDelegate)
 
 /*!
     @method createWindowWithRequest:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list