[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:59:39 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 49513661d89beca83c6f389e5d49a65c1f8963c6
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Mar 30 19:43:42 2002 +0000
* Tests/kde/kurl-test.chk: Add test results for new tests. Fix spelling
error in results for one existing test.
* Tests/kde/kurl-test.cpp: Don't bother using endl, since it just makes
things more verbose and doesn't help.
(testURL): Add a new overload to use for relative URL tests.
(main): Add two new tests for relative URLs with colons in them.
* Tools/HotSpotFinder/HotSpotFinder.pbproj/project.pbxproj: Just update to
newer Project Builder.
* Tests/libiftest/IFCheckLeaks.c: Ignore another reported leak,
IOPSAllocateBlitEngine, although I haven't tracked down whether this is a
real leak or not.
* WebCore/src/kwq/KWQKURL.mm: (copyAndReplaceAll), (needToHideColons): New
functions used in workaround for CFURL bug.
(KURL::normalizeRelativeURLString): Add workaround for CFURL bug; hide colons
that would confuse CFURL from the CFURL code.
* WebCore/src/kwq/KWQFont.mm: (QFont::getFont): Use lossyCString instead of cString for
debugging messages.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 96fbabb..bc72533 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,13 @@
+2002-03-30 Darin Adler <darin at apple.com>
+
+ * src/kwq/KWQKURL.mm: (copyAndReplaceAll), (needToHideColons): New
+ functions used in workaround for CFURL bug.
+ (KURL::normalizeRelativeURLString): Add workaround for CFURL bug; hide colons
+ that would confuse CFURL from the CFURL code.
+
+ * src/kwq/KWQFont.mm: (QFont::getFont): Use lossyCString instead of cString for
+ debugging messages.
+
2002-03-30 Maciej Stachowiak <mjs at apple.com>
* src/Makefile.am: Link against JavaScriptCore.framework instead
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 96fbabb..bc72533 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,13 @@
+2002-03-30 Darin Adler <darin at apple.com>
+
+ * src/kwq/KWQKURL.mm: (copyAndReplaceAll), (needToHideColons): New
+ functions used in workaround for CFURL bug.
+ (KURL::normalizeRelativeURLString): Add workaround for CFURL bug; hide colons
+ that would confuse CFURL from the CFURL code.
+
+ * src/kwq/KWQFont.mm: (QFont::getFont): Use lossyCString instead of cString for
+ debugging messages.
+
2002-03-30 Maciej Stachowiak <mjs at apple.com>
* src/Makefile.am: Link against JavaScriptCore.framework instead
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 96fbabb..bc72533 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2002-03-30 Darin Adler <darin at apple.com>
+
+ * src/kwq/KWQKURL.mm: (copyAndReplaceAll), (needToHideColons): New
+ functions used in workaround for CFURL bug.
+ (KURL::normalizeRelativeURLString): Add workaround for CFURL bug; hide colons
+ that would confuse CFURL from the CFURL code.
+
+ * src/kwq/KWQFont.mm: (QFont::getFont): Use lossyCString instead of cString for
+ debugging messages.
+
2002-03-30 Maciej Stachowiak <mjs at apple.com>
* src/Makefile.am: Link against JavaScriptCore.framework instead
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index 5b22a79..059aac0 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -161,7 +161,7 @@ NSFont *QFont::getFont()
NSString *fontKey;
#ifdef DEBUG_GETFONT
getFontCount++;
- fprintf (stdout, "getFountCount = %d, family = %s, traits = 0x%08x, size = %f\n", getFontCount, [_family cString], _trait, _size);
+ fprintf (stdout, "getFountCount = %d, family = %s, traits = 0x%08x, size = %f\n", getFontCount, [_family lossyCString], _trait, _size);
#endif
if (fontCache == nil){
fontCache = [[NSMutableDictionary alloc] init];
@@ -175,21 +175,21 @@ NSFont *QFont::getFont()
_availableFamiles = [[[NSFontManager sharedFontManager] availableFontFamilies] retain];
// FIXME: For now do a simple case insensitive search for a matching font.
- // The font manager requires exact name matches. The will at least address the problem
+ // The font manager requires exact name matches. This will at least address the problem
// of matching arial to Arial, etc.
int i, count = [_availableFamiles count];
NSString *actualFamily;
- for (i = 0; i < count; i++){
+ for (i = 0; i < count; i++) {
actualFamily = [_availableFamiles objectAtIndex: i];
- if ([_family caseInsensitiveCompare: actualFamily] == NSOrderedSame){
+ if ([_family caseInsensitiveCompare: actualFamily] == NSOrderedSame) {
[_family release];
_family = [actualFamily retain];
font = [[NSFontManager sharedFontManager] fontWithFamily:_family traits:_trait weight:5 size:_size];
break;
}
}
- if (font == nil){
- KWQDEBUGLEVEL1(KWQ_LOG_FONTCACHE, "unable to find font for family %s\n", [_family cString]);
+ if (font == nil) {
+ KWQDEBUGLEVEL1(KWQ_LOG_FONTCACHE, "unable to find font for family %s\n", [_family lossyCString]);
loadDefaultFont();
font = [[NSFontManager sharedFontManager] fontWithFamily:defaultFontFamilyName traits:_trait weight:5 size:_size];
}
diff --git a/WebCore/kwq/KWQKURL.mm b/WebCore/kwq/KWQKURL.mm
index d79f967..27a21a1 100644
--- a/WebCore/kwq/KWQKURL.mm
+++ b/WebCore/kwq/KWQKURL.mm
@@ -383,6 +383,40 @@ QString KURL::normalizeURLString(const QString &s)
}
}
+static CFStringRef copyAndReplaceAll(CFStringRef string, CFStringRef stringToFind, CFStringRef replacement)
+{
+ CFMutableStringRef copy = CFStringCreateMutableCopy(0, 0, string);
+ while (true) {
+ CFRange foundSubstring = CFStringFind(copy, stringToFind, 0);
+ if (foundSubstring.location == kCFNotFound) {
+ return copy;
+ }
+ CFStringReplace(copy, foundSubstring, replacement);
+ }
+}
+
+static bool needToHideColons(CFStringRef string)
+{
+ // Do a few quick checks so we don't slow down the normal case too much.
+ // These checks are taken straight out of the buggy code in CFURL.
+
+ CFRange colon = CFStringFind(string, CFSTR(":"), 0);
+ if (colon.location == kCFNotFound) {
+ return false;
+ }
+
+ CFRange hash = CFStringFind(string, CFSTR("#"), kCFCompareBackwards);
+ if (!(hash.location == kCFNotFound || hash.location > colon.location)) {
+ return false;
+ }
+
+ // At this point, we have established the the CFURL code would treat this as
+ // an absolute URL. Now check if there are any "?" or "/" characters before
+ // the first colon; if there are, we need to "hide" the colons.
+ CFRange beforeColon = CFRangeMake(0, colon.location - 1);
+ return CFStringFindWithOptions(string, CFSTR("?"), beforeColon, 0, NULL)
+ || CFStringFindWithOptions(string, CFSTR("/"), beforeColon, 0, NULL);
+}
QString KURL::normalizeRelativeURLString(const KURL &base, const QString &relative)
{
@@ -404,12 +438,36 @@ QString KURL::normalizeRelativeURLString(const KURL &base, const QString &relati
} else {
base.parse();
- CFURLRef relativeURL = CFURLCreateWithString(NULL, relative.getCFMutableString(), base.d->urlRef);
+ CFStringRef relativeURLString = relative.getCFMutableString();
+
+ // Workaround for CFURL bug with colons, Radar 2891336.
+ bool hideColons = needToHideColons(relativeURLString);
+ if (hideColons) {
+ relativeURLString = copyAndReplaceAll(relativeURLString, CFSTR(":"), CFSTR("INTRIGUE_COLON"));
+ }
+
+ CFURLRef relativeURL = CFURLCreateWithString(NULL, relativeURLString, base.d->urlRef);
+
+ if (hideColons) {
+ CFRelease(relativeURLString);
+ }
+
if (relativeURL == NULL) {
result = normalizeURLString(relative);
} else {
CFURLRef absoluteURL = CFURLCopyAbsoluteURL(relativeURL);
- result = normalizeURLString(QString::fromCFString(CFURLGetString(absoluteURL)));
+ CFStringRef absoluteURLString = CFURLGetString(absoluteURL);
+
+ if (hideColons) {
+ absoluteURLString = copyAndReplaceAll(absoluteURLString, CFSTR("INTRIGUE_COLON"), CFSTR(":"));
+ }
+
+ result = normalizeURLString(QString::fromCFString(absoluteURLString));
+
+ if (hideColons) {
+ CFRelease(absoluteURLString);
+ }
+
CFRelease(relativeURL);
CFRelease(absoluteURL);
}
diff --git a/WebCore/src/kwq/KWQFont.mm b/WebCore/src/kwq/KWQFont.mm
index 5b22a79..059aac0 100644
--- a/WebCore/src/kwq/KWQFont.mm
+++ b/WebCore/src/kwq/KWQFont.mm
@@ -161,7 +161,7 @@ NSFont *QFont::getFont()
NSString *fontKey;
#ifdef DEBUG_GETFONT
getFontCount++;
- fprintf (stdout, "getFountCount = %d, family = %s, traits = 0x%08x, size = %f\n", getFontCount, [_family cString], _trait, _size);
+ fprintf (stdout, "getFountCount = %d, family = %s, traits = 0x%08x, size = %f\n", getFontCount, [_family lossyCString], _trait, _size);
#endif
if (fontCache == nil){
fontCache = [[NSMutableDictionary alloc] init];
@@ -175,21 +175,21 @@ NSFont *QFont::getFont()
_availableFamiles = [[[NSFontManager sharedFontManager] availableFontFamilies] retain];
// FIXME: For now do a simple case insensitive search for a matching font.
- // The font manager requires exact name matches. The will at least address the problem
+ // The font manager requires exact name matches. This will at least address the problem
// of matching arial to Arial, etc.
int i, count = [_availableFamiles count];
NSString *actualFamily;
- for (i = 0; i < count; i++){
+ for (i = 0; i < count; i++) {
actualFamily = [_availableFamiles objectAtIndex: i];
- if ([_family caseInsensitiveCompare: actualFamily] == NSOrderedSame){
+ if ([_family caseInsensitiveCompare: actualFamily] == NSOrderedSame) {
[_family release];
_family = [actualFamily retain];
font = [[NSFontManager sharedFontManager] fontWithFamily:_family traits:_trait weight:5 size:_size];
break;
}
}
- if (font == nil){
- KWQDEBUGLEVEL1(KWQ_LOG_FONTCACHE, "unable to find font for family %s\n", [_family cString]);
+ if (font == nil) {
+ KWQDEBUGLEVEL1(KWQ_LOG_FONTCACHE, "unable to find font for family %s\n", [_family lossyCString]);
loadDefaultFont();
font = [[NSFontManager sharedFontManager] fontWithFamily:defaultFontFamilyName traits:_trait weight:5 size:_size];
}
diff --git a/WebCore/src/kwq/KWQKURL.mm b/WebCore/src/kwq/KWQKURL.mm
index d79f967..27a21a1 100644
--- a/WebCore/src/kwq/KWQKURL.mm
+++ b/WebCore/src/kwq/KWQKURL.mm
@@ -383,6 +383,40 @@ QString KURL::normalizeURLString(const QString &s)
}
}
+static CFStringRef copyAndReplaceAll(CFStringRef string, CFStringRef stringToFind, CFStringRef replacement)
+{
+ CFMutableStringRef copy = CFStringCreateMutableCopy(0, 0, string);
+ while (true) {
+ CFRange foundSubstring = CFStringFind(copy, stringToFind, 0);
+ if (foundSubstring.location == kCFNotFound) {
+ return copy;
+ }
+ CFStringReplace(copy, foundSubstring, replacement);
+ }
+}
+
+static bool needToHideColons(CFStringRef string)
+{
+ // Do a few quick checks so we don't slow down the normal case too much.
+ // These checks are taken straight out of the buggy code in CFURL.
+
+ CFRange colon = CFStringFind(string, CFSTR(":"), 0);
+ if (colon.location == kCFNotFound) {
+ return false;
+ }
+
+ CFRange hash = CFStringFind(string, CFSTR("#"), kCFCompareBackwards);
+ if (!(hash.location == kCFNotFound || hash.location > colon.location)) {
+ return false;
+ }
+
+ // At this point, we have established the the CFURL code would treat this as
+ // an absolute URL. Now check if there are any "?" or "/" characters before
+ // the first colon; if there are, we need to "hide" the colons.
+ CFRange beforeColon = CFRangeMake(0, colon.location - 1);
+ return CFStringFindWithOptions(string, CFSTR("?"), beforeColon, 0, NULL)
+ || CFStringFindWithOptions(string, CFSTR("/"), beforeColon, 0, NULL);
+}
QString KURL::normalizeRelativeURLString(const KURL &base, const QString &relative)
{
@@ -404,12 +438,36 @@ QString KURL::normalizeRelativeURLString(const KURL &base, const QString &relati
} else {
base.parse();
- CFURLRef relativeURL = CFURLCreateWithString(NULL, relative.getCFMutableString(), base.d->urlRef);
+ CFStringRef relativeURLString = relative.getCFMutableString();
+
+ // Workaround for CFURL bug with colons, Radar 2891336.
+ bool hideColons = needToHideColons(relativeURLString);
+ if (hideColons) {
+ relativeURLString = copyAndReplaceAll(relativeURLString, CFSTR(":"), CFSTR("INTRIGUE_COLON"));
+ }
+
+ CFURLRef relativeURL = CFURLCreateWithString(NULL, relativeURLString, base.d->urlRef);
+
+ if (hideColons) {
+ CFRelease(relativeURLString);
+ }
+
if (relativeURL == NULL) {
result = normalizeURLString(relative);
} else {
CFURLRef absoluteURL = CFURLCopyAbsoluteURL(relativeURL);
- result = normalizeURLString(QString::fromCFString(CFURLGetString(absoluteURL)));
+ CFStringRef absoluteURLString = CFURLGetString(absoluteURL);
+
+ if (hideColons) {
+ absoluteURLString = copyAndReplaceAll(absoluteURLString, CFSTR("INTRIGUE_COLON"), CFSTR(":"));
+ }
+
+ result = normalizeURLString(QString::fromCFString(absoluteURLString));
+
+ if (hideColons) {
+ CFRelease(absoluteURLString);
+ }
+
CFRelease(relativeURL);
CFRelease(absoluteURL);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list