WebKit:
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2004 23:29:24 +0000 (23:29 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2004 23:29:24 +0000 (23:29 +0000)
        Reviewed by Darin.

        * Misc.subproj/WebNSURLExtras.h:
        * Misc.subproj/WebNSURLExtras.m:
        (-[NSURL _web_URLWithLowercasedScheme]):
        new method, returns a URL whose scheme has been tolower'ed

        * English.lproj/StringsNotToBeLocalized.txt:
        Updated for recent changes.

WebBrowser:

        - fixed <rdar://problem/3527598>:
        "(null)" appears for some malformed URLs in location bar

        Reviewed by Darin.

        * BrowserWebController.m:
        (-[BrowserWebView webView:unableToImplementPolicyWithError:frame:]):
        Call new _web_URLWithLowercasedScheme; the old code here was subtly
        transforming some degenerate URLs

        (-[BrowserWebView openURLExternallyWithRequest:inFrame:]):
        New error message to handle the case where [URL scheme] returns nil.

        * English.lproj/Localizable.strings:
        * English.lproj/StringsNotToBeLocalized.txt:
        updated for these changes

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

WebKit/ChangeLog
WebKit/English.lproj/StringsNotToBeLocalized.txt
WebKit/Misc.subproj/WebNSURLExtras.h
WebKit/Misc.subproj/WebNSURLExtras.m

index edb8c4f4c33408ddacf279d78cf3d46fa8048f47..9988a6707dae93ce21841d239c03955995e44ade 100644 (file)
@@ -1,3 +1,15 @@
+2004-02-02  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Darin.
+
+        * Misc.subproj/WebNSURLExtras.h:
+        * Misc.subproj/WebNSURLExtras.m:
+        (-[NSURL _web_URLWithLowercasedScheme]):
+        new method, returns a URL whose scheme has been tolower'ed
+
+        * English.lproj/StringsNotToBeLocalized.txt:
+        Updated for recent changes.
+
 2004-02-02  Chris Blumenberg  <cblu@apple.com>
 
        Fixed: <rdar://problem/3546924>: REGRESSION: dragging text or images over a WebView is jerky
index 3690816ac2168b344a7b7ba40a734137fe557e38..d74609a253d98820d3410516926e23f02791ba77 100644 (file)
 "WebCurrentFrameState"
 "WebDataRequest"
 "WebElementFrame"
+"WebElementHTMLString"
 "WebElementImage"
 "WebElementImageAltString"
 "WebElementImageRect"
 "WebElementImageURL"
+"WebElementIsEditable"
 "WebElementIsSelected"
 "WebElementLinkLabel"
 "WebElementLinkTitle"
index 9fbfbe582daf5c3aab6d334120131a897d03de70..acfea1c2582ef036172ddd251976be74d59a228b 100644 (file)
@@ -16,6 +16,8 @@
 + (NSURL *)_web_URLWithData:(NSData *)data;
 + (NSURL *)_web_URLWithData:(NSData *)data relativeToURL:(NSURL *)baseURL;
 
+- (NSURL *)_web_URLWithLowercasedScheme;
+
 - (NSData *)_web_originalData;
 - (NSString *)_web_originalDataAsString;
 - (const char *)_web_URLCString;
index 9f5ad82d4ce3177c16299f58f350fc45b094698f..3989d6858ee57eec6901ed0a94b0e1733ea52407 100644 (file)
@@ -526,6 +526,47 @@ static NSString *mapHostNames(NSString *string, BOOL encode)
     return [[self _web_originalDataAsString] _web_hasCaseInsensitivePrefix:@"about:"] || [self _web_isEmpty];
 }
 
+- (NSURL *)_web_URLWithLowercasedScheme
+{
+    CFRange range;
+    CFURLGetByteRangeForComponent((CFURLRef)self, kCFURLComponentScheme, &range);
+    if (range.location == kCFNotFound) {
+        return self;
+    }
+    
+    UInt8 static_buffer[URL_BYTES_BUFFER_LENGTH];
+    UInt8 *buffer = static_buffer;
+    CFIndex bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, URL_BYTES_BUFFER_LENGTH);
+    if (bytesFilled == -1) {
+        CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)self, NULL, 0);
+        buffer = malloc(bytesToAllocate);
+        bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, bytesToAllocate);
+        ASSERT(bytesFilled == bytesToAllocate);
+    }
+    
+    int i;
+    BOOL changed = NO;
+    for (i = 0; i < range.length; ++i) {
+        UInt8 c = buffer[range.location + i];
+        UInt8 lower = tolower(c);
+        if (c != lower) {
+            buffer[range.location + i] = lower;
+            changed = YES;
+        }
+    }
+    
+    NSURL *result = changed
+        ? [(NSURL *)CFURLCreateAbsoluteURLWithBytes(NULL, buffer, bytesFilled, kCFStringEncodingUTF8, nil, YES) autorelease]
+        : self;
+
+    if (buffer != static_buffer) {
+        free(buffer);
+    }
+    
+    return result;
+}
+
+
 -(BOOL)_web_hasQuestionMarkOnlyQueryString
 {
     CFRange rangeWithSeparators;