Reviewed by Darin
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Aug 2003 16:48:03 +0000 (16:48 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Aug 2003 16:48:03 +0000 (16:48 +0000)
Fix for this bug:

<rdar://problem/3375042>: Change usages of NSURL absoluteString in WebKit
to use improved variants

        * History.subproj/WebHistoryItem.m:
        (-[WebHistoryItem initWithURL:title:]): Use data-as-string.
        (-[WebHistoryItem initWithURL:target:parent:title:]): Use data-as-string.
        (-[WebHistoryItem setURL:]): Use data-as-string.
        * History.subproj/WebHistoryPrivate.m:
        (-[WebHistoryPrivate addItem:]): Remove FIX_VISITED ifdef
        (-[WebHistoryPrivate removeItem:]): Ditto
        (-[WebHistoryPrivate containsURL:]): Ditto. Use data-as-string.
        (-[WebHistoryPrivate itemForURL:]): Ditto. Ditto.
        (-[WebHistoryPrivate loadFromURL:error:]): Fix log message to URL.
        (-[WebHistoryPrivate _saveHistoryGuts:URL:error:]): Ditto.
        (-[WebHistoryPrivate saveToURL:error:]): Ditto.
        * History.subproj/WebURLsWithTitles.m:
        (+[WebURLsWithTitles writeURLs:andTitles:toPasteboard:]): Use visible-string.
        * Misc.subproj/WebIconLoader.m:
        (-[WebIconLoader connectionDidFinishLoading:]): Use data-as-string.
        * Misc.subproj/WebKitErrors.m:
        (+[NSError _webKitErrorWithDomain:code:URL:]): Added new convenience that takes
a URL instead of a URL string.
        (-[NSError _initWithPluginErrorCode:contentURL:pluginPageURL:pluginName:MIMEType:]):
Added new convenience that takes URLs instead of a URL stringis.
        * Misc.subproj/WebKitErrorsPrivate.h: Declared new conveniences.
        * Misc.subproj/WebNSPasteboardExtras.m:
        (-[NSPasteboard _web_writeURL:andTitle:withOwner:types:]): Use visible-string.
        * Misc.subproj/WebNSURLExtras.h:
        * Misc.subproj/WebNSURLExtras.m:
        (-[NSURL _web_originalDataAsString]): Added.
        (-[NSURL _webkit_isJavaScriptURL]): Use data-as-string.
        (-[NSURL _webkit_scriptIfJavaScriptURL]): Ditto
        (-[NSURL _webkit_isFTPDirectoryURL]): Ditto
        (-[NSURL _webkit_shouldLoadAsEmptyDocument]): Ditto. Also use _web_isEmpty.
        * Plugins.subproj/WebBaseNetscapePluginView.m:
        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:]): Use data-as-string.
        * Plugins.subproj/WebNetscapePluginDocumentView.m:
        (-[WebNetscapePluginDocumentView setDataSource:]): Use new error convenience.
        * Plugins.subproj/WebNetscapePluginStream.m:
        (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]): Ditto.
        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge requestedURLString]): Use data-as-string.
        * WebCoreSupport.subproj/WebSubresourceClient.m:
        (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]): Use new error convenience.
        * WebView.subproj/WebBaseResourceHandleDelegate.m:
        (-[WebBaseResourceHandleDelegate cancelledError]): Ditto.
        * WebView.subproj/WebDataProtocol.m:
        (-[WebDataProtocol startLoading]): Ditto.
        * WebView.subproj/WebDataSourcePrivate.m:
        (-[WebDataSource _stopLoadingInternal]): Ditto.
        (-[WebDataSource _updateIconDatabaseWithURL:]): Use data-as-string.
        (-[WebDataSource _loadIcon]): Ditto.
        * WebView.subproj/WebFramePrivate.m:
        (-[WebFrame _createItem:]): Use data-as-string.
        (-[WebFrame _transitionToCommitted:]): Fix log message to use URL.
        (-[WebFrame _purgePageCache]): Use _web_isEmpty
        (-[WebFrame _setState:]): Fix log message to use URL.
        (-[WebFrame _handleUnimplementablePolicyWithErrorCode:forURL:]): Use new error convenience.
        (-[WebFrame _loadItem:withLoadType:]): Fix log message to use URL.
        (-[WebFrame _checkNavigationPolicyForRequest:dataSource:formState:andCall:withSelector:]):
        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]): Fix log messages to use URL.
        (-[WebFrame _shouldTreatURLAsSameAsCurrent:]): Use data-as-string.
        * WebView.subproj/WebHTMLViewPrivate.m:
        (-[WebHTMLView _dragImageForLinkElement:]): Use visible-string.
        * WebView.subproj/WebMainResourceClient.m:
        (-[WebMainResourceClient interruptForPolicyChangeError]): Use new error convenience.
        * WebView.subproj/WebPreferences.m:
        (-[WebPreferences setUserStyleSheetLocation:]): Use data-as-string.
        * WebView.subproj/WebView.m:
        (-[WebView mainFrameURL]): Use data-as-string.
        (-[WebView mainFrameIcon]): Use data-as-string.
        * WebView.subproj/WebViewPrivate.m:
        (-[WebView _updateWebCoreSettingsFromPreferences:]): Use data-as-string.

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

27 files changed:
WebKit/ChangeLog
WebKit/History.subproj/WebHistoryItem.m
WebKit/History.subproj/WebHistoryPrivate.m
WebKit/History.subproj/WebURLsWithTitles.m
WebKit/Misc.subproj/WebIconLoader.m
WebKit/Misc.subproj/WebKitErrors.m
WebKit/Misc.subproj/WebKitErrorsPrivate.h
WebKit/Misc.subproj/WebNSPasteboardExtras.m
WebKit/Misc.subproj/WebNSURLExtras.h
WebKit/Misc.subproj/WebNSURLExtras.m
WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
WebKit/Plugins.subproj/WebNetscapePluginDocumentView.m
WebKit/Plugins.subproj/WebNetscapePluginStream.m
WebKit/WebCoreSupport.subproj/WebBridge.m
WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
WebKit/WebView.subproj/WebDataProtocol.m
WebKit/WebView.subproj/WebDataSourcePrivate.m
WebKit/WebView.subproj/WebFramePrivate.m
WebKit/WebView.subproj/WebHTMLViewPrivate.m
WebKit/WebView.subproj/WebLoader.m
WebKit/WebView.subproj/WebMainResourceClient.m
WebKit/WebView.subproj/WebMainResourceLoader.m
WebKit/WebView.subproj/WebPreferences.m
WebKit/WebView.subproj/WebView.m
WebKit/WebView.subproj/WebViewPrivate.m

index b824b1579cfe368350b578372d8a2c5aee28c740..42d28336350c5535c3760cbd779dce56e3d63bbf 100644 (file)
@@ -1,3 +1,83 @@
+2003-08-14  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Darin
+
+       Fix for this bug:
+
+       <rdar://problem/3375042>: Change usages of NSURL absoluteString in WebKit 
+       to use improved variants
+
+        * History.subproj/WebHistoryItem.m:
+        (-[WebHistoryItem initWithURL:title:]): Use data-as-string.
+        (-[WebHistoryItem initWithURL:target:parent:title:]): Use data-as-string.
+        (-[WebHistoryItem setURL:]): Use data-as-string.
+        * History.subproj/WebHistoryPrivate.m:
+        (-[WebHistoryPrivate addItem:]): Remove FIX_VISITED ifdef
+        (-[WebHistoryPrivate removeItem:]): Ditto
+        (-[WebHistoryPrivate containsURL:]): Ditto. Use data-as-string.
+        (-[WebHistoryPrivate itemForURL:]): Ditto. Ditto.
+        (-[WebHistoryPrivate loadFromURL:error:]): Fix log message to URL.
+        (-[WebHistoryPrivate _saveHistoryGuts:URL:error:]): Ditto.
+        (-[WebHistoryPrivate saveToURL:error:]): Ditto.
+        * History.subproj/WebURLsWithTitles.m:
+        (+[WebURLsWithTitles writeURLs:andTitles:toPasteboard:]): Use visible-string.
+        * Misc.subproj/WebIconLoader.m:
+        (-[WebIconLoader connectionDidFinishLoading:]): Use data-as-string.
+        * Misc.subproj/WebKitErrors.m:
+        (+[NSError _webKitErrorWithDomain:code:URL:]): Added new convenience that takes
+       a URL instead of a URL string.
+        (-[NSError _initWithPluginErrorCode:contentURL:pluginPageURL:pluginName:MIMEType:]):
+       Added new convenience that takes URLs instead of a URL stringis.
+        * Misc.subproj/WebKitErrorsPrivate.h: Declared new conveniences.
+        * Misc.subproj/WebNSPasteboardExtras.m:
+        (-[NSPasteboard _web_writeURL:andTitle:withOwner:types:]): Use visible-string.
+        * Misc.subproj/WebNSURLExtras.h:
+        * Misc.subproj/WebNSURLExtras.m:
+        (-[NSURL _web_originalDataAsString]): Added.
+        (-[NSURL _webkit_isJavaScriptURL]): Use data-as-string.
+        (-[NSURL _webkit_scriptIfJavaScriptURL]): Ditto
+        (-[NSURL _webkit_isFTPDirectoryURL]): Ditto
+        (-[NSURL _webkit_shouldLoadAsEmptyDocument]): Ditto. Also use _web_isEmpty.
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:]): Use data-as-string.
+        * Plugins.subproj/WebNetscapePluginDocumentView.m:
+        (-[WebNetscapePluginDocumentView setDataSource:]): Use new error convenience.
+        * Plugins.subproj/WebNetscapePluginStream.m:
+        (-[WebNetscapePluginConnectionDelegate connection:didReceiveResponse:]): Ditto.
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge requestedURLString]): Use data-as-string.
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]): Use new error convenience.
+        * WebView.subproj/WebBaseResourceHandleDelegate.m:
+        (-[WebBaseResourceHandleDelegate cancelledError]): Ditto.
+        * WebView.subproj/WebDataProtocol.m:
+        (-[WebDataProtocol startLoading]): Ditto.
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _stopLoadingInternal]): Ditto.
+        (-[WebDataSource _updateIconDatabaseWithURL:]): Use data-as-string.
+        (-[WebDataSource _loadIcon]): Ditto.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _createItem:]): Use data-as-string.
+        (-[WebFrame _transitionToCommitted:]): Fix log message to use URL.
+        (-[WebFrame _purgePageCache]): Use _web_isEmpty
+        (-[WebFrame _setState:]): Fix log message to use URL.
+        (-[WebFrame _handleUnimplementablePolicyWithErrorCode:forURL:]): Use new error convenience.
+        (-[WebFrame _loadItem:withLoadType:]): Fix log message to use URL.
+        (-[WebFrame _checkNavigationPolicyForRequest:dataSource:formState:andCall:withSelector:]):
+        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]): Fix log messages to use URL.
+        (-[WebFrame _shouldTreatURLAsSameAsCurrent:]): Use data-as-string.
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (-[WebHTMLView _dragImageForLinkElement:]): Use visible-string.
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient interruptForPolicyChangeError]): Use new error convenience.
+        * WebView.subproj/WebPreferences.m:
+        (-[WebPreferences setUserStyleSheetLocation:]): Use data-as-string.
+        * WebView.subproj/WebView.m:
+        (-[WebView mainFrameURL]): Use data-as-string.
+        (-[WebView mainFrameIcon]): Use data-as-string.
+        * WebView.subproj/WebViewPrivate.m:
+        (-[WebView _updateWebCoreSettingsFromPreferences:]): Use data-as-string.
+
 2003-08-12  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Ken.
index 72b181dcab56f7c0677af56dd6b394458ca61e38..a721a973b5187bf0c9b5c3053239d173153b2cfb 100644 (file)
@@ -249,12 +249,12 @@ NSString *WebHistoryItemChangedNotification = @"WebHistoryItemChangedNotificatio
 
 - (id)initWithURL:(NSURL *)URL title:(NSString *)title
 {
-    return [self initWithURLString:[URL absoluteString] title:title lastVisitedTimeInterval:0];
+    return [self initWithURLString:[URL _web_originalDataAsString] title:title lastVisitedTimeInterval:0];
 }
 
 - (id)initWithURL:(NSURL *)URL target:(NSString *)target parent:(NSString *)parent title:(NSString *)title
 {
-    self = [self initWithURLString:[URL absoluteString] title:title lastVisitedTimeInterval:0];
+    self = [self initWithURLString:[URL _web_originalDataAsString] title:title lastVisitedTimeInterval:0];
     if (self) {
         _private->target = [target copy];
         _private->parent = [parent copy];
@@ -279,7 +279,7 @@ NSString *WebHistoryItemChangedNotification = @"WebHistoryItemChangedNotificatio
 
 - (void)setURL:(NSURL *)URL
 {
-    NSString *string = [URL absoluteString];
+    NSString *string = [URL _web_originalDataAsString];
     if (!(string == _private->URLString || [string isEqual:_private->URLString])) {
         [self _retainIconInDatabase:NO];
         [_private->URLString release];
index 3af3aacdbd1ed2726aaf91682e95d09d023de653..44d115ac235b9a4acb7ac2d4404128794d45eebf 100644 (file)
@@ -26,8 +26,6 @@ NSString *DatesArrayKey = @"WebHistoryDates";
 
 @implementation WebHistoryPrivate
 
-//#define FIX_VISITED
-
 #pragma mark OBJECT FRAMEWORK
 
 + (void)initialize
@@ -148,11 +146,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     ASSERT_ARG(entry, entry);
     ASSERT_ARG(entry, [entry lastVisitedTimeInterval] != 0);
 
-#ifdef FIX_VISITED
-    URLString = [[[entry URL] _web_canonicalize] absoluteString];
-#else
     URLString = [entry URLString];
-#endif
 
     // If we already have an item with this URL, we need to merge info that drives the
     // URL autocomplete heuristics from that item into the new one.
@@ -180,11 +174,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     WebHistoryItem *matchingEntry;
     NSString *URLString;
 
-#ifdef FIX_VISITED
-    URLString = [[[entry URL] _web_canonicalize] absoluteString];
-#else
     URLString = [entry URLString];
-#endif
 
     // If this exact object isn't stored, then make no change.
     // FIXME: Is this the right behavior if this entry isn't present, but another entry for the same URL is?
@@ -276,20 +266,12 @@ NSString *DatesArrayKey = @"WebHistoryDates";
 
 - (BOOL)containsURL: (NSURL *)URL
 {
-#ifdef FIX_VISITED
-    return [self itemForURLString:[[URL _web_canonicalize] absoluteString]] != nil;
-#else
-    return [self itemForURLString:[URL absoluteString]] != nil;
-#endif
+    return [self itemForURLString:[URL _web_originalDataAsString]] != nil;
 }
 
 - (WebHistoryItem *)itemForURL:(NSURL *)URL
 {
-#ifdef FIX_VISITED
-    return [self itemForURLString:[[URL _web_canonicalize] absoluteString]];
-#else
-    return [self itemForURLString:[URL absoluteString]];
-#endif
+    return [self itemForURLString:[URL _web_originalDataAsString]];
 }      
 
 #pragma mark ARCHIVING/UNARCHIVING
@@ -442,7 +424,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         LOG(Timing, "loading %d history entries from %@ took %f seconds",
-            numberOfItems, [URL absoluteString], duration);
+            numberOfItems, URL, duration);
     }
 
     return result;
@@ -462,7 +444,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
         [NSNumber numberWithInt:currentFileVersion], FileVersionKey,
         nil];
     if (![dictionary writeToURL:URL atomically:YES]) {
-        ERROR("attempt to save %@ to %@ failed", dictionary, [URL absoluteString]);
+        ERROR("attempt to save %@ to %@ failed", dictionary, URL);
         return NO;
     }
     
@@ -482,7 +464,7 @@ NSString *DatesArrayKey = @"WebHistoryDates";
     if (result) {
         duration = CFAbsoluteTimeGetCurrent() - start;
         LOG(Timing, "saving %d history entries to %@ took %f seconds",
-            numberOfItems, [URL absoluteString], duration);
+            numberOfItems, URL, duration);
     }
 
     return result;
index 708c9c343767264f02175d8f40fe63c370acdd4f..b07dc54018e277e20eddf6a690193d6fe2b4968a 100644 (file)
@@ -46,7 +46,7 @@
     URLStrings = [NSMutableArray arrayWithCapacity:count];
     titlesOrEmptyStrings = [NSMutableArray arrayWithCapacity:count];
     for (index = 0; index < count; ++index) {
-        [URLStrings addObject:[[URLs objectAtIndex:index] absoluteString]];
+        [URLStrings addObject:[[URLs objectAtIndex:index] _web_userVisibleString]];
         [titlesOrEmptyStrings addObject:(titles == nil) ? @"" : [titles objectAtIndex:index]];
     }
 
index c0498eace5928711cc85fe1f1901df8311340f4e..65cd54a301d9f0261210cecac373f3804fbdf4fb 100644 (file)
@@ -99,9 +99,9 @@
 {
     NSImage *icon = [[NSImage alloc] initWithData:_private->resourceData];
     if (icon && [[icon representations] count]) {
-        [[WebIconDatabase sharedIconDatabase] _setIcon:icon forIconURL:[[self URL] absoluteString]];
+        [[WebIconDatabase sharedIconDatabase] _setIcon:icon forIconURL:[[self URL] _web_originalDataAsString]];
     } else {
-       [[WebIconDatabase sharedIconDatabase] _setHaveNoIconForIconURL:[[self URL] absoluteString]];
+       [[WebIconDatabase sharedIconDatabase] _setHaveNoIconForIconURL:[[self URL] _web_originalDataAsString]];
     }
     [_private->delegate _iconLoaderReceivedPageIcon:self];    
     [icon release];
index 19160581dbf49ca7da2539a785ceae8be22ef957..cf1ef3425ee91a8ae446e5281a2ad9d6d1f31b7e 100644 (file)
@@ -10,6 +10,7 @@
 #import <WebKit/WebKitErrors.h>
 
 #import <WebKit/WebLocalizableStrings.h>
+#import <WebKit/WebNSURLExtras.h>
 #import <Foundation/NSError_NSURLExtras.h>
 
 #import <pthread.h>
@@ -48,6 +49,13 @@ static void registerErrors(void);
     return [self _web_errorWithDomain:WebKitErrorDomain code:code failingURL:URL];
 }
 
++ (NSError *)_webKitErrorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL
+{
+    [self _registerWebKitErrors];
+
+    return [self _web_errorWithDomain:domain code:code failingURL:[URL _web_userVisibleString]];
+}
+
 - (id)_initWithPluginErrorCode:(int)code
               contentURLString:(NSString *)contentURLString
            pluginPageURLString:(NSString *)pluginPageURLString
@@ -78,6 +86,19 @@ static void registerErrors(void);
     return error;
 }
 
+- (id)_initWithPluginErrorCode:(int)code
+                    contentURL:(NSURL *)contentURL
+                 pluginPageURL:(NSURL *)pluginPageURL
+                    pluginName:(NSString *)pluginName
+                      MIMEType:(NSString *)MIMEType
+{
+    return [self _initWithPluginErrorCode:code 
+                         contentURLString:[contentURL _web_userVisibleString]
+                      pluginPageURLString:[pluginPageURL _web_userVisibleString]
+                               pluginName:pluginName
+                                 MIMEType:MIMEType
+           ];
+}
 
 @end
 
index 2970e40b8449f26cb49219d98ce4a10122b4b905..33825ba3330422d534948812886527777a56ed3f 100644 (file)
@@ -9,11 +9,20 @@
 
 @interface NSError (WebKitExtras)
 + (NSError *)_webKitErrorWithCode:(int)code failingURL:(NSString *)URL;
++ (NSError *)_webKitErrorWithDomain:(NSString *)domain code:(int)code URL:(NSURL *)URL;
 
+- (id)_initWithPluginErrorCode:(int)code
+                    contentURL:(NSURL *)contentURL
+                 pluginPageURL:(NSURL *)pluginPageURL
+                    pluginName:(NSString *)pluginName
+                      MIMEType:(NSString *)MIMEType;
+
+// This method is deprecated. Use _initWithPluginErrorCode:contentURL:pluginPageURL:pluginName:MIMEType: instead.
 - (id)_initWithPluginErrorCode:(int)code
               contentURLString:(NSString *)contentURL
            pluginPageURLString:(NSString *)pluginPageURL
                     pluginName:(NSString *)pluginName
                       MIMEType:(NSString *)MIMEType;
+
 @end
 
index f8f31d9bd59a277b1507a3f22dc3608917e00a4a..4c26d2965d640a0095e7a0f6d69cc74d0a8be32f 100644 (file)
@@ -87,14 +87,14 @@ NSString *WebURLNamePboardType = nil;
     if(!title || [title isEqualToString:@""]){
         title = [[URL path] lastPathComponent];
         if(!title || [title isEqualToString:@""]){
-            title = [URL absoluteString];
+            title = [URL _web_userVisibleString];
         }
     }
     
     [URL writeToPasteboard:self];
     [self setString:title forType:WebURLNamePboardType];
-    [self setString:[URL absoluteString] forType:WebURLPboardType];
-    [self setString:[URL absoluteString] forType:NSStringPboardType];
+    [self setString:[URL _web_userVisibleString] forType:WebURLPboardType];
+    [self setString:[URL _web_userVisibleString] forType:NSStringPboardType];
     [WebURLsWithTitles writeURLs:[NSArray arrayWithObject:URL] andTitles:[NSArray arrayWithObject:title] toPasteboard:self];
 }
 
index 1dd31269bbfa63a52be344ac364bfd5c20ed7124..a2a94828fc272113dcdd281a5de48e44251f5e6b 100644 (file)
@@ -17,6 +17,7 @@
 + (NSURL *)_web_URLWithData:(NSData *)data relativeToURL:(NSURL *)baseURL;
 
 - (NSData *)_web_originalData;
+- (NSString *)_web_originalDataAsString;
 
 - (NSString *)_web_userVisibleString;
 - (const char *)_web_URLCString;
index 02353bb844ad8c235a73885e957be65d52835026..df46ba44fd689cff08981e0bde3adea2e83b7f51 100644 (file)
@@ -176,6 +176,11 @@ static int hexDigitValue(char c)
     }
 }
 
+- (NSString *)_web_originalDataAsString
+{
+    return [[[NSString alloc] initWithData:[self _web_originalData] encoding:NSISOLatin1StringEncoding] autorelease];
+}
+
 - (NSString *)_web_userVisibleString
 {
     NSData *data = [self _web_originalData];
@@ -304,22 +309,22 @@ static int hexDigitValue(char c)
 
 - (BOOL)_webkit_isJavaScriptURL
 {
-    return [[self absoluteString] _webkit_isJavaScriptURL];
+    return [[self _web_originalDataAsString] _webkit_isJavaScriptURL];
 }
 
 - (NSString *)_webkit_scriptIfJavaScriptURL
 {
-    return [[self absoluteString] _webkit_scriptIfJavaScriptURL];
+    return [[self _web_originalDataAsString] _webkit_scriptIfJavaScriptURL];
 }
 
 - (BOOL)_webkit_isFTPDirectoryURL
 {
-    return [[self absoluteString] _webkit_isFTPDirectoryURL];
+    return [[self _web_originalDataAsString] _webkit_isFTPDirectoryURL];
 }
 
 - (BOOL)_webkit_shouldLoadAsEmptyDocument
 {
-    return [[self absoluteString] _web_hasCaseInsensitivePrefix:@"about:"] || [[self absoluteString] length] == 0;
+    return [[self _web_originalDataAsString] _web_hasCaseInsensitivePrefix:@"about:"] || [self _web_isEmpty];
 }
 
 @end
index f4c55ef3b7d3ab3de9680bc321e409a7853530ea..c9552fade11bffe9aa689aff51793a89dab192af 100644 (file)
@@ -1305,7 +1305,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
             // Find the frame given the target string.
             target = (NSString *)CFStringCreateWithCString(kCFAllocatorDefault, cTarget, kCFStringEncodingWindowsLatin1);
         }        
-        [request setHTTPReferrer:[[[[[self webFrame] dataSource] request] URL] absoluteString]];
+        [request setHTTPReferrer:[[[[[self webFrame] dataSource] request] URL] _web_originalDataAsString]];
         WebPluginRequest *pluginRequest = [[WebPluginRequest alloc] initWithRequest:request frameName:target notifyData:notifyData];
         [self performSelector:@selector(loadPluginRequest:) withObject:pluginRequest afterDelay:0];
         [pluginRequest release];
index 26bd5ea3e2a7e36cb8b73548581b4514d85787e4..5e60c3325f534b4ae958cdf4c14ddca87a3afdc1 100644 (file)
@@ -81,8 +81,8 @@
     if (![thePlugin load]){
         // FIXME: It would be nice to stop the load here.
         NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorCannotLoadPlugin
-                                                  contentURLString:[[[theDataSource request] URL] absoluteString]
-                                               pluginPageURLString:nil
+                                                        contentURL:[[theDataSource request] URL]
+                                                     pluginPageURL:nil
                                                         pluginName:[thePlugin name]
                                                           MIMEType:MIME];
         WebView *webView = [[theDataSource webFrame] webView];
index b732a97fbbf2f0fcb0a3a95e0952d4906115d383..8eaaf67d7c31742812aa8ae3a39e45a6a5210999 100644 (file)
@@ -6,6 +6,7 @@
 #import <WebKit/WebNetscapePluginStream.h>
 
 #import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebNetscapePluginEmbeddedView.h>
 #import <WebKit/WebViewPrivate.h>
     if ([theResponse isKindOfClass:[NSHTTPURLResponse class]] &&
         [NSHTTPURLResponse isErrorStatusCode:[(NSHTTPURLResponse *)theResponse statusCode]]) {
         [stream receivedError:NPRES_NETWORK_ERR];
-        NSError *error = [NSError _web_errorWithDomain:NSURLErrorDomain
-                                                  code:NSURLErrorFileDoesNotExist
-                                            failingURL:[[theResponse URL] absoluteString]];
+        NSError *error = [NSError _webKitErrorWithDomain:NSURLErrorDomain
+                                                    code:NSURLErrorFileDoesNotExist
+                                                     URL:[theResponse URL]];
         [self cancelWithError:error];
     }
     [self release];
index 26a2f6a64f594b11db7d9354f1ee640d6ac68b9b..238035aed0a1ad8c896b7dc3a619e7c6f21e4f32 100644 (file)
 // This URL is only used for coloring visited links.
 - (NSString *)requestedURLString
 {
-    return [[[[self dataSource] request] URL] _web_userVisibleString];
+    return [[[[self dataSource] request] URL] _web_originalDataAsString];
 }
 
 - (NSString *)incomingReferrer
 
     if (!view) {
         NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable
-                                                  contentURLString:nil
-                                               pluginPageURLString:nil
+                                                        contentURL:nil
+                                                     pluginPageURL:nil
                                                         pluginName:[pluginPackage name]
                                                           MIMEType:MIMEType];
         view = [[[WebNullPluginView alloc] initWithFrame:theFrame error:error] autorelease];
index 3261665ff4b66a1dccac5a9adef5c55d57efd973..627f4306f65bca376748cea9bb1b850c2ab238cf 100644 (file)
@@ -8,6 +8,7 @@
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebFrame.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebViewPrivate.h>
 
 #import <Foundation/NSURLConnection.h>
@@ -61,9 +62,9 @@
 
         [rLoader reportError];
 
-        NSError *badURLError = [[NSError alloc] _web_initWithDomain:NSURLErrorDomain 
-                                                               code:NSURLErrorBadURL
-                                                         failingURL:[URL absoluteString]];
+        NSError *badURLError = [[NSError alloc] _webKitErrorWithDomain:NSURLErrorDomain 
+                                                                  code:NSURLErrorBadURL
+                                                                   URL:URL];
         [_webView _receivedError:badURLError fromDataSource:source];
         [badURLError release];
         client = nil;
index 3261665ff4b66a1dccac5a9adef5c55d57efd973..627f4306f65bca376748cea9bb1b850c2ab238cf 100644 (file)
@@ -8,6 +8,7 @@
 #import <WebKit/WebBridge.h>
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebFrame.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebViewPrivate.h>
 
 #import <Foundation/NSURLConnection.h>
@@ -61,9 +62,9 @@
 
         [rLoader reportError];
 
-        NSError *badURLError = [[NSError alloc] _web_initWithDomain:NSURLErrorDomain 
-                                                               code:NSURLErrorBadURL
-                                                         failingURL:[URL absoluteString]];
+        NSError *badURLError = [[NSError alloc] _webKitErrorWithDomain:NSURLErrorDomain 
+                                                                  code:NSURLErrorBadURL
+                                                                   URL:URL];
         [_webView _receivedError:badURLError fromDataSource:source];
         [badURLError release];
         client = nil;
index 6ccfa9198c2644da0f33880df591f683c2b014ca..04ebe3a90f8cbc5c29b2e7af4042972b73289641 100644 (file)
@@ -19,6 +19,7 @@
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebKitErrors.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebViewPrivate.h>
 
 
 - (NSError *)cancelledError
 {
-    return [NSError _web_errorWithDomain:NSURLErrorDomain
+    return [NSError _webKitErrorWithDomain:NSURLErrorDomain
                                     code:NSURLErrorCancelled
-                              failingURL:[[request URL] absoluteString]];
+                                     URL:[request URL]];
 }
 
 - (void)setIdentifier: ident
index 72b8a74fa53532ada1eef49a4e1c64d39d32fae8..94c781b3ad571d9c9b3c751a960a209d77dd773c 100644 (file)
@@ -9,6 +9,7 @@
 #import <Foundation/NSError_NSURLExtras.h>
 #import <Foundation/NSString_NSURLExtras.h>
 #import <WebKit/WebAssertions.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 
 NSString *WebDataProtocolScheme = @"applewebdata";
 static NSString *WebDataRequestPropertyKey = @"WebDataRequest";
@@ -198,7 +199,7 @@ static NSString *WebDataRequestPropertyKey = @"WebDataRequest";
 
         resultCode = NSURLErrorResourceUnavailable;
 
-        [client URLProtocol:self didFailWithError:[NSError _web_errorWithDomain:NSURLErrorDomain code:resultCode failingURL:[[request URL] absoluteString]]];
+        [client URLProtocol:self didFailWithError:[NSError _webKitErrorWithDomain:NSURLErrorDomain code:resultCode URL:[request URL]]];
     }
 }
 
index fcb9dad49285fa6769e46f6d4b1c47a68858af6b..4cd45f46164a52a436b6eb6e5c80194988534d73 100644 (file)
@@ -22,6 +22,7 @@
 #import <WebKit/WebIconLoader.h>
 #import <WebKit/WebImageRepresentation.h>
 #import <WebKit/WebImageView.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebMainResourceClient.h>
 #import <WebKit/WebNSURLExtras.h>
         [_private->mainClient cancel];
     }else{
         // Main handle is already done. Set the cancelled error.
-        NSError *cancelledError = [NSError _web_errorWithDomain:NSURLErrorDomain
-                                                           code:NSURLErrorCancelled
-                                                     failingURL:[[self _URL] absoluteString]];
+        NSError *cancelledError = [NSError _webKitErrorWithDomain:NSURLErrorDomain
+                                                             code:NSURLErrorCancelled
+                                                              URL:[self _URL]];
         [self _setMainDocumentError:cancelledError];
     }
     
     WebIconDatabase *iconDB = [WebIconDatabase sharedIconDatabase];
 
     // Bind the URL of the original request and the final URL to the icon URL.
-    [iconDB _setIconURL:[iconURL absoluteString] forURL:[[self _URL] absoluteString]];
-    [iconDB _setIconURL:[iconURL absoluteString] forURL:[[[self _originalRequest] URL] absoluteString]];
+    [iconDB _setIconURL:[iconURL _web_originalDataAsString] forURL:[[self _URL] _web_originalDataAsString]];
+    [iconDB _setIconURL:[iconURL _web_originalDataAsString] forURL:[[[self _originalRequest] URL] _web_originalDataAsString]];
 
     
     if ([self webFrame] == [_private->webView mainFrame])
         [_private->webView _willChangeValueForKey:_WebMainFrameIconKey];
     
-    NSImage *icon = [iconDB iconForURL:[[self _URL] absoluteString] withSize:WebIconSmallSize];
+    NSImage *icon = [iconDB iconForURL:[[self _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
     [[_private->webView _frameLoadDelegateForwarder] webView:_private->webView
                                                       didReceiveIcon:icon
                                                             forFrame:[self webFrame]];
     }
 
     if(_private->iconURL != nil){
-        if([[WebIconDatabase sharedIconDatabase] _hasIconForIconURL:[_private->iconURL absoluteString]]){
+        if([[WebIconDatabase sharedIconDatabase] _hasIconForIconURL:[_private->iconURL _web_originalDataAsString]]){
             [self _updateIconDatabaseWithURL:_private->iconURL];
         }else{
             ASSERT(!_private->iconLoader);
index 18c2073a1b1b993b16a4bd86dadca4ee0162f18a..f7c59d11454d0283f26a232933fcdac4c12f4d8e 100644 (file)
@@ -294,7 +294,7 @@ NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
 
     bfItem = [[[WebHistoryItem alloc] initWithURL:URL target:[self name] parent:[[self parentFrame] name] title:[dataSrc pageTitle]] autorelease];
     [dataSrc _addBackForwardItem:bfItem];
-    [bfItem setOriginalURLString:[[[dataSrc _originalRequest] URL] absoluteString]];
+    [bfItem setOriginalURLString:[[[dataSrc _originalRequest] URL] _web_originalDataAsString]];
 
     // save form state if this is a POST
     if ([[request HTTPMethod] _web_isCaseInsensitiveEqualToString:@"POST"]) {
@@ -661,7 +661,7 @@ NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
             case WebFrameLoadTypeSame:
             {
                 WebHistoryItem *currItem = [_private currentItem];
-                LOG(PageCache, "Clearing back/forward cache, %s\n", [[[currItem URL] absoluteString] cString]);
+                LOG(PageCache, "Clearing back/forward cache, %@\n", [currItem URL]);
                 // FIXME: rjw sez this cache clearing is no longer needed
                 [currItem setHasPageCache:NO];
                 if (loadType == WebFrameLoadTypeReload) {
@@ -687,7 +687,7 @@ NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
                 if (![ds _isClientRedirect]) {
                     // Add item to history.
                    NSURL *URL = [[[ds _originalRequest] URL] _webkit_canonicalize];
-                   if ([[URL absoluteString] length] > 0 && ![WebDataProtocol _webIsDataProtocolURL:URL]) {
+                   if (![URL _web_isEmpty] && ![WebDataProtocol _webIsDataProtocolURL:URL]) {
                        entry = [[WebHistory optionalSharedHistory] addItemForURL:URL];
                        if (ptitle)
                            [entry setTitle: ptitle];
@@ -777,7 +777,7 @@ NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
     
     // Snapback items are never directly purged here.
     if (pagesCached >= sizeLimit && ![oldestItem alwaysAttemptToUsePageCache]){
-        LOG(PageCache, "Purging back/forward cache, %s\n", [[[oldestItem URL] absoluteString] cString]);
+        LOG(PageCache, "Purging back/forward cache, %@\n", [oldestItem URL]);
         [oldestItem setHasPageCache: NO];
     }
 }
@@ -851,7 +851,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
             && [[[self dataSource] representation] isKindOfClass: [WebHTMLRepresentation class]])
         {
             if (![item pageCache]){
-                LOG(PageCache, "Saving page to back/forward cache, %s\n", [[[[self dataSource] _URL] absoluteString] cString]);
+                LOG(PageCache, "Saving page to back/forward cache, %@\n", [[self dataSource] _URL]);
 
                 // Add the items to this page's cache.
                 [self _createPageCacheForItem:item];
@@ -862,7 +862,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
             }
         }
         else {
-            LOG(PageCache, "NOT saving page to back/forward cache, %s\n", [[[[self dataSource] _URL] absoluteString] cString]);
+            LOG(PageCache, "NOT saving page to back/forward cache, %@\n", [[self dataSource] _URL]);
         }
     }
     
@@ -1089,7 +1089,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
 - (void)_handleUnimplementablePolicyWithErrorCode:(int)code forURL:(NSURL *)URL
 {
-    NSError *error = [NSError _webKitErrorWithCode:code failingURL:[URL absoluteString]];
+    NSError *error = [NSError _webKitErrorWithDomain:WebKitErrorDomain code:code URL:URL];
     WebView *wv = [self webView];
     [[wv _policyDelegateForwarder] webView:wv unableToImplementPolicyWithError:error frame:self];    
 }
@@ -1217,7 +1217,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
                 inPageCache = YES;
             }         
             else {
-                LOG (PageCache, "Not restoring page from back/forward cache because cache entry has expired, %s (%3.5f > %3.5f seconds)\n", [[[[_private provisionalItem] URL] absoluteString] cString], delta, [[WebPreferences standardPreferences] _backForwardCacheExpirationInterval]);
+                LOG (PageCache, "Not restoring page from back/forward cache because cache entry has expired, %@ (%3.5f > %3.5f seconds)\n", [[_private provisionalItem] URL], delta, [[WebPreferences standardPreferences] _backForwardCacheExpirationInterval]);
                 [item setHasPageCache: NO];
             }
         }
@@ -1528,7 +1528,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 
     // Don't ask more than once for the same request or if we are loading an empty URL.
     // This avoids confusion on the part of the client.
-    if ([request isEqual:[dataSource _lastCheckedRequest]] || [[[request URL] absoluteString] length] == 0) {
+    if ([request isEqual:[dataSource _lastCheckedRequest]] || [[request URL] _web_isEmpty]) {
         [target performSelector:selector withObject:request withObject:nil];
         return;
     }
@@ -2091,7 +2091,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         [item hasPageCache]){
         NSDictionary *pageCache = [[_private provisionalItem] pageCache];
         if ([pageCache objectForKey:WebCorePageCacheStateKey]){
-            LOG (PageCache, "Restoring page from back/forward cache, %s\n", [[[[_private provisionalItem] URL] absoluteString] cString]);
+            LOG (PageCache, "Restoring page from back/forward cache, %@\n", [[_private provisionalItem] URL]);
             [_private->provisionalDataSource _startLoading: pageCache];
             return;
         }
@@ -2155,7 +2155,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 - (BOOL)_shouldTreatURLAsSameAsCurrent:(NSURL *)URL
 {
     WebHistoryItem *item = [_private currentItem];
-    NSString* URLString = [URL absoluteString];
+    NSString* URLString = [URL _web_originalDataAsString];
     return [URLString isEqual:[item URLString]] || [URLString isEqual:[item originalURLString]];
 }    
 
index 186255549baad5f0423aca180e11e449a72051ec..d745c29d2dd1d938b0c802c063d02c672d074c91 100644 (file)
@@ -375,7 +375,7 @@ static WebHTMLView *lastHitView = nil;
     BOOL clipURLString = NO, clipLabelString = NO;
     
     NSString *label = [element objectForKey: WebElementLinkLabelKey];
-    NSString *urlString = [linkURL absoluteString];
+    NSString *urlString = [linkURL _web_userVisibleString];
     
     if (!label) {
        drawURLString = NO;
index 6ccfa9198c2644da0f33880df591f683c2b014ca..04ebe3a90f8cbc5c29b2e7af4042972b73289641 100644 (file)
@@ -19,6 +19,7 @@
 #import <WebKit/WebDataSourcePrivate.h>
 #import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebKitErrors.h>
+#import <WebKit/WebKitErrorsPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebViewPrivate.h>
 
 
 - (NSError *)cancelledError
 {
-    return [NSError _web_errorWithDomain:NSURLErrorDomain
+    return [NSError _webKitErrorWithDomain:NSURLErrorDomain
                                     code:NSURLErrorCancelled
-                              failingURL:[[request URL] absoluteString]];
+                                     URL:[request URL]];
 }
 
 - (void)setIdentifier: ident
index 30d94c1590a6205f2c0d86cd6e948da1c7f7bac7..be3de1818d2322ff6583eac5a7eb86a0a5ed3b2c 100644 (file)
@@ -86,8 +86,7 @@
 
 - (NSError *)interruptForPolicyChangeError
 {
-    return [NSError _webKitErrorWithCode:WebKitErrorFrameLoadInterruptedByPolicyChange
-                              failingURL:[[request URL] absoluteString]];
+    return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorFrameLoadInterruptedByPolicyChange URL:[request URL]];
 }
 
 -(void)stopLoadingForPolicyChange
index 30d94c1590a6205f2c0d86cd6e948da1c7f7bac7..be3de1818d2322ff6583eac5a7eb86a0a5ed3b2c 100644 (file)
@@ -86,8 +86,7 @@
 
 - (NSError *)interruptForPolicyChangeError
 {
-    return [NSError _webKitErrorWithCode:WebKitErrorFrameLoadInterruptedByPolicyChange
-                              failingURL:[[request URL] absoluteString]];
+    return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorFrameLoadInterruptedByPolicyChange URL:[request URL]];
 }
 
 -(void)stopLoadingForPolicyChange
index e6bbb11893ae1b9bd9bb938bdf87f116e2cbb9b2..bfbb7919037a96a58869774c9db7ed8fef505a2c 100644 (file)
@@ -426,7 +426,7 @@ NS_ENDHANDLER
     if ([URL isFileURL]) {
         locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath];
     } else {
-        locationString = [URL absoluteString];
+        locationString = [URL _web_originalDataAsString];
     }
     
     [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
index 9fcc797e60085056463a80763cbe90cdad61858e..f43d882d504d01c38781986d0c5717bf55b3cfb6 100644 (file)
@@ -800,7 +800,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
     ds = [[self mainFrame] provisionalDataSource];
     if (!ds)
         ds = [[self mainFrame] dataSource];
-    return [[[ds request] URL] absoluteString];
+    return [[[ds request] URL] _web_originalDataAsString];
 }
 
 - (BOOL)isLoading
@@ -816,7 +816,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (NSImage *)mainFrameIcon
 {
-    return [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[self mainFrame] dataSource] _URL] absoluteString] withSize:WebIconSmallSize];
+    return [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[self mainFrame] dataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
 }
 
 @end
index 04a4d91a7794ae3cb2764e4b5bc9445c5dd9343e..6018d5ab0eee9da706184f5f2df8e689a16ab723 100644 (file)
@@ -21,6 +21,7 @@
 #import <WebKit/WebHistoryItemPrivate.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebNSPasteboardExtras.h>
+#import <WebKit/WebNSURLExtras.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebUIDelegate.h>
@@ -445,7 +446,7 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
     [_private->settings setWillLoadImagesAutomatically:[preferences loadsImagesAutomatically]];
 
     if ([preferences userStyleSheetEnabled]) {
-        [_private->settings setUserStyleSheetLocation:[[preferences userStyleSheetLocation] absoluteString]];
+        [_private->settings setUserStyleSheetLocation:[[preferences userStyleSheetLocation] _web_originalDataAsString]];
     } else {
         [_private->settings setUserStyleSheetLocation:@""];
     }