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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:50:16 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6bd9c67a61a325dea8df3567ed0b6b7e83082325
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 5 22:18:41 2003 +0000

            Reviewed by John
    
    	Fix for this bug:
    
    	<rdar://problem/3365035>: Modify WebNSURLExtras to call improved NSURL creation API
    
            * Misc.subproj/WebNSURLExtras.m:
            (+[NSURL _web_URLWithDataAsString:]): Call through to _web_URLWithDataAsString:relativeToURL:.
            (+[NSURL _web_URLWithDataAsString:relativeToURL:]): Call through to _web_URLWithData:relativeToURL:.
            (+[NSURL _web_URLWithData:]): Ditto.
            (+[NSURL _web_URLWithData:relativeToURL:]): Call CFURLCreateAbsoluteURLWithBytes API in
    	CoreFoundation.
            (-[NSURL _web_originalData]): Use CFURLGetBytes API in CoreFoundation. Also make sure
    	that a relative URL is resolved against its base.
            (-[NSURL _web_displayableString]): Call _web_originalData to get bytes to use
    	to create the string.
            (-[NSURL _web_URLStringLength]): Use CFURLGetBytes API in CoreFoundation.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4772 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ee74d20..8529650 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2003-08-05  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+
+	Fix for this bug:
+
+	<rdar://problem/3365035>: Modify WebNSURLExtras to call improved NSURL creation API
+
+        * Misc.subproj/WebNSURLExtras.m:
+        (+[NSURL _web_URLWithDataAsString:]): Call through to _web_URLWithDataAsString:relativeToURL:.
+        (+[NSURL _web_URLWithDataAsString:relativeToURL:]): Call through to _web_URLWithData:relativeToURL:.
+        (+[NSURL _web_URLWithData:]): Ditto.
+        (+[NSURL _web_URLWithData:relativeToURL:]): Call CFURLCreateAbsoluteURLWithBytes API in
+	CoreFoundation.
+        (-[NSURL _web_originalData]): Use CFURLGetBytes API in CoreFoundation. Also make sure
+	that a relative URL is resolved against its base.
+        (-[NSURL _web_displayableString]): Call _web_originalData to get bytes to use
+	to create the string.
+        (-[NSURL _web_URLStringLength]): Use CFURLGetBytes API in CoreFoundation.
+
 2003-08-04  Richard Williamson  <rjw at apple.com>
 
 	Fixed 3363011.  Pass b/f related key down events to super if b/f is disabled.
diff --git a/WebKit/Misc.subproj/WebNSURLExtras.m b/WebKit/Misc.subproj/WebNSURLExtras.m
index 8ac4c06..314b914 100644
--- a/WebKit/Misc.subproj/WebNSURLExtras.m
+++ b/WebKit/Misc.subproj/WebNSURLExtras.m
@@ -13,10 +13,7 @@
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURL_NSURLExtras.h>
 
-#if 0
-// URL API FIXME: Use new URL API when available
 static int URLBytesBufferLength = 2048;
-#endif
 
 static inline void ReleaseIfNotNULL(CFTypeRef object)
 {
@@ -29,87 +26,91 @@ static inline void ReleaseIfNotNULL(CFTypeRef object)
 
 + (NSURL *)_web_URLWithDataAsString:(NSString *)string
 {
-    return [NSURL _web_URLWithString:string relativeToURL:nil];
-#if 0
-    // URL API FIXME: Use new URL API when available
+    if (string == nil) {
+        return nil;
+    }
     return [self _web_URLWithDataAsString:string relativeToURL:nil];
-#endif 
 }
 
 + (NSURL *)_web_URLWithDataAsString:(NSString *)string relativeToURL:(NSURL *)baseURL
 {
-    return [NSURL _web_URLWithString:string relativeToURL:baseURL];
-#if 0
-    // URL API FIXME: Use new URL API when available
+    if (string == nil) {
+        return nil;
+    }
     string = [string _web_stringByTrimmingWhitespace];
     NSData *data = [string dataUsingEncoding:NSISOLatin1StringEncoding];
     return [self _web_URLWithData:data relativeToURL:baseURL];
-#endif 
 }
 
 + (NSURL *)_web_URLWithData:(NSData *)data
 {
+    if (data == nil) {
+        return nil;
+    }
     return [self _web_URLWithData:data relativeToURL:nil];
 }      
 
 + (NSURL *)_web_URLWithData:(NSData *)data relativeToURL:(NSURL *)baseURL
 {
-    NSString *string = [[[NSString alloc] initWithData:data encoding:NSISOLatin1StringEncoding] autorelease];
-    return [NSURL _web_URLWithString:string relativeToURL:baseURL];
-#if 0
-    // URL API FIXME: Use new URL API when available
-    return (NSURL *)CFURLCreateAbsoluteURLWithBytes(NULL, [data bytes], [data length], kCFStringEncodingISOLatin1, baseURL, YES);
-#endif 
+    if (data == nil) {
+        return nil;
+    }
+
+    NSURL *result = nil;
+    int length = [data length];
+    if (length > 0) {
+        result = (NSURL *)CFURLCreateAbsoluteURLWithBytes(NULL, [data bytes], [data length], kCFStringEncodingISOLatin1, (CFURLRef)baseURL, YES);
+        [result autorelease];
+    }
+    else {
+        result = [NSURL URLWithString:@""];
+    }
+    return result;
 }
 
 - (NSData *)_web_originalData
 {
-    return [[self absoluteString] dataUsingEncoding:NSISOLatin1StringEncoding allowLossyConversion:YES];
-#if 0
-    // URL API FIXME: Use new URL API when available
-    NSData *result = nil;
+    NSData *data = nil;
 
     UInt8 static_buffer[URLBytesBufferLength];
     CFIndex bytesFilled = CFURLGetBytes((CFURLRef)self, static_buffer, URLBytesBufferLength);
     if (bytesFilled != -1) {
-        result = [NSData dataWithBytes:static_buffer length:bytesFilled];
+        data = [NSData dataWithBytes:static_buffer length:bytesFilled];
     }
     else {
         CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)self, NULL, 0);
         UInt8 *buffer = malloc(bytesToAllocate);
         bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, bytesToAllocate);
-        NSURL_ASSERT(bytesFilled == bytesToAllocate);
+        ASSERT(bytesFilled == bytesToAllocate);
         // buffer is adopted by the NSData
-        result = [NSData dataWithBytesNoCopy:buffer length:bytesFilled];
+        data = [NSData dataWithBytesNoCopy:buffer length:bytesFilled];
     }
 
-    return result;
-#endif
+    NSURL *baseURL = (NSURL *)CFURLGetBaseURL((CFURLRef)self);
+    if (baseURL) {
+        NSURL *URL = [NSURL _web_URLWithData:data relativeToURL:baseURL];
+        return [URL _web_originalData];
+    }
+    else {
+        return data;
+    }
 }
 
 - (NSString *)_web_displayableString
 {
-    return [self absoluteString];
-#if 0
-    // URL API FIXME: Use new URL API when available
-    return [[[NSString alloc] initWithData:[self _originalData] encoding:NSISOLatin1StringEncoding] autorelease];
-#endif
+    return [[[NSString alloc] initWithData:[self _web_originalData] encoding:NSISOLatin1StringEncoding] autorelease];
 }
 
 - (int)_web_URLStringLength
 {
-    return [[self _web_displayableString] length];
-#if 0
-    // URL API FIXME: Convert to new URL API when available
     int length = 0;
     if (!CFURLGetBaseURL((CFURLRef)self)) {
         length = CFURLGetBytes((CFURLRef)self, NULL, 0);
     }
     else {
-        length = [[self _displayableString] length];
+        length = [[self _web_displayableString] length];
     }
     return length;
-#endif
 }
 
 - (NSURL *)_webkit_canonicalize

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list