[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:39:34 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 20b29b1e4922eb89b77fb10c3a5f5df94e265804
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Apr 30 23:15:59 2003 +0000
Reviewed by Darin.
Changed things to use WebAuthenticationChallenge for
WebResoureceLoadDelegate auth callbacks.
* Panels.subproj/WebPanelAuthenticationHandler.m:
(-[WebPanelAuthenticationHandler startAuthentication:window:]):
(-[WebPanelAuthenticationHandler _authenticationDoneWithChallenge:result:]):
* WebKit.exp:
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebAuthenticationChallenge.h: Added.
* WebView.subproj/WebAuthenticationChallenge.m: Added.
(-[WebAuthenticationChallengeInternal initWithDelegate:]):
(-[WebAuthenticationChallengeInternal dealloc]):
(-[WebAuthenticationChallenge _initWithAuthenticationChallenge:delegate:]):
(-[WebAuthenticationChallenge dealloc]):
(-[WebAuthenticationChallenge useCredential:]):
(-[WebAuthenticationChallenge cancel]):
(-[WebAuthenticationChallenge continueWithoutCredential]):
* WebView.subproj/WebAuthenticationChallengeInternal.h: Added.
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate connection:didReceiveAuthenticationChallenge:]):
(-[WebBaseResourceHandleDelegate connection:didCancelAuthenticationChallenge:]):
(-[WebBaseResourceHandleDelegate useCredential:forAuthenticationChallenge:]):
(-[WebBaseResourceHandleDelegate continueWithoutCredentialForAuthenticationChallenge:]):
(-[WebBaseResourceHandleDelegate cancelWithError:]):
* WebView.subproj/WebDefaultResourceLoadDelegate.m:
(-[WebDefaultResourceLoadDelegate webView:resource:didReceiveAuthenticationChallenge:fromDataSource:]):
(-[WebDefaultResourceLoadDelegate webView:resource:didCancelAuthenticationChallenge:fromDataSource:]):
* WebView.subproj/WebResourceLoadDelegate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4226 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1de31f8..d760d6a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,6 +1,40 @@
2003-04-30 Maciej Stachowiak <mjs at apple.com>
Reviewed by Darin.
+
+ Changed things to use WebAuthenticationChallenge for
+ WebResoureceLoadDelegate auth callbacks.
+
+ * Panels.subproj/WebPanelAuthenticationHandler.m:
+ (-[WebPanelAuthenticationHandler startAuthentication:window:]):
+ (-[WebPanelAuthenticationHandler _authenticationDoneWithChallenge:result:]):
+ * WebKit.exp:
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebAuthenticationChallenge.h: Added.
+ * WebView.subproj/WebAuthenticationChallenge.m: Added.
+ (-[WebAuthenticationChallengeInternal initWithDelegate:]):
+ (-[WebAuthenticationChallengeInternal dealloc]):
+ (-[WebAuthenticationChallenge _initWithAuthenticationChallenge:delegate:]):
+ (-[WebAuthenticationChallenge dealloc]):
+ (-[WebAuthenticationChallenge useCredential:]):
+ (-[WebAuthenticationChallenge cancel]):
+ (-[WebAuthenticationChallenge continueWithoutCredential]):
+ * WebView.subproj/WebAuthenticationChallengeInternal.h: Added.
+ * WebView.subproj/WebBaseResourceHandleDelegate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate connection:didReceiveAuthenticationChallenge:]):
+ (-[WebBaseResourceHandleDelegate connection:didCancelAuthenticationChallenge:]):
+ (-[WebBaseResourceHandleDelegate useCredential:forAuthenticationChallenge:]):
+ (-[WebBaseResourceHandleDelegate continueWithoutCredentialForAuthenticationChallenge:]):
+ (-[WebBaseResourceHandleDelegate cancelWithError:]):
+ * WebView.subproj/WebDefaultResourceLoadDelegate.m:
+ (-[WebDefaultResourceLoadDelegate webView:resource:didReceiveAuthenticationChallenge:fromDataSource:]):
+ (-[WebDefaultResourceLoadDelegate webView:resource:didCancelAuthenticationChallenge:fromDataSource:]):
+ * WebView.subproj/WebResourceLoadDelegate.h:
+
+2003-04-30 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Darin.
Converted download code to use an
NSURLDownloadAuthenticationChallenge rather than a vanilla
diff --git a/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m b/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m
index bf62585..00480fa 100644
--- a/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m
+++ b/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m
@@ -6,10 +6,10 @@
#import <WebKit/WebPanelAuthenticationHandler.h>
+#import <WebKit/WebAuthenticationChallenge.h>
#import <WebKit/WebAuthenticationPanel.h>
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebNSDictionaryExtras.h>
-#import <WebFoundation/NSURLConnectionAuthenticationChallenge.h>
#import <WebFoundation/NSURLDownloadAuthenticationChallenge.h>
static NSString *WebModalDialogPretendWindow = @"WebModalDialogPretendWindow";
@@ -46,7 +46,7 @@ WebPanelAuthenticationHandler *sharedHandler;
-(void)startAuthentication:(NSURLAuthenticationChallenge *)challenge window:(NSWindow *)w
{
- ASSERT([challenge isKindOfClass:[NSURLConnectionAuthenticationChallenge class]] ||
+ ASSERT([challenge isKindOfClass:[WebAuthenticationChallenge class]] ||
[challenge isKindOfClass:[NSURLDownloadAuthenticationChallenge class]]);
if ([w attachedSheet] != nil) {
@@ -56,9 +56,9 @@ WebPanelAuthenticationHandler *sharedHandler;
id window = w ? (id)w : (id)WebModalDialogPretendWindow;
if ([windowToPanel objectForKey:window] != nil) {
- if ([challenge isKindOfClass:[NSURLConnectionAuthenticationChallenge class]]) {
- NSURLConnectionAuthenticationChallenge *connectionChallenge = (NSURLConnectionAuthenticationChallenge *)challenge;
- [[connectionChallenge connection] cancel];
+ if ([challenge isKindOfClass:[WebAuthenticationChallenge class]]) {
+ WebAuthenticationChallenge *webChallenge = (WebAuthenticationChallenge *)challenge;
+ [webChallenge cancel];
} else if ([challenge isKindOfClass:[NSURLDownloadAuthenticationChallenge class]]) {
NSURLDownloadAuthenticationChallenge *downloadChallenge = (NSURLDownloadAuthenticationChallenge *)challenge;
[[downloadChallenge download] cancel];
@@ -89,7 +89,7 @@ WebPanelAuthenticationHandler *sharedHandler;
}
}
--(void)_authenticationDoneWithChallenge:(NSURLConnectionAuthenticationChallenge *)challenge result:(NSURLCredential *)credential
+-(void)_authenticationDoneWithChallenge:(NSURLAuthenticationChallenge *)challenge result:(NSURLCredential *)credential
{
id window = [challengeToWindow objectForKey:challenge];
if (window != nil) {
@@ -97,13 +97,13 @@ WebPanelAuthenticationHandler *sharedHandler;
[challengeToWindow removeObjectForKey:challenge];
}
- if ([challenge isKindOfClass:[NSURLConnectionAuthenticationChallenge class]]) {
- NSURLConnectionAuthenticationChallenge *connectionChallenge = (NSURLConnectionAuthenticationChallenge *)challenge;
+ if ([challenge isKindOfClass:[WebAuthenticationChallenge class]]) {
+ WebAuthenticationChallenge *webChallenge = (WebAuthenticationChallenge *)challenge;
if (credential == nil) {
- [[connectionChallenge connection] cancel];
+ [webChallenge cancel];
} else {
- [[connectionChallenge connection] useCredential:credential forAuthenticationChallenge:connectionChallenge];
+ [webChallenge useCredential:credential];
}
} else if ([challenge isKindOfClass:[NSURLDownloadAuthenticationChallenge class]]) {
NSURLDownloadAuthenticationChallenge *downloadChallenge = (NSURLDownloadAuthenticationChallenge *)challenge;
diff --git a/WebKit/WebKit.exp b/WebKit/WebKit.exp
index 1debc0c..73643aa 100644
--- a/WebKit/WebKit.exp
+++ b/WebKit/WebKit.exp
@@ -1,3 +1,4 @@
+.objc_class_name_WebAuthenticationChallenge
.objc_class_name_WebBackForwardList
.objc_class_name_WebCoreStatistics
.objc_class_name_WebDataSource
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 365b9ae..91e1610 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -293,6 +293,7 @@
515E27D10458CA4B00CA2D3A,
65840820045E752600000128,
6578F5E0045F817400000128,
+ 650EFE54045FCE6C00000128,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -404,6 +405,7 @@
70ECD6CF043B727400A80181,
515E27D20458CA4B00CA2D3A,
6578F5E1045F817400000128,
+ 65FB4D49045FCD7F00000128,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -1384,6 +1386,18 @@
//652
//653
//654
+ 650EFE53045FCE6C00000128 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ path = WebAuthenticationChallengeInternal.h;
+ refType = 4;
+ };
+ 650EFE54045FCE6C00000128 = {
+ fileRef = 650EFE53045FCE6C00000128;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
6523FACF032DA06B005EFCFF = {
fileEncoding = 4;
isa = PBXFileReference;
@@ -1601,6 +1615,21 @@
fileRef = 6584081F045E752600000128;
isa = PBXBuildFile;
settings = {
+ ATTRIBUTES = (
+ Public,
+ );
+ };
+ };
+ 65FB4D47045FCD7F00000128 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ path = WebAuthenticationChallenge.m;
+ refType = 4;
+ };
+ 65FB4D49045FCD7F00000128 = {
+ fileRef = 65FB4D47045FCD7F00000128;
+ isa = PBXBuildFile;
+ settings = {
};
};
//650
@@ -2258,6 +2287,7 @@
9CF0E24A021361B00ECA16EA,
51A8B52E04282B5900CA2D3A,
51A8B52F04282B5900CA2D3A,
+ 650EFE53045FCE6C00000128,
51A8B53204282BD200CA2D3A,
51A8B53304282BD200CA2D3A,
F5D538E802441F2601A80181,
@@ -2275,6 +2305,7 @@
51A8B57D0428353A00CA2D3A,
51A8B57E0428353A00CA2D3A,
6584081F045E752600000128,
+ 65FB4D47045FCD7F00000128,
);
isa = PBXGroup;
name = WebView;
diff --git a/WebKit/WebView.subproj/WebAuthenticationChallenge.h b/WebKit/WebView.subproj/WebAuthenticationChallenge.h
new file mode 100644
index 0000000..a8dc075
--- /dev/null
+++ b/WebKit/WebView.subproj/WebAuthenticationChallenge.h
@@ -0,0 +1,20 @@
+/*
+ WebAuthenticationChallenge.h
+ Copyright 2003 Apple, Inc. All rights reserved.
+*/
+
+#import <WebFoundation/NSURLAuthenticationChallenge.h>
+
+ at class WebAuthenticationChallengeInternal;
+
+ at interface WebAuthenticationChallenge : NSURLAuthenticationChallenge
+{
+ at private
+ WebAuthenticationChallengeInternal *_webInternal;
+}
+
+- (void)useCredential:(NSURLCredential *)credential;
+- (void)cancel;
+- (void)continueWithoutCredential;
+
+ at end
diff --git a/WebKit/WebView.subproj/WebAuthenticationChallenge.m b/WebKit/WebView.subproj/WebAuthenticationChallenge.m
new file mode 100644
index 0000000..c3106de
--- /dev/null
+++ b/WebKit/WebView.subproj/WebAuthenticationChallenge.m
@@ -0,0 +1,77 @@
+/*
+ WebAuthenticationChallenge.m
+ Copyright 2003 Apple, Inc. All rights reserved.
+*/
+
+
+#import <WebKit/WebAuthenticationChallenge.h>
+#import <WebKit/WebAuthenticationChallengeInternal.h>
+#import <WebKit/WebBaseResourceHandleDelegate.h>
+
+ at interface WebAuthenticationChallengeInternal : NSObject
+{
+ at public
+ WebBaseResourceHandleDelegate *delegate;
+}
+
+- (id)initWithDelegate:(WebBaseResourceHandleDelegate *)d;
+ at end
+
+ at implementation WebAuthenticationChallengeInternal
+
+- (id)initWithDelegate:(WebBaseResourceHandleDelegate *)d
+{
+ self = [super init];
+ if (self != nil) {
+ delegate = [d retain];
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ [delegate release];
+ [super dealloc];
+}
+
+ at end
+
+
+ at implementation WebAuthenticationChallenge (Internal)
+
+- (id)_initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge delegate:(WebBaseResourceHandleDelegate *)delegate
+{
+ self = [super initWithAuthenticationChallenge:challenge];
+ if (self != nil) {
+ _webInternal = [[WebAuthenticationChallengeInternal alloc] initWithDelegate:delegate];
+ }
+ return self;
+}
+
+ at end
+
+ at implementation WebAuthenticationChallenge
+
+- (void)dealloc
+{
+ [_webInternal release];
+ [super dealloc];
+}
+
+- (void)useCredential:(NSURLCredential *)credential
+{
+ [_webInternal->delegate useCredential:credential forAuthenticationChallenge:self];
+}
+
+- (void)cancel
+{
+ [_webInternal->delegate cancel];
+
+}
+
+- (void)continueWithoutCredential
+{
+ [_webInternal->delegate continueWithoutCredentialForAuthenticationChallenge:self];
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebAuthenticationChallengeInternal.h b/WebKit/WebView.subproj/WebAuthenticationChallengeInternal.h
new file mode 100644
index 0000000..5662c83
--- /dev/null
+++ b/WebKit/WebView.subproj/WebAuthenticationChallengeInternal.h
@@ -0,0 +1,14 @@
+/*
+ WebAuthenticationChallengeInternal.h
+ Copyright 2003 Apple, Inc. All rights reserved.
+*/
+
+#import <WebKit/WebAuthenticationChallenge.h>
+
+ at class WebBaseResourceHandleDelegate;
+
+ at interface WebAuthenticationChallenge (Internal)
+
+- (id)_initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge delegate:(WebBaseResourceHandleDelegate *)delegate;
+
+ at end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index 20cd6dd..0fb77c8 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -8,11 +8,14 @@
#import <WebKit/WebViewPrivate.h>
@class NSError;
- at class WebView;
- at class WebDataSource;
@class NSURLConnection;
+ at class NSURLConnectionAuthenticationChallenge;
+ at class NSURLCredential;
@class NSURLRequest;
@class NSURLResponse;
+ at class WebAuthenticationChallenge;
+ at class WebDataSource;
+ at class WebView;
@interface WebBaseResourceHandleDelegate : NSObject
{
@@ -26,6 +29,8 @@
id identifier;
id resourceLoadDelegate;
id downloadDelegate;
+ NSURLConnectionAuthenticationChallenge *currentConnectionChallenge;
+ WebAuthenticationChallenge *currentWebChallenge;
BOOL reachedTerminalState;
BOOL defersCallbacks;
WebResourceDelegateImplementationCache implementations;
@@ -49,4 +54,8 @@
- (void)setIdentifier: ident;
+-(void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(WebAuthenticationChallenge *)challenge;
+
+-(void)continueWithoutCredentialForAuthenticationChallenge:(WebAuthenticationChallenge *)challenge;
+
@end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index a6135b6..4919824 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -6,6 +6,7 @@
#import <WebKit/WebBaseResourceHandleDelegate.h>
#import <WebFoundation/NSURLConnection.h>
+#import <WebFoundation/NSURLConnectionAuthenticationChallenge.h>
#import <WebFoundation/NSURLConnectionPrivate.h>
#import <WebFoundation/NSURLRequest.h>
#import <WebFoundation/NSURLRequestPrivate.h>
@@ -14,6 +15,8 @@
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebNSErrorExtras.h>
+#import <WebKit/WebAuthenticationChallenge.h>
+#import <WebKit/WebAuthenticationChallengeInternal.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultResourceLoadDelegate.h>
@@ -183,10 +186,17 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
- if (implementations.delegateImplementsDidReceiveAuthenticationChallenge)
- [resourceLoadDelegate webView:controller resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:dataSource];
- else
- [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:dataSource];
+ ASSERT(!currentConnectionChallenge);
+ ASSERT(!currentWebChallenge);
+
+ currentConnectionChallenge = [challenge retain];;
+ currentWebChallenge = [[WebAuthenticationChallenge alloc] _initWithAuthenticationChallenge:challenge delegate:self];
+
+ if (implementations.delegateImplementsDidReceiveAuthenticationChallenge) {
+ [resourceLoadDelegate webView:controller resource:identifier didReceiveAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ } else {
+ [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didReceiveAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ }
}
-(void)connection:(NSURLConnection *)con didCancelAuthenticationChallenge:(NSURLConnectionAuthenticationChallenge *)challenge
@@ -194,10 +204,46 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
- if (implementations.delegateImplementsDidCancelAuthenticationChallenge)
- [resourceLoadDelegate webView:controller resource:identifier didCancelAuthenticationChallenge:challenge fromDataSource:dataSource];
- else
- [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didCancelAuthenticationChallenge:challenge fromDataSource:dataSource];
+ ASSERT(currentConnectionChallenge);
+ ASSERT(currentWebChallenge);
+ ASSERT(currentConnectionChallenge = challenge);
+
+ if (implementations.delegateImplementsDidCancelAuthenticationChallenge) {
+ [resourceLoadDelegate webView:controller resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ } else {
+ [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ }
+}
+
+
+-(void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(WebAuthenticationChallenge *)challenge
+{
+ if (challenge == nil || challenge != currentWebChallenge) {
+ return;
+ }
+
+ [[currentConnectionChallenge connection] useCredential:credential forAuthenticationChallenge:currentConnectionChallenge];
+
+ [currentConnectionChallenge release];
+ currentConnectionChallenge = nil;
+
+ [currentWebChallenge release];
+ currentWebChallenge = nil;
+}
+
+-(void)continueWithoutCredentialForAuthenticationChallenge:(WebAuthenticationChallenge *)challenge
+{
+ if (challenge == nil || challenge != currentWebChallenge) {
+ return;
+ }
+
+ [[currentConnectionChallenge connection] continueWithoutCredentialForAuthenticationChallenge:currentConnectionChallenge];
+
+ [currentConnectionChallenge release];
+ currentConnectionChallenge = nil;
+
+ [currentWebChallenge release];
+ currentWebChallenge = nil;
}
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)r
@@ -265,6 +311,12 @@
{
ASSERT(!reachedTerminalState);
+ [currentConnectionChallenge release];
+ currentConnectionChallenge = nil;
+
+ [currentWebChallenge release];
+ currentWebChallenge = nil;
+
[connection cancel];
if (error) {
@@ -296,4 +348,5 @@
}
}
+
@end
diff --git a/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m b/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m
index e469235..f70197b 100644
--- a/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m
@@ -11,6 +11,7 @@
#import <WebFoundation/NSURLResponse.h>
#import <WebFoundation/WebNSErrorExtras.h>
+#import <WebKit/WebAuthenticationChallenge.h>
#import <WebKit/WebDataSource.h>
#import <WebKit/WebPanelAuthenticationHandler.h>
#import <WebKit/WebView.h>
@@ -40,18 +41,17 @@ static WebDefaultResourceLoadDelegate *sharedDelegate = nil;
return newRequest;
}
-- (void)webView:(WebView *)wv resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLConnectionAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
+- (void)webView:(WebView *)wv resource:(id)identifier didReceiveAuthenticationChallenge:(WebAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
{
NSWindow *window = [wv hostWindow] ? [wv hostWindow] : [wv window];
[[WebPanelAuthenticationHandler sharedHandler] startAuthentication:challenge window:window];
}
-- (void)webView:(WebView *)wv resource:(id)identifier didCancelAuthenticationChallenge:(NSURLConnectionAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
+- (void)webView:(WebView *)wv resource:(id)identifier didCancelAuthenticationChallenge:(WebAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
{
[(WebPanelAuthenticationHandler *)[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:challenge];
}
-
-(void)webView: (WebView *)wv resource:identifier didReceiveResponse: (NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource
{
}
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index 20cd6dd..0fb77c8 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -8,11 +8,14 @@
#import <WebKit/WebViewPrivate.h>
@class NSError;
- at class WebView;
- at class WebDataSource;
@class NSURLConnection;
+ at class NSURLConnectionAuthenticationChallenge;
+ at class NSURLCredential;
@class NSURLRequest;
@class NSURLResponse;
+ at class WebAuthenticationChallenge;
+ at class WebDataSource;
+ at class WebView;
@interface WebBaseResourceHandleDelegate : NSObject
{
@@ -26,6 +29,8 @@
id identifier;
id resourceLoadDelegate;
id downloadDelegate;
+ NSURLConnectionAuthenticationChallenge *currentConnectionChallenge;
+ WebAuthenticationChallenge *currentWebChallenge;
BOOL reachedTerminalState;
BOOL defersCallbacks;
WebResourceDelegateImplementationCache implementations;
@@ -49,4 +54,8 @@
- (void)setIdentifier: ident;
+-(void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(WebAuthenticationChallenge *)challenge;
+
+-(void)continueWithoutCredentialForAuthenticationChallenge:(WebAuthenticationChallenge *)challenge;
+
@end
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index a6135b6..4919824 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -6,6 +6,7 @@
#import <WebKit/WebBaseResourceHandleDelegate.h>
#import <WebFoundation/NSURLConnection.h>
+#import <WebFoundation/NSURLConnectionAuthenticationChallenge.h>
#import <WebFoundation/NSURLConnectionPrivate.h>
#import <WebFoundation/NSURLRequest.h>
#import <WebFoundation/NSURLRequestPrivate.h>
@@ -14,6 +15,8 @@
#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebNSErrorExtras.h>
+#import <WebKit/WebAuthenticationChallenge.h>
+#import <WebKit/WebAuthenticationChallengeInternal.h>
#import <WebKit/WebDataProtocol.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultResourceLoadDelegate.h>
@@ -183,10 +186,17 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
- if (implementations.delegateImplementsDidReceiveAuthenticationChallenge)
- [resourceLoadDelegate webView:controller resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:dataSource];
- else
- [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:dataSource];
+ ASSERT(!currentConnectionChallenge);
+ ASSERT(!currentWebChallenge);
+
+ currentConnectionChallenge = [challenge retain];;
+ currentWebChallenge = [[WebAuthenticationChallenge alloc] _initWithAuthenticationChallenge:challenge delegate:self];
+
+ if (implementations.delegateImplementsDidReceiveAuthenticationChallenge) {
+ [resourceLoadDelegate webView:controller resource:identifier didReceiveAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ } else {
+ [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didReceiveAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ }
}
-(void)connection:(NSURLConnection *)con didCancelAuthenticationChallenge:(NSURLConnectionAuthenticationChallenge *)challenge
@@ -194,10 +204,46 @@
ASSERT(con == connection);
ASSERT(!reachedTerminalState);
- if (implementations.delegateImplementsDidCancelAuthenticationChallenge)
- [resourceLoadDelegate webView:controller resource:identifier didCancelAuthenticationChallenge:challenge fromDataSource:dataSource];
- else
- [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didCancelAuthenticationChallenge:challenge fromDataSource:dataSource];
+ ASSERT(currentConnectionChallenge);
+ ASSERT(currentWebChallenge);
+ ASSERT(currentConnectionChallenge = challenge);
+
+ if (implementations.delegateImplementsDidCancelAuthenticationChallenge) {
+ [resourceLoadDelegate webView:controller resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ } else {
+ [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:controller resource:identifier didCancelAuthenticationChallenge:currentWebChallenge fromDataSource:dataSource];
+ }
+}
+
+
+-(void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(WebAuthenticationChallenge *)challenge
+{
+ if (challenge == nil || challenge != currentWebChallenge) {
+ return;
+ }
+
+ [[currentConnectionChallenge connection] useCredential:credential forAuthenticationChallenge:currentConnectionChallenge];
+
+ [currentConnectionChallenge release];
+ currentConnectionChallenge = nil;
+
+ [currentWebChallenge release];
+ currentWebChallenge = nil;
+}
+
+-(void)continueWithoutCredentialForAuthenticationChallenge:(WebAuthenticationChallenge *)challenge
+{
+ if (challenge == nil || challenge != currentWebChallenge) {
+ return;
+ }
+
+ [[currentConnectionChallenge connection] continueWithoutCredentialForAuthenticationChallenge:currentConnectionChallenge];
+
+ [currentConnectionChallenge release];
+ currentConnectionChallenge = nil;
+
+ [currentWebChallenge release];
+ currentWebChallenge = nil;
}
- (void)connection:(NSURLConnection *)con didReceiveResponse:(NSURLResponse *)r
@@ -265,6 +311,12 @@
{
ASSERT(!reachedTerminalState);
+ [currentConnectionChallenge release];
+ currentConnectionChallenge = nil;
+
+ [currentWebChallenge release];
+ currentWebChallenge = nil;
+
[connection cancel];
if (error) {
@@ -296,4 +348,5 @@
}
}
+
@end
diff --git a/WebKit/WebView.subproj/WebResourceLoadDelegate.h b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
index 349eb99..53e2a71 100644
--- a/WebKit/WebView.subproj/WebResourceLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
@@ -8,7 +8,7 @@
@class WebDataSource;
@class NSURLResponse;
@class NSURLRequest;
- at class NSURLConnectionAuthenticationChallenge;
+ at class WebAuthenticationChallenge;
/*!
@category WebResourceLoadDelegate
@@ -63,14 +63,14 @@
@discussion If you do not implement this delegate method, WebKit will handle authentication
automatically by prompting with a sheet on the window that the WebView is associated with.
*/
-- (void)webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLConnectionAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
+- (void)webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(WebAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
/*!
@method webView:resource:didCancelAuthenticationChallenge:fromDataSource:
@abstract Cancel authentication for a given request
@param challenge The WebAuthenticationChallenge to cancel authentication for
*/
-- (void)webView:(WebView *)sender resource:(id)identifier didCancelAuthenticationChallenge:(NSURLConnectionAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
+- (void)webView:(WebView *)sender resource:(id)identifier didCancelAuthenticationChallenge:(WebAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
/*!
@method resource:didReceiveResponse:fromDataSource:
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list