Reviewed by Kevin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2005 05:56:50 +0000 (05:56 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2005 05:56:50 +0000 (05:56 +0000)
- removed dependencies on NSError SPI

        * Misc.subproj/WebKitErrors.m:
        (-[NSError _webkit_initWithDomain:code:URL:]):
        (+[NSError _webkit_errorWithDomain:code:URL:]):
        (+[NSError _webKitErrorWithDomain:code:URL:]):
        (+[NSError _webKitErrorWithCode:failingURL:]):
        (+[NSError _webkit_addErrorsWithCodesAndDescriptions:inDomain:]):
        (registerErrors):
        * Plugins.subproj/WebNetscapePluginRepresentation.m:
        * Plugins.subproj/WebNetscapePluginStream.m:
        * WebCoreSupport.subproj/WebSubresourceClient.m:
        * WebView.subproj/WebBaseResourceHandleDelegate.m:
        * WebView.subproj/WebDefaultResourceLoadDelegate.m:
        * WebView.subproj/WebMainResourceClient.m:
        (-[WebMainResourceClient didFailWithError:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9265 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/Misc.subproj/WebKitErrors.m
WebKit/Plugins.subproj/WebNetscapePluginRepresentation.m
WebKit/Plugins.subproj/WebNetscapePluginStream.m
WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
WebKit/WebView.subproj/WebDefaultResourceLoadDelegate.m
WebKit/WebView.subproj/WebLoader.m
WebKit/WebView.subproj/WebMainResourceClient.m
WebKit/WebView.subproj/WebMainResourceLoader.m

index 48cb9643f75ea96faa96b71786081319336f01bc..77a7bd4d4ecd360aa0fcf4ef8ed893b868aa8f98 100644 (file)
@@ -1,3 +1,24 @@
+2005-06-02  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Kevin.
+
+       - removed dependencies on NSError SPI
+       
+        * Misc.subproj/WebKitErrors.m:
+        (-[NSError _webkit_initWithDomain:code:URL:]):
+        (+[NSError _webkit_errorWithDomain:code:URL:]):
+        (+[NSError _webKitErrorWithDomain:code:URL:]):
+        (+[NSError _webKitErrorWithCode:failingURL:]):
+        (+[NSError _webkit_addErrorsWithCodesAndDescriptions:inDomain:]):
+        (registerErrors):
+        * Plugins.subproj/WebNetscapePluginRepresentation.m:
+        * Plugins.subproj/WebNetscapePluginStream.m:
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        * WebView.subproj/WebDefaultResourceLoadDelegate.m:
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient didFailWithError:]):
+
 2005-06-02  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Vicki.
index 178def26324736fabf2d91aa991e7fc058056a68..769788c894d5328fa69a122c336cddbb689d6b24 100644 (file)
@@ -13,8 +13,6 @@
 #import <WebKit/WebLocalizableStrings.h>
 #import <WebKit/WebNSURLExtras.h>
 
-#import <Foundation/NSError_NSURLExtras.h>
-
 #import <pthread.h>
 
 NSString *WebKitErrorDomain = @"WebKitErrorDomain";
@@ -39,20 +37,43 @@ static void registerErrors(void);
 
 @implementation NSError (WebKitExtras)
 
+static NSMutableDictionary *descriptions = nil;
+
 + (void)_registerWebKitErrors
 {
     pthread_once(&registerErrorsControl, registerErrors);
 }
 
-+ (NSError *)_webKitErrorWithCode:(int)code failingURL:(NSString *)URLString
+-(id)_webkit_initWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
 {
-    return [self _webKitErrorWithDomain:WebKitErrorDomain code:code URL:[NSURL _web_URLWithUserTypedString:URLString]];
+    NSDictionary *descriptionsDict;
+    NSString *localizedDesc;
+    NSDictionary *dict;
+       // insert a localized string here for those folks not savvy to our category methods
+    descriptionsDict = [descriptions objectForKey:domain];
+    localizedDesc = descriptionsDict ? [descriptionsDict objectForKey:[NSNumber numberWithInt:code]] : nil;
+    dict = [NSDictionary dictionaryWithObjectsAndKeys:
+        URL, @"NSErrorFailingURLKey",
+        [URL absoluteString], @"NSErrorFailingURLStringKey",
+        localizedDesc, NSLocalizedDescriptionKey,
+        nil];
+    return [self initWithDomain:domain code:code userInfo:dict];
+}
+
++(id)_webkit_errorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
+{
+    return [[[self alloc] _webkit_initWithDomain:domain code:code URL:URL] autorelease];
 }
 
 + (NSError *)_webKitErrorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
 {
     [self _registerWebKitErrors];
-    return [self _web_errorWithDomain:domain code:code URL:URL];
+    return [self _webkit_errorWithDomain:domain code:code URL:URL];
+}
+
++ (NSError *)_webKitErrorWithCode:(int)code failingURL:(NSString *)URLString
+{
+    return [self _webKitErrorWithDomain:WebKitErrorDomain code:code URL:[NSURL _web_URLWithUserTypedString:URLString]];
 }
 
 - (id)_initWithPluginErrorCode:(int)code
@@ -86,7 +107,13 @@ static void registerErrors(void);
     return error;
 }
 
-@end
++ (void)_webkit_addErrorsWithCodesAndDescriptions:(NSDictionary *)dictionary inDomain:(NSString *)domain
+{
+       if (!descriptions)
+               descriptions = [[NSMutableDictionary alloc] init];
+
+    [descriptions setObject:dictionary forKey:domain];
+}
 
 static void registerErrors()
 {
@@ -107,7 +134,7 @@ static void registerErrors()
         WebKitErrorDescriptionPlugInCancelledConnection,[NSNumber numberWithInt: WebKitErrorPlugInCancelledConnection],
         nil];
 
-    [NSError _web_addErrorsWithCodesAndDescriptions:dict inDomain:WebKitErrorDomain];
+    [NSError _webkit_addErrorsWithCodesAndDescriptions:dict inDomain:WebKitErrorDomain];
 
 #if BUILDING_ON_PANTHER
     [pool release];
@@ -115,3 +142,8 @@ static void registerErrors()
     [pool drain];
 #endif
 }
+
+
+
+@end
+
index 72881365db99850fd3f7b93ea2738e42741bf29d..059c31455c95a930530f35d26bbd5499dd93ffab 100644 (file)
@@ -13,7 +13,6 @@
 #import <WebKit/WebNetscapePluginPackage.h>
 
 #import <Foundation/NSURLResponse.h>
-#import <Foundation/NSError_NSURLExtras.h>
 
 @implementation WebNetscapePluginRepresentation
 
index 0beab1103685158158934dd4b8cde6a75991c85e..09df890204264b03822d3ca245e1acfd19d05af4 100644 (file)
@@ -15,7 +15,6 @@
 #import <WebKit/WebNSURLRequestExtras.h>
 #import <WebKit/WebViewPrivate.h>
 
-#import <Foundation/NSError_NSURLExtras.h>
 #import <Foundation/NSURLConnection.h>
 #import <Foundation/NSURLResponsePrivate.h>
 
index 49bbfe53c79fa580a83ca8642d08d5a97ea2e000..784eca1b97f1ca64bd1c733370fe764f2a30a8f2 100644 (file)
@@ -14,7 +14,6 @@
 #import <WebKit/WebNSURLRequestExtras.h>
 #import <WebKit/WebViewPrivate.h>
 
-#import <Foundation/NSError_NSURLExtras.h>
 #import <Foundation/NSURLResponse.h>
 
 #import <WebCore/WebCoreResourceLoader.h>
index 49bbfe53c79fa580a83ca8642d08d5a97ea2e000..784eca1b97f1ca64bd1c733370fe764f2a30a8f2 100644 (file)
@@ -14,7 +14,6 @@
 #import <WebKit/WebNSURLRequestExtras.h>
 #import <WebKit/WebViewPrivate.h>
 
-#import <Foundation/NSError_NSURLExtras.h>
 #import <Foundation/NSURLResponse.h>
 
 #import <WebCore/WebCoreResourceLoader.h>
index ac073c2a45a39a39d2c6baddff50bc5768da0ea4..8c2ec4feea54e52c19e35e7244c95d5045652006 100644 (file)
@@ -11,7 +11,6 @@
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLResponse.h>
 #import <Foundation/NSURLResponsePrivate.h>
-#import <Foundation/NSError_NSURLExtras.h>
 
 #import <WebKit/WebAssertions.h>
 #import <WebKit/WebDataProtocol.h>
index edf65983fe8cfa43af10500ee76cab66fc2f91be..b997d0f8c6eb810d2a959e2069169c99a60648a1 100644 (file)
@@ -9,7 +9,6 @@
 #import <Foundation/NSURLConnection.h>
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLResponse.h>
-#import <Foundation/NSError_NSURLExtras.h>
 
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebPanelAuthenticationHandler.h>
index ac073c2a45a39a39d2c6baddff50bc5768da0ea4..8c2ec4feea54e52c19e35e7244c95d5045652006 100644 (file)
@@ -11,7 +11,6 @@
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLResponse.h>
 #import <Foundation/NSURLResponsePrivate.h>
-#import <Foundation/NSError_NSURLExtras.h>
 
 #import <WebKit/WebAssertions.h>
 #import <WebKit/WebDataProtocol.h>
index bceca60451e649c6f12c6ec306e616e538b2def4..9359f9b0e4068217e4dd9e71e5b125020e70666b 100644 (file)
@@ -6,7 +6,6 @@
 #import <WebKit/WebMainResourceClient.h>
 
 #import <Foundation/NSHTTPCookie.h>
-#import <Foundation/NSError_NSURLExtras.h>
 #import <Foundation/NSURLConnection.h>
 #import <Foundation/NSURLConnectionPrivate.h>
 #import <Foundation/NSURLDownloadPrivate.h>
     ASSERT(![self defersCallbacks]);
     ASSERT(![[dataSource _webView] defersCallbacks]);
 
-    LOG(Loading, "URL = %@, error = %@", [error _web_failingURL], [error _web_localizedDescription]);
-
     [self receivedError:error];
 }
 
index bceca60451e649c6f12c6ec306e616e538b2def4..9359f9b0e4068217e4dd9e71e5b125020e70666b 100644 (file)
@@ -6,7 +6,6 @@
 #import <WebKit/WebMainResourceClient.h>
 
 #import <Foundation/NSHTTPCookie.h>
-#import <Foundation/NSError_NSURLExtras.h>
 #import <Foundation/NSURLConnection.h>
 #import <Foundation/NSURLConnectionPrivate.h>
 #import <Foundation/NSURLDownloadPrivate.h>
     ASSERT(![self defersCallbacks]);
     ASSERT(![[dataSource _webView] defersCallbacks]);
 
-    LOG(Loading, "URL = %@, error = %@", [error _web_failingURL], [error _web_localizedDescription]);
-
     [self receivedError:error];
 }