diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/html/HTMLAnchorElement.cpp | 5 | ||||
-rw-r--r-- | Source/WebCore/page/Location.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/platform/KURLGoogle.cpp | 14 |
3 files changed, 12 insertions, 13 deletions
diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp index 4636f20..b05e7f5 100644 --- a/Source/WebCore/html/HTMLAnchorElement.cpp +++ b/Source/WebCore/html/HTMLAnchorElement.cpp @@ -405,7 +405,10 @@ void HTMLAnchorElement::setPathname(const String& value) String HTMLAnchorElement::port() const { - return String::number(href().port()); + if (href().hasPort()) + return String::number(href().port()); + + return ""; } void HTMLAnchorElement::setPort(const String& value) diff --git a/Source/WebCore/page/Location.cpp b/Source/WebCore/page/Location.cpp index 5af48cf..9528437 100644 --- a/Source/WebCore/page/Location.cpp +++ b/Source/WebCore/page/Location.cpp @@ -84,7 +84,7 @@ String Location::host() const // Note: this is the IE spec. The NS spec swaps the two, it says // "The hostname property is the concatenation of the host and port properties, separated by a colon." const KURL& url = this->url(); - return url.port() ? url.host() + ":" + String::number(url.port()) : url.host(); + return url.hasPort() ? url.host() + ":" + String::number(url.port()) : url.host(); } String Location::hostname() const @@ -101,7 +101,7 @@ String Location::port() const return String(); const KURL& url = this->url(); - return url.port() ? String::number(url.port()) : ""; + return url.hasPort() ? String::number(url.port()) : ""; } String Location::pathname() const @@ -201,7 +201,7 @@ void Location::setPort(const String& portString, DOMWindow* activeWindow, DOMWin return; KURL url = m_frame->document()->url(); int port = portString.toInt(); - if (port < 0 || port > 0xFFFF) + if (port < 0 || port > 0xFFFF || portString.isEmpty()) url.removePort(); else url.setPort(port); diff --git a/Source/WebCore/platform/KURLGoogle.cpp b/Source/WebCore/platform/KURLGoogle.cpp index 370862f..7bb1d53 100644 --- a/Source/WebCore/platform/KURLGoogle.cpp +++ b/Source/WebCore/platform/KURLGoogle.cpp @@ -670,16 +670,12 @@ void KURL::setPort(unsigned short i) { KURLGooglePrivate::Replacements replacements; String portStr; - if (i) { - portStr = String::number(i); - replacements.SetPort( - reinterpret_cast<const url_parse::UTF16Char*>(portStr.characters()), - url_parse::Component(0, portStr.length())); - } else { - // Clear any existing port when it is set to 0. - replacements.ClearPort(); - } + portStr = String::number(i); + replacements.SetPort( + reinterpret_cast<const url_parse::UTF16Char*>(portStr.characters()), + url_parse::Component(0, portStr.length())); + m_url.replaceComponents(replacements); } |