Commit 5f163cc9 authored by benjamin@webkit.org's avatar benjamin@webkit.org
Browse files

Integrate most of GoogleURL in WTFURL

https://bugs.webkit.org/show_bug.cgi?id=97405

Reviewed by Adam Barth.

Source/WebCore: 

Loosen KURLWTFURL to be able to run most tests in Debug.

* platform/KURLWTFURL.cpp:
(WebCore::KURL::KURL):
(WebCore::KURL::hasPort):
(WebCore::KURL::user):
(WebCore::KURL::pass):
(WebCore::KURL::hasPath):
(WebCore::KURL::path):
(WebCore::KURL::query):
(WebCore::KURL::fragmentIdentifier):
(WebCore::KURL::fileSystemPath):

Source/WTF: 

This patch brings almost all of the implementatation of Google-URL in WTFURL
with only minor changes.

The changes from the original code are mostly:
-Code cleaning.
-Replace url_parse::Parsed by URLSegments.
-Replace url_parse::Component by URLComponent
-More code cleaning.
-Adopt URLBuffer and RawURLBuffer instead of the CanonOutputT and RawCanonOutputT.
-Use URLCharacterTypes instead of the litany of characters functions.
-Some more code cleaning.
-Fix the style to match WebKit as much as possible.
-Rename the files to match WebKit style.

* WTF.xcodeproj/project.pbxproj:
* wtf/url/api/ParsedURL.cpp:
(WTF::ParsedURL::ParsedURL):
(WTF::ParsedURL::segment):
* wtf/url/api/ParsedURL.h:
(WTF::ParsedURL::isValid):
* wtf/url/src/RawURLBuffer.h:
* wtf/url/src/URLCanon.h: Added.
(URLCanonicalizer):
(CharsetConverter):
(WTF::URLCanonicalizer::CharsetConverter::CharsetConverter):
(WTF::URLCanonicalizer::CharsetConverter::~CharsetConverter):
(CanonHostInfo):
(WTF::URLCanonicalizer::CanonHostInfo::CanonHostInfo):
(WTF::URLCanonicalizer::CanonHostInfo::IsIPAddress):
(WTF::URLCanonicalizer::CanonHostInfo::AddressLength):
(URLComponentSource):
(WTF::URLCanonicalizer::URLComponentSource::URLComponentSource):
(Replacements):
(WTF::URLCanonicalizer::Replacements::Replacements):
(WTF::URLCanonicalizer::Replacements::SetScheme):
(WTF::URLCanonicalizer::Replacements::IsSchemeOverridden):
(WTF::URLCanonicalizer::Replacements::SetUsername):
(WTF::URLCanonicalizer::Replacements::ClearUsername):
(WTF::URLCanonicalizer::Replacements::IsUsernameOverridden):
(WTF::URLCanonicalizer::Replacements::SetPassword):
(WTF::URLCanonicalizer::Replacements::ClearPassword):
(WTF::URLCanonicalizer::Replacements::IsPasswordOverridden):
(WTF::URLCanonicalizer::Replacements::SetHost):
(WTF::URLCanonicalizer::Replacements::ClearHost):
(WTF::URLCanonicalizer::Replacements::IsHostOverridden):
(WTF::URLCanonicalizer::Replacements::SetPort):
(WTF::URLCanonicalizer::Replacements::ClearPort):
(WTF::URLCanonicalizer::Replacements::IsPortOverridden):
(WTF::URLCanonicalizer::Replacements::SetPath):
(WTF::URLCanonicalizer::Replacements::ClearPath):
(WTF::URLCanonicalizer::Replacements::IsPathOverridden):
(WTF::URLCanonicalizer::Replacements::SetQuery):
(WTF::URLCanonicalizer::Replacements::ClearQuery):
(WTF::URLCanonicalizer::Replacements::IsQueryOverridden):
(WTF::URLCanonicalizer::Replacements::SetRef):
(WTF::URLCanonicalizer::Replacements::ClearRef):
(WTF::URLCanonicalizer::Replacements::IsRefOverridden):
(WTF::URLCanonicalizer::Replacements::sources):
(WTF::URLCanonicalizer::Replacements::components):
(WTF::URLCanonicalizer::Replacements::Placeholder):
* wtf/url/src/URLCanonEtc.cpp: Added.
(WTF::URLCanonicalizer::removeURLWhitespace):
(URLCanonicalizer):
(WTF::URLCanonicalizer::canonicalSchemeChar):
(WTF::URLCanonicalizer::CanonicalizeScheme):
(WTF::URLCanonicalizer::CanonicalizeUserInfo):
(WTF::URLCanonicalizer::CanonicalizePort):
(WTF::URLCanonicalizer::CanonicalizeRef):
* wtf/url/src/URLCanonFilesystemurl.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeFileSystemURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ReplaceFileSystemURL):
* wtf/url/src/URLCanonFileurl.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeFileURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::FileCanonicalizePath):
(WTF::URLCanonicalizer::ReplaceFileURL):
* wtf/url/src/URLCanonHost.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeHost):
(URLCanonicalizer):
(WTF::URLCanonicalizer::CanonicalizeHostVerbose):
* wtf/url/src/URLCanonICU.cpp: Added.
(WTF::URLCanonicalizer::IDNToASCII):
(URLCanonicalizer):
(WTF::URLCanonicalizer::readUTFChar):
* wtf/url/src/URLCanonIP.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeIPAddress):
(URLCanonicalizer):
* wtf/url/src/URLCanonInternal.cpp: Added.
(URLCanonicalizer):
(WTF::URLCanonicalizer::AppendInvalidNarrowString):
(WTF::URLCanonicalizer::ConvertUTF16ToUTF8):
(WTF::URLCanonicalizer::ConvertUTF8ToUTF16):
(WTF::URLCanonicalizer::SetupOverrideComponents):
(WTF::URLCanonicalizer::SetupUTF16OverrideComponents):
(WTF::URLCanonicalizer::_itoa_s):
(WTF::URLCanonicalizer::_itow_s):
* wtf/url/src/URLCanonInternal.h: Added.
(URLCanonicalizer):
(WTF::URLCanonicalizer::hexCharToValue):
(WTF::URLCanonicalizer::isDot):
(WTF::URLCanonicalizer::appendURLEscapedCharacter):
(WTF::URLCanonicalizer::doAppendUTF8):
(WTF::URLCanonicalizer::AppendCharToOutput):
(WTF::URLCanonicalizer::AppendUTF8Value):
(WTF::URLCanonicalizer::AppendUTF8EscapedValue):
(WTF::URLCanonicalizer::AppendUTF16Value):
(WTF::URLCanonicalizer::AppendUTF8EscapedChar):
(WTF::URLCanonicalizer::Is8BitChar):
(WTF::URLCanonicalizer::DecodeEscaped):
(WTF::URLCanonicalizer::_itoa_s):
(WTF::URLCanonicalizer::_itow_s):
(WTF::URLCanonicalizer::_strtoui64):
* wtf/url/src/URLCanonMailto.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeMailtoURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ReplaceMailtoURL):
* wtf/url/src/URLCanonPath.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizePath):
(URLCanonicalizer):
(WTF::URLCanonicalizer::CanonicalizePartialPath):
* wtf/url/src/URLCanonPathurl.cpp: Added.
(WTF::URLCanonicalizer::canonicalizePathURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ReplacePathURL):
* wtf/url/src/URLCanonQuery.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeQuery):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ConvertUTF16ToQueryEncoding):
* wtf/url/src/URLCanonRelative.cpp: Added.
(WTF::URLCanonicalizer::isRelativeURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::resolveRelativeURL):
* wtf/url/src/URLCanonStdURL.cpp: Added.
(WTF::URLCanonicalizer::DefaultPortForScheme):
(URLCanonicalizer):
(WTF::URLCanonicalizer::CanonicalizeStandardURL):
(WTF::URLCanonicalizer::ReplaceStandardURL):
* wtf/url/src/URLCharacterTypes.cpp:
* wtf/url/src/URLCharacterTypes.h:
(WTF::URLCharacterTypes::isComponentChar):
(WTF::URLCharacterTypes::isHexChar):
(WTF::URLCharacterTypes::isIPv4Char):
(WTF::URLCharacterTypes::isQueryChar):
(WTF::URLCharacterTypes::isCharacterOfType):
(URLCharacterTypes):
* wtf/url/src/URLEscape.cpp: Removed.
* wtf/url/src/URLFile.h: Added.
(URLParser):
(WTF::URLParser::isWindowsDriveSeparator):
(WTF::URLParser::isWindowsDriveLetter):
(WTF::URLParser::findNextSlash):
(WTF::URLParser::doesBeginWindowsDriveSpec):
(WTF::URLParser::doesBeginUNCPath):
* wtf/url/src/URLParse.cpp: Added.
(WTF::URLParser::ExtractScheme):
(URLParser):
(WTF::URLParser::IsAuthorityTerminator):
(WTF::URLParser::ExtractFileName):
(WTF::URLParser::ExtractQueryKeyValue):
(WTF::URLParser::ParseAuthority):
(WTF::URLParser::ParsePort):
(WTF::URLParser::ParseStandardURL):
(WTF::URLParser::ParsePathURL):
(WTF::URLParser::ParseFileSystemURL):
(WTF::URLParser::ParseMailtoURL):
(WTF::URLParser::parsePathInternal):
(WTF::URLParser::ParseAfterScheme):
* wtf/url/src/URLParse.h: Added.
(URLParser):
* wtf/url/src/URLParseFile.cpp: Added.
(WTF):
(WTF::URLParser::ParseFileURL):
(URLParser):
* wtf/url/src/URLParseInternal.h: Added.
(URLParser):
(WTF::URLParser::isURLSlash):
(WTF::URLParser::shouldTrimFromURL):
(WTF::URLParser::trimURL):
(WTF::URLParser::countConsecutiveSlashes):
* wtf/url/src/URLParser.h: Removed.
* wtf/url/src/URLQueryCanonicalizer.h: Removed.
* wtf/url/src/URLSegments.cpp:
* wtf/url/src/URLSegments.h:
(WTF::URLSegments::URLSegments):
(URLSegments):
(WTF::URLSegments::operator=):
(WTF::URLSegments::innerURLSegments):
(WTF::URLSegments::setInnerURLSegments):
(WTF::URLSegments::clearInnerURLSegments):
* wtf/url/src/URLUtil.cpp: Added.
(URLUtilities):
(WTF::URLUtilities::IsStandard):
(WTF::URLUtilities::FindAndCompareScheme):
(WTF::URLUtilities::Canonicalize):
(WTF::URLUtilities::resolveRelative):
(WTF::URLUtilities::ReplaceComponents):
(WTF::URLUtilities::LowerCaseEqualsASCII):
(WTF::URLUtilities::DecodeURLEscapeSequences):
(WTF::URLUtilities::EncodeURIComponent):
(WTF::URLUtilities::CompareSchemeComponent):
* wtf/url/src/URLUtil.h: Added.
(URLUtilities):
* wtf/url/src/URLUtilInternal.h: Renamed from Source/WTF/wtf/url/src/URLEscape.h.
(URLUtilities):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129412 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5678f008
2012-09-24 Benjamin Poulain <benjamin@webkit.org>
Integrate most of GoogleURL in WTFURL
https://bugs.webkit.org/show_bug.cgi?id=97405
Reviewed by Adam Barth.
This patch brings almost all of the implementatation of Google-URL in WTFURL
with only minor changes.
The changes from the original code are mostly:
-Code cleaning.
-Replace url_parse::Parsed by URLSegments.
-Replace url_parse::Component by URLComponent
-More code cleaning.
-Adopt URLBuffer and RawURLBuffer instead of the CanonOutputT and RawCanonOutputT.
-Use URLCharacterTypes instead of the litany of characters functions.
-Some more code cleaning.
-Fix the style to match WebKit as much as possible.
-Rename the files to match WebKit style.
* WTF.xcodeproj/project.pbxproj:
* wtf/url/api/ParsedURL.cpp:
(WTF::ParsedURL::ParsedURL):
(WTF::ParsedURL::segment):
* wtf/url/api/ParsedURL.h:
(WTF::ParsedURL::isValid):
* wtf/url/src/RawURLBuffer.h:
* wtf/url/src/URLCanon.h: Added.
(URLCanonicalizer):
(CharsetConverter):
(WTF::URLCanonicalizer::CharsetConverter::CharsetConverter):
(WTF::URLCanonicalizer::CharsetConverter::~CharsetConverter):
(CanonHostInfo):
(WTF::URLCanonicalizer::CanonHostInfo::CanonHostInfo):
(WTF::URLCanonicalizer::CanonHostInfo::IsIPAddress):
(WTF::URLCanonicalizer::CanonHostInfo::AddressLength):
(URLComponentSource):
(WTF::URLCanonicalizer::URLComponentSource::URLComponentSource):
(Replacements):
(WTF::URLCanonicalizer::Replacements::Replacements):
(WTF::URLCanonicalizer::Replacements::SetScheme):
(WTF::URLCanonicalizer::Replacements::IsSchemeOverridden):
(WTF::URLCanonicalizer::Replacements::SetUsername):
(WTF::URLCanonicalizer::Replacements::ClearUsername):
(WTF::URLCanonicalizer::Replacements::IsUsernameOverridden):
(WTF::URLCanonicalizer::Replacements::SetPassword):
(WTF::URLCanonicalizer::Replacements::ClearPassword):
(WTF::URLCanonicalizer::Replacements::IsPasswordOverridden):
(WTF::URLCanonicalizer::Replacements::SetHost):
(WTF::URLCanonicalizer::Replacements::ClearHost):
(WTF::URLCanonicalizer::Replacements::IsHostOverridden):
(WTF::URLCanonicalizer::Replacements::SetPort):
(WTF::URLCanonicalizer::Replacements::ClearPort):
(WTF::URLCanonicalizer::Replacements::IsPortOverridden):
(WTF::URLCanonicalizer::Replacements::SetPath):
(WTF::URLCanonicalizer::Replacements::ClearPath):
(WTF::URLCanonicalizer::Replacements::IsPathOverridden):
(WTF::URLCanonicalizer::Replacements::SetQuery):
(WTF::URLCanonicalizer::Replacements::ClearQuery):
(WTF::URLCanonicalizer::Replacements::IsQueryOverridden):
(WTF::URLCanonicalizer::Replacements::SetRef):
(WTF::URLCanonicalizer::Replacements::ClearRef):
(WTF::URLCanonicalizer::Replacements::IsRefOverridden):
(WTF::URLCanonicalizer::Replacements::sources):
(WTF::URLCanonicalizer::Replacements::components):
(WTF::URLCanonicalizer::Replacements::Placeholder):
* wtf/url/src/URLCanonEtc.cpp: Added.
(WTF::URLCanonicalizer::removeURLWhitespace):
(URLCanonicalizer):
(WTF::URLCanonicalizer::canonicalSchemeChar):
(WTF::URLCanonicalizer::CanonicalizeScheme):
(WTF::URLCanonicalizer::CanonicalizeUserInfo):
(WTF::URLCanonicalizer::CanonicalizePort):
(WTF::URLCanonicalizer::CanonicalizeRef):
* wtf/url/src/URLCanonFilesystemurl.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeFileSystemURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ReplaceFileSystemURL):
* wtf/url/src/URLCanonFileurl.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeFileURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::FileCanonicalizePath):
(WTF::URLCanonicalizer::ReplaceFileURL):
* wtf/url/src/URLCanonHost.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeHost):
(URLCanonicalizer):
(WTF::URLCanonicalizer::CanonicalizeHostVerbose):
* wtf/url/src/URLCanonICU.cpp: Added.
(WTF::URLCanonicalizer::IDNToASCII):
(URLCanonicalizer):
(WTF::URLCanonicalizer::readUTFChar):
* wtf/url/src/URLCanonIP.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeIPAddress):
(URLCanonicalizer):
* wtf/url/src/URLCanonInternal.cpp: Added.
(URLCanonicalizer):
(WTF::URLCanonicalizer::AppendInvalidNarrowString):
(WTF::URLCanonicalizer::ConvertUTF16ToUTF8):
(WTF::URLCanonicalizer::ConvertUTF8ToUTF16):
(WTF::URLCanonicalizer::SetupOverrideComponents):
(WTF::URLCanonicalizer::SetupUTF16OverrideComponents):
(WTF::URLCanonicalizer::_itoa_s):
(WTF::URLCanonicalizer::_itow_s):
* wtf/url/src/URLCanonInternal.h: Added.
(URLCanonicalizer):
(WTF::URLCanonicalizer::hexCharToValue):
(WTF::URLCanonicalizer::isDot):
(WTF::URLCanonicalizer::appendURLEscapedCharacter):
(WTF::URLCanonicalizer::doAppendUTF8):
(WTF::URLCanonicalizer::AppendCharToOutput):
(WTF::URLCanonicalizer::AppendUTF8Value):
(WTF::URLCanonicalizer::AppendUTF8EscapedValue):
(WTF::URLCanonicalizer::AppendUTF16Value):
(WTF::URLCanonicalizer::AppendUTF8EscapedChar):
(WTF::URLCanonicalizer::Is8BitChar):
(WTF::URLCanonicalizer::DecodeEscaped):
(WTF::URLCanonicalizer::_itoa_s):
(WTF::URLCanonicalizer::_itow_s):
(WTF::URLCanonicalizer::_strtoui64):
* wtf/url/src/URLCanonMailto.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeMailtoURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ReplaceMailtoURL):
* wtf/url/src/URLCanonPath.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizePath):
(URLCanonicalizer):
(WTF::URLCanonicalizer::CanonicalizePartialPath):
* wtf/url/src/URLCanonPathurl.cpp: Added.
(WTF::URLCanonicalizer::canonicalizePathURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ReplacePathURL):
* wtf/url/src/URLCanonQuery.cpp: Added.
(WTF::URLCanonicalizer::CanonicalizeQuery):
(URLCanonicalizer):
(WTF::URLCanonicalizer::ConvertUTF16ToQueryEncoding):
* wtf/url/src/URLCanonRelative.cpp: Added.
(WTF::URLCanonicalizer::isRelativeURL):
(URLCanonicalizer):
(WTF::URLCanonicalizer::resolveRelativeURL):
* wtf/url/src/URLCanonStdURL.cpp: Added.
(WTF::URLCanonicalizer::DefaultPortForScheme):
(URLCanonicalizer):
(WTF::URLCanonicalizer::CanonicalizeStandardURL):
(WTF::URLCanonicalizer::ReplaceStandardURL):
* wtf/url/src/URLCharacterTypes.cpp:
* wtf/url/src/URLCharacterTypes.h:
(WTF::URLCharacterTypes::isComponentChar):
(WTF::URLCharacterTypes::isHexChar):
(WTF::URLCharacterTypes::isIPv4Char):
(WTF::URLCharacterTypes::isQueryChar):
(WTF::URLCharacterTypes::isCharacterOfType):
(URLCharacterTypes):
* wtf/url/src/URLEscape.cpp: Removed.
* wtf/url/src/URLFile.h: Added.
(URLParser):
(WTF::URLParser::isWindowsDriveSeparator):
(WTF::URLParser::isWindowsDriveLetter):
(WTF::URLParser::findNextSlash):
(WTF::URLParser::doesBeginWindowsDriveSpec):
(WTF::URLParser::doesBeginUNCPath):
* wtf/url/src/URLParse.cpp: Added.
(WTF::URLParser::ExtractScheme):
(URLParser):
(WTF::URLParser::IsAuthorityTerminator):
(WTF::URLParser::ExtractFileName):
(WTF::URLParser::ExtractQueryKeyValue):
(WTF::URLParser::ParseAuthority):
(WTF::URLParser::ParsePort):
(WTF::URLParser::ParseStandardURL):
(WTF::URLParser::ParsePathURL):
(WTF::URLParser::ParseFileSystemURL):
(WTF::URLParser::ParseMailtoURL):
(WTF::URLParser::parsePathInternal):
(WTF::URLParser::ParseAfterScheme):
* wtf/url/src/URLParse.h: Added.
(URLParser):
* wtf/url/src/URLParseFile.cpp: Added.
(WTF):
(WTF::URLParser::ParseFileURL):
(URLParser):
* wtf/url/src/URLParseInternal.h: Added.
(URLParser):
(WTF::URLParser::isURLSlash):
(WTF::URLParser::shouldTrimFromURL):
(WTF::URLParser::trimURL):
(WTF::URLParser::countConsecutiveSlashes):
* wtf/url/src/URLParser.h: Removed.
* wtf/url/src/URLQueryCanonicalizer.h: Removed.
* wtf/url/src/URLSegments.cpp:
* wtf/url/src/URLSegments.h:
(WTF::URLSegments::URLSegments):
(URLSegments):
(WTF::URLSegments::operator=):
(WTF::URLSegments::innerURLSegments):
(WTF::URLSegments::setInnerURLSegments):
(WTF::URLSegments::clearInnerURLSegments):
* wtf/url/src/URLUtil.cpp: Added.
(URLUtilities):
(WTF::URLUtilities::IsStandard):
(WTF::URLUtilities::FindAndCompareScheme):
(WTF::URLUtilities::Canonicalize):
(WTF::URLUtilities::resolveRelative):
(WTF::URLUtilities::ReplaceComponents):
(WTF::URLUtilities::LowerCaseEqualsASCII):
(WTF::URLUtilities::DecodeURLEscapeSequences):
(WTF::URLUtilities::EncodeURIComponent):
(WTF::URLUtilities::CompareSchemeComponent):
* wtf/url/src/URLUtil.h: Added.
(URLUtilities):
* wtf/url/src/URLUtilInternal.h: Renamed from Source/WTF/wtf/url/src/URLEscape.h.
(URLUtilities):
2012-09-24 Joone Hur <joone.hur@intel.com>
[GTK] Implement GraphicsLayer using Clutter
......
......@@ -12,6 +12,29 @@
143F61201565F0F900DB514A /* RAMSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 143F611E1565F0F900DB514A /* RAMSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */; settings = {ATTRIBUTES = (Private, ); }; };
26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */; };
26E6C1EE1609037300CA6AF4 /* URLCanonEtc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1CE1609037300CA6AF4 /* URLCanonEtc.cpp */; };
26E6C1EF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1CF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp */; };
26E6C1F01609037300CA6AF4 /* URLCanonFileurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D01609037300CA6AF4 /* URLCanonFileurl.cpp */; };
26E6C1F11609037300CA6AF4 /* URLCanonHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D11609037300CA6AF4 /* URLCanonHost.cpp */; };
26E6C1F21609037300CA6AF4 /* URLCanonICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D21609037300CA6AF4 /* URLCanonICU.cpp */; };
26E6C1F51609037300CA6AF4 /* URLCanonInternal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D51609037300CA6AF4 /* URLCanonInternal.cpp */; };
26E6C1F61609037300CA6AF4 /* URLCanonInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1D61609037300CA6AF4 /* URLCanonInternal.h */; };
26E6C1F71609037300CA6AF4 /* URLCanonIP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D71609037300CA6AF4 /* URLCanonIP.cpp */; };
26E6C1F91609037300CA6AF4 /* URLCanonMailto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D91609037300CA6AF4 /* URLCanonMailto.cpp */; };
26E6C1FA1609037300CA6AF4 /* URLCanonPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DA1609037300CA6AF4 /* URLCanonPath.cpp */; };
26E6C1FB1609037300CA6AF4 /* URLCanonPathurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DB1609037300CA6AF4 /* URLCanonPathurl.cpp */; };
26E6C1FC1609037300CA6AF4 /* URLCanonQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DC1609037300CA6AF4 /* URLCanonQuery.cpp */; };
26E6C1FD1609037300CA6AF4 /* URLCanonRelative.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DD1609037300CA6AF4 /* URLCanonRelative.cpp */; };
26E6C1FF1609037300CA6AF4 /* URLCanonStdURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DF1609037300CA6AF4 /* URLCanonStdURL.cpp */; };
26E6C2011609037300CA6AF4 /* URLCanon.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E11609037300CA6AF4 /* URLCanon.h */; };
26E6C2031609037300CA6AF4 /* URLFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E31609037300CA6AF4 /* URLFile.h */; };
26E6C2041609037300CA6AF4 /* URLParseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1E41609037300CA6AF4 /* URLParseFile.cpp */; };
26E6C2051609037300CA6AF4 /* URLParseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E51609037300CA6AF4 /* URLParseInternal.h */; };
26E6C2071609037300CA6AF4 /* URLParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1E71609037300CA6AF4 /* URLParse.cpp */; };
26E6C2081609037300CA6AF4 /* URLParse.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E81609037300CA6AF4 /* URLParse.h */; };
26E6C20A1609037300CA6AF4 /* URLUtilInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1EA1609037300CA6AF4 /* URLUtilInternal.h */; };
26E6C20C1609037300CA6AF4 /* URLUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1EC1609037300CA6AF4 /* URLUtil.cpp */; };
26E6C20D1609037300CA6AF4 /* URLUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1ED1609037300CA6AF4 /* URLUtil.h */; };
2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C05385315BC819000F21B96 /* GregorianDateTime.h */; };
2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4330F38E15745B0500AAFA8F /* URLString.cpp */; };
......@@ -237,10 +260,6 @@
A8A47474151A825B004123FF /* URLCharacterTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47366151A825B004123FF /* URLCharacterTypes.cpp */; };
A8A47475151A825B004123FF /* URLCharacterTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47367151A825B004123FF /* URLCharacterTypes.h */; };
A8A47476151A825B004123FF /* URLComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47368151A825B004123FF /* URLComponent.h */; };
A8A47477151A825B004123FF /* URLEscape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47369151A825B004123FF /* URLEscape.cpp */; };
A8A47478151A825B004123FF /* URLEscape.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736A151A825B004123FF /* URLEscape.h */; };
A8A47479151A825B004123FF /* URLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736B151A825B004123FF /* URLParser.h */; };
A8A4747A151A825B004123FF /* URLQueryCanonicalizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736C151A825B004123FF /* URLQueryCanonicalizer.h */; };
A8A4747B151A825B004123FF /* URLSegments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4736D151A825B004123FF /* URLSegments.cpp */; };
A8A4747C151A825B004123FF /* URLSegments.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736E151A825B004123FF /* URLSegments.h */; };
A8A4747D151A825B004123FF /* ValueCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736F151A825B004123FF /* ValueCheck.h */; };
......@@ -260,6 +279,29 @@
143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; };
14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaturatedArithmetic.h; sourceTree = "<group>"; };
26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegerToStringConversion.h; sourceTree = "<group>"; };
26E6C1CE1609037300CA6AF4 /* URLCanonEtc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonEtc.cpp; sourceTree = "<group>"; };
26E6C1CF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonFilesystemurl.cpp; sourceTree = "<group>"; };
26E6C1D01609037300CA6AF4 /* URLCanonFileurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonFileurl.cpp; sourceTree = "<group>"; };
26E6C1D11609037300CA6AF4 /* URLCanonHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonHost.cpp; sourceTree = "<group>"; };
26E6C1D21609037300CA6AF4 /* URLCanonICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonICU.cpp; sourceTree = "<group>"; };
26E6C1D51609037300CA6AF4 /* URLCanonInternal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonInternal.cpp; sourceTree = "<group>"; };
26E6C1D61609037300CA6AF4 /* URLCanonInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLCanonInternal.h; sourceTree = "<group>"; };
26E6C1D71609037300CA6AF4 /* URLCanonIP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonIP.cpp; sourceTree = "<group>"; };
26E6C1D91609037300CA6AF4 /* URLCanonMailto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonMailto.cpp; sourceTree = "<group>"; };
26E6C1DA1609037300CA6AF4 /* URLCanonPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonPath.cpp; sourceTree = "<group>"; };
26E6C1DB1609037300CA6AF4 /* URLCanonPathurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonPathurl.cpp; sourceTree = "<group>"; };
26E6C1DC1609037300CA6AF4 /* URLCanonQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonQuery.cpp; sourceTree = "<group>"; };
26E6C1DD1609037300CA6AF4 /* URLCanonRelative.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonRelative.cpp; sourceTree = "<group>"; };
26E6C1DF1609037300CA6AF4 /* URLCanonStdURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonStdURL.cpp; sourceTree = "<group>"; };
26E6C1E11609037300CA6AF4 /* URLCanon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLCanon.h; sourceTree = "<group>"; };
26E6C1E31609037300CA6AF4 /* URLFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLFile.h; sourceTree = "<group>"; };
26E6C1E41609037300CA6AF4 /* URLParseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParseFile.cpp; sourceTree = "<group>"; };
26E6C1E51609037300CA6AF4 /* URLParseInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParseInternal.h; sourceTree = "<group>"; };
26E6C1E71609037300CA6AF4 /* URLParse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParse.cpp; sourceTree = "<group>"; };
26E6C1E81609037300CA6AF4 /* URLParse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParse.h; sourceTree = "<group>"; };
26E6C1EA1609037300CA6AF4 /* URLUtilInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLUtilInternal.h; sourceTree = "<group>"; };
26E6C1EC1609037300CA6AF4 /* URLUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLUtil.cpp; sourceTree = "<group>"; };
26E6C1ED1609037300CA6AF4 /* URLUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLUtil.h; sourceTree = "<group>"; };
2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; };
2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; };
4330F38E15745B0500AAFA8F /* URLString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLString.cpp; sourceTree = "<group>"; };
......@@ -494,10 +536,6 @@
A8A47366151A825B004123FF /* URLCharacterTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCharacterTypes.cpp; sourceTree = "<group>"; };
A8A47367151A825B004123FF /* URLCharacterTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLCharacterTypes.h; sourceTree = "<group>"; };
A8A47368151A825B004123FF /* URLComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLComponent.h; sourceTree = "<group>"; };
A8A47369151A825B004123FF /* URLEscape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLEscape.cpp; sourceTree = "<group>"; };
A8A4736A151A825B004123FF /* URLEscape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLEscape.h; sourceTree = "<group>"; };
A8A4736B151A825B004123FF /* URLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParser.h; sourceTree = "<group>"; };
A8A4736C151A825B004123FF /* URLQueryCanonicalizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLQueryCanonicalizer.h; sourceTree = "<group>"; };
A8A4736D151A825B004123FF /* URLSegments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSegments.cpp; sourceTree = "<group>"; };
A8A4736E151A825B004123FF /* URLSegments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLSegments.h; sourceTree = "<group>"; };
A8A4736F151A825B004123FF /* ValueCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueCheck.h; sourceTree = "<group>"; };
......@@ -873,15 +911,34 @@
children = (
A8A47364151A825B004123FF /* RawURLBuffer.h */,
A8A47365151A825B004123FF /* URLBuffer.h */,
26E6C1E11609037300CA6AF4 /* URLCanon.h */,
26E6C1CE1609037300CA6AF4 /* URLCanonEtc.cpp */,
26E6C1CF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp */,
26E6C1D01609037300CA6AF4 /* URLCanonFileurl.cpp */,
26E6C1D11609037300CA6AF4 /* URLCanonHost.cpp */,
26E6C1D21609037300CA6AF4 /* URLCanonICU.cpp */,
26E6C1D51609037300CA6AF4 /* URLCanonInternal.cpp */,
26E6C1D61609037300CA6AF4 /* URLCanonInternal.h */,
26E6C1D71609037300CA6AF4 /* URLCanonIP.cpp */,
26E6C1D91609037300CA6AF4 /* URLCanonMailto.cpp */,
26E6C1DA1609037300CA6AF4 /* URLCanonPath.cpp */,
26E6C1DB1609037300CA6AF4 /* URLCanonPathurl.cpp */,
26E6C1DC1609037300CA6AF4 /* URLCanonQuery.cpp */,
26E6C1DD1609037300CA6AF4 /* URLCanonRelative.cpp */,
26E6C1DF1609037300CA6AF4 /* URLCanonStdURL.cpp */,
A8A47366151A825B004123FF /* URLCharacterTypes.cpp */,
A8A47367151A825B004123FF /* URLCharacterTypes.h */,
A8A47368151A825B004123FF /* URLComponent.h */,
A8A47369151A825B004123FF /* URLEscape.cpp */,
A8A4736A151A825B004123FF /* URLEscape.h */,
A8A4736B151A825B004123FF /* URLParser.h */,
A8A4736C151A825B004123FF /* URLQueryCanonicalizer.h */,
26E6C1E31609037300CA6AF4 /* URLFile.h */,
26E6C1E71609037300CA6AF4 /* URLParse.cpp */,
26E6C1E81609037300CA6AF4 /* URLParse.h */,
26E6C1E41609037300CA6AF4 /* URLParseFile.cpp */,
26E6C1E51609037300CA6AF4 /* URLParseInternal.h */,
A8A4736D151A825B004123FF /* URLSegments.cpp */,
A8A4736E151A825B004123FF /* URLSegments.h */,
26E6C1EC1609037300CA6AF4 /* URLUtil.cpp */,
26E6C1ED1609037300CA6AF4 /* URLUtil.h */,
26E6C1EA1609037300CA6AF4 /* URLUtilInternal.h */,
);
path = src;
sourceTree = "<group>";
......@@ -1062,9 +1119,6 @@
A8A47473151A825B004123FF /* URLBuffer.h in Headers */,
A8A47475151A825B004123FF /* URLCharacterTypes.h in Headers */,
A8A47476151A825B004123FF /* URLComponent.h in Headers */,
A8A47478151A825B004123FF /* URLEscape.h in Headers */,
A8A47479151A825B004123FF /* URLParser.h in Headers */,
A8A4747A151A825B004123FF /* URLQueryCanonicalizer.h in Headers */,
A8A4747C151A825B004123FF /* URLSegments.h in Headers */,
A8A47471151A825B004123FF /* URLString.h in Headers */,
A8A4746A151A825B004123FF /* UTF8.h in Headers */,
......@@ -1076,6 +1130,13 @@
A8A47446151A825B004123FF /* WTFString.h in Headers */,
A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
4F1D115415FF11BE0026E908 /* MemoryInstrumentation.h in Headers */,
26E6C1F61609037300CA6AF4 /* URLCanonInternal.h in Headers */,
26E6C2011609037300CA6AF4 /* URLCanon.h in Headers */,
26E6C2031609037300CA6AF4 /* URLFile.h in Headers */,
26E6C2051609037300CA6AF4 /* URLParseInternal.h in Headers */,
26E6C2081609037300CA6AF4 /* URLParse.h in Headers */,
26E6C20A1609037300CA6AF4 /* URLUtilInternal.h in Headers */,
26E6C20D1609037300CA6AF4 /* URLUtil.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1219,10 +1280,25 @@
A8A4744A151A825B004123FF /* Threading.cpp in Sources */,
A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */,
A8A47458151A825B004123FF /* TypeTraits.cpp in Sources */,
26E6C1EE1609037300CA6AF4 /* URLCanonEtc.cpp in Sources */,
26E6C1EF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp in Sources */,
26E6C1F01609037300CA6AF4 /* URLCanonFileurl.cpp in Sources */,
26E6C1F11609037300CA6AF4 /* URLCanonHost.cpp in Sources */,
26E6C1F21609037300CA6AF4 /* URLCanonICU.cpp in Sources */,
26E6C1F51609037300CA6AF4 /* URLCanonInternal.cpp in Sources */,
26E6C1F71609037300CA6AF4 /* URLCanonIP.cpp in Sources */,
26E6C1F91609037300CA6AF4 /* URLCanonMailto.cpp in Sources */,
26E6C1FA1609037300CA6AF4 /* URLCanonPath.cpp in Sources */,
26E6C1FB1609037300CA6AF4 /* URLCanonPathurl.cpp in Sources */,
26E6C1FC1609037300CA6AF4 /* URLCanonQuery.cpp in Sources */,
26E6C1FD1609037300CA6AF4 /* URLCanonRelative.cpp in Sources */,
26E6C1FF1609037300CA6AF4 /* URLCanonStdURL.cpp in Sources */,
A8A47474151A825B004123FF /* URLCharacterTypes.cpp in Sources */,
A8A47477151A825B004123FF /* URLEscape.cpp in Sources */,
26E6C2041609037300CA6AF4 /* URLParseFile.cpp in Sources */,
26E6C2071609037300CA6AF4 /* URLParse.cpp in Sources */,
A8A4747B151A825B004123FF /* URLSegments.cpp in Sources */,
4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */,
26E6C20C1609037300CA6AF4 /* URLUtil.cpp in Sources */,
A8A47469151A825B004123FF /* UTF8.cpp in Sources */,
A8A47445151A825B004123FF /* WTFString.cpp in Sources */,
A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */,
......
......@@ -33,23 +33,38 @@
#include <wtf/MemoryInstrumentation.h>
#include <wtf/RawURLBuffer.h>
#include <wtf/URLComponent.h>
#include <wtf/URLParser.h>
#include <wtf/URLUtil.h>
#include <wtf/text/CString.h>
namespace WTF {
ParsedURL::ParsedURL(const String& urlString)
{
if (urlString.isEmpty()) {
m_spec = URLString();
return;
}
unsigned urlStringLength = urlString.length();
if (!urlStringLength)
return; // FIXME: we should ASSERT on this, but people use KURL incorrectly with ParsedURLStringTag :(.
RawURLBuffer<char> outputBuffer;
String base;
const CString& baseStr = base.utf8();
bool isValid = false;
URLSegments baseSegments;
// FIXME: handle invalid urlString.
m_spec = URLString(urlString);
// FIXME: we should take shortcuts here! We do not have to resolve the relative part.
if (urlString.is8Bit())
URLParser<LChar>::parseStandardURL(urlString.characters8(), urlString.length(), m_segments);
isValid = URLUtilities::resolveRelative(baseStr.data(), baseSegments,
reinterpret_cast<const char*>(urlString.characters8()), urlStringLength,
/* charsetConverter */ 0,
outputBuffer, &m_segments);
else
URLParser<UChar>::parseStandardURL(urlString.characters16(), urlString.length(), m_segments);
isValid = URLUtilities::resolveRelative(baseStr.data(), baseSegments,
urlString.characters16(), urlStringLength,
/* charsetConverter */ 0,
outputBuffer, &m_segments);
// FIXME: we should ASSERT on isValid, but people use KURL incorrectly with ParsedURLStringTag :(.
if (isValid)
m_spec = URLString(String(outputBuffer.data(), outputBuffer.length()));
}
ParsedURL::ParsedURL(const ParsedURL& base, const String& relative)
......@@ -57,36 +72,29 @@ ParsedURL::ParsedURL(const ParsedURL& base, const String& relative)
if (!base.isValid())
return;
if (relative.isEmpty()) {
unsigned relativeLength = relative.length();
if (!relativeLength) {
*this = base.withoutFragment();
return;
}
// FIXME: handle invalid URLs.
const String& baseString = base.m_spec.string();
RawURLBuffer<char, 1024> outputBuffer;
if (relative.is8Bit()) {
if (baseString.is8Bit()) {
URLParser<LChar, LChar>::parseURLWithBase(relative.characters8(), relative.length(),
baseString.characters8(), baseString.length(), base.m_segments,
outputBuffer, m_segments);
} else {
URLParser<LChar, UChar>::parseURLWithBase(relative.characters8(), relative.length(),
baseString.characters16(), baseString.length(), base.m_segments,
outputBuffer, m_segments);
}
} else {
if (baseString.is8Bit()) {
URLParser<UChar, LChar>::parseURLWithBase(relative.characters16(), relative.length(),
baseString.characters8(), baseString.length(), base.m_segments,
outputBuffer, m_segments);
} else {
URLParser<UChar, UChar>::parseURLWithBase(relative.characters16(), relative.length(),
baseString.characters16(), baseString.length(), base.m_segments,
outputBuffer, m_segments);
}
}
m_spec = URLString(String(outputBuffer.data(), outputBuffer.length()));
RawURLBuffer<char> outputBuffer;
const CString& baseStr = base.m_spec.m_string.utf8();
bool isValid = false;
if (relative.is8Bit())
isValid = URLUtilities::resolveRelative(baseStr.data(), base.m_segments,
reinterpret_cast<const char*>(relative.characters8()), relativeLength,
/* charsetConverter */ 0,
outputBuffer, &m_segments);
else
isValid = URLUtilities::resolveRelative(baseStr.data(), base.m_segments,
relative.characters16(), relativeLength,
/* charsetConverter */ 0,
outputBuffer, &m_segments);
if (isValid)
m_spec = URLString(String(outputBuffer.data(), outputBuffer.length()));
}
ParsedURL ParsedURL::isolatedCopy() const
......@@ -171,7 +179,9 @@ String ParsedURL::segment(const URLComponent& component) const
return String();
String segment = m_spec.string().substring(component.begin(), component.length());
ASSERT_WITH_MESSAGE(!segment.isEmpty(), "A valid URL component should not be empty.");
// FIXME: GoogleURL create empty segments. This happen for the fragment for the test fast/url/segments.html
// ASSERT_WITH_MESSAGE(!segment.isEmpty(), "A valid URL component should not be empty.");
return segment;
}
......
......@@ -45,7 +45,7 @@ public:
WTF_EXPORT_PRIVATE ParsedURL isolatedCopy() const;
bool isValid() const { return !m_spec.string().isEmpty(); }
bool isValid() const { return !m_spec.string().isNull(); }
// Return a URL component or a null String if the component is undefined for the URL.
WTF_EXPORT_PRIVATE String scheme() const;
......
// Copyright 2010, Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* Copyright 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/